SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2609.13737 · September 2026

ForeSight: Enhancing Risk Monitoring via Early Safety Signal Distillation

Qi Cao, Yang Yang, Yao Zhu, Shizhou Huang, Ling Xu, Xiaohui Zhu, Hanling Wang, Chenlong Wei, Hanyan Niu

arXiv · PDF · Open in the Atlas

Code that ran

13 of 14 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 12 failures of our instrument; 1 no recorded run), measured 2026-11-24; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2609.13737.json · badge: /api/ran/2609.13737.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
Scabbards1500/Foresight canonical (classifier label)
classifier basis: census
13 ran · 1 no recorded run
FunctionStatusWhere it lives
aggregate_features_cluster Ran
ran; our contract draft was wrong, not the code
Scabbards1500/Foresight/train/cluster_aggregate.py
code served (permissive licence) · get_code("679b091c82c7bb55")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Set random seed for reproducibility
np.random.seed(0)

# Create sample representations for 2 samples, with data for layer 0 and layer 1
# Each layer has pooling_type results
representations = [
    {
        0: {'avg_pool': np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float64)},
        1: {'avg_pool': np.array([5.0, 6.0, 7.0, 8.0], dtype=np.float64)},
    },
    {
        0: {'avg_pool': np.array([1.5, 2.5, 3.5, 4.5], dtype=np.float64)},
        1: {'avg_pool': np.array([5.5, 6.5, 7.5, 8.5], dtype=np.float64)},
    },
]

pooling_type = 'avg_pool'

# Selected neurons for each layer_pooling_type combination
# layer0_avg_pool selects indices 0, 1, 2 from the 4 neurons
# layer1_avg_pool selects indices 1, 2, 3 from the 4 neurons
selected_neurons_dict = {
    'layer0_avg_pool': np.array([0, 1, 2], dtype=np.int64),
    'layer1_avg_pool': np.array([1, 2, 3], dtype=np.int64),
}

# Layer weights for weighting the aggregated features
layer_weights = {
    0: 2.0,
    1: 1.5,
}

# Cluster labels for each layer_pooling_type
# For layer0_avg_pool: 3 selected neurons grouped into 2 clusters
# For layer1_avg_pool: 3 selected neurons grouped into 2 clusters
cluster_labels = {
    'layer0_avg_pool': np.array([0, 0, 1], dtype=np.int64),
    'layer1_avg_pool': np.array([0, 1, 1], dtype=np.int64),
}

selected_layers = [0, 1]

ARGS = {
    'representations': representations,
    'pooling_type': pooling_type,
    'selected_neurons_dict': selected_neurons_dict,
    'layer_weights': layer_weights,
    'cluster_labels': cluster_labels,
    'selected_layers': selected_layers,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
base_jsonl Ran
ran; our contract draft was wrong, not the code
Scabbards1500/Foresight/steer/evaluate.py
code served (permissive licence) · get_code("156e34b680f94a25")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned PosixPath. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from pathlib import Path

ARGS = {
    "path": Path("/tmp/test_file.judged.jsonl")
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PosixPath — a PosixPath output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PosixPath output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compute_per_dataset_f1 Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Scabbards1500/Foresight/train/train_foresight.py
code served (permissive licence) · get_code("17f318b1d4ea9d63")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create sample data for compute_per_dataset_f1
# The function expects:
# - y_true: ground truth labels (array-like)
# - y_pred: predicted labels (array-like)
# - dataset_ids: dataset identifiers (array-like)

# Create sample with multiple datasets
# Let's create 10 samples across 3 datasets
y_true = np.array([0, 1, 0, 1, 0, 1, 1, 0, 1, 0])
y_pred = np.array([0, 1, 0, 0, 0, 1, 1, 0, 1, 1])
dataset_ids = np.array([1, 1, 1, 2, 2, 2, 3, 3, 3, 3])

ARGS = {
    'y_true': y_true,
    'y_pred': y_pred,
    'dataset_ids': dataset_ids
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
eval_target_per_dataset_metrics Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Scabbards1500/Foresight/train/train_foresight.py
code served (permissive licence) · get_code("ddeb00ae12b81023")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Construct test data for eval_target_per_dataset_metrics
# The function expects:
# - y_true: array-like of true labels
# - y_pred: array-like of predicted labels
# - dataset_ids: array-like of dataset identifiers

# Create small test arrays
y_true = np.array([0, 1, 0, 1, 0, 1, 0, 1])
y_pred = np.array([0, 1, 0, 0, 1, 1, 0, 1])
dataset_ids = np.array(['dataset_a', 'dataset_a', 'dataset_a', 'dataset_a', 
                        'dataset_b', 'dataset_b', 'dataset_b', 'dataset_b'])

ARGS = {
    'y_true': y_true,
    'y_pred': y_pred,
    'dataset_ids': dataset_ids
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
fit_cluster_labels Ran
ran; our contract draft was wrong, not the code
Scabbards1500/Foresight/train/cluster_aggregate.py
code served (permissive licence) · get_code("05f31a32a6b59aa3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from sklearn.cluster import KMeans

# Build train_representations: list of dicts with layer_idx as key
# Each layer has pooling_type as key, value is array of shape (n_neurons,)
# We'll create 3 samples, 2 layers, with different neuron counts per layer

train_representations = []
for sample_id in range(3):
    sample_rep = {}
    # Layer 0: 8 neurons
    sample_rep[0] = {
        'mean': np.random.randn(8).astype(np.float64),
        'max': np.random.randn(8).astype(np.float64),
    }
    # Layer 1: 6 neurons
    sample_rep[1] = {
        'mean': np.random.randn(6).astype(np.float64),
        'max': np.random.randn(6).astype(np.float64),
    }
    train_representations.append(sample_rep)

pooling_type = 'mean'

# selected_neurons_dict maps layer keys to indices of selected neurons
selected_neurons_dict = {
    'layer0_mean': np.array([0, 2, 5, 7], dtype=np.int64),  # 4 selected from layer 0
    'layer1_mean': np.array([1, 3], dtype=np.int64),        # 2 selected from layer 1
}

# layer_weights dict specifies which layers to process
layer_weights = {
    0: 1.0,
    1: 0.5,
}

cluster_k = 2

ARGS = {
    'train_representations': train_representations,
    'pooling_type': pooling_type,
    'selected_neurons_dict': selected_neurons_dict,
    'layer_weights': layer_weights,
    'cluster_k': cluster_k,
    'max_train_samples': 0,
    'seed': 42,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
fit_supervised_two_cluster_labels Ran
ran; our contract draft was wrong, not the code
Scabbards1500/Foresight/train/cluster_aggregate.py
code served (permissive licence) · get_code("b03c3203049dc8fb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Set random seed for reproducibility
np.random.seed(42)

# Create small training representations
# Each sample has representations for multiple layers
# Each layer has a pooling_type (e.g., 'mean') with neuron activations
train_representations = [
    {
        0: {'mean': np.random.randn(10).astype(np.float64)},  # layer 0, 10 neurons
        1: {'mean': np.random.randn(8).astype(np.float64)},   # layer 1, 8 neurons
    },
    {
        0: {'mean': np.random.randn(10).astype(np.float64)},
        1: {'mean': np.random.randn(8).astype(np.float64)},
    },
    {
        0: {'mean': np.random.randn(10).astype(np.float64)},
        1: {'mean': np.random.randn(8).astype(np.float64)},
    },
    {
        0: {'mean': np.random.randn(10).astype(np.float64)},
        1: {'mean': np.random.randn(8).astype(np.float64)},
    },
]

# Create pooling type
pooling_type = 'mean'

# Create selected neurons dict - indices of neurons to select for each layer
selected_neurons_dict = {
    'layer0_mean': np.array([0, 2, 5], dtype=np.int64),  # select 3 neurons from layer 0
    'layer1_mean': np.array([1, 3, 4, 6], dtype=np.int64),  # select 4 neurons from layer 1
}

# Create layer weights dict - indicates which layers to process
layer_weights = {
    0: 1.0,  # layer 0 weight
    1: 1.0,  # layer 1 weight
}

# Create binary labels: 1=harmful, 0=benign
y_train = np.array([0, 1, 0, 1], dtype=np.int64)

ARGS = {
    'train_representations': train_representations,
    'pooling_type': pooling_type,
    'selected_neurons_dict': selected_neurons_dict,
    'layer_weights': layer_weights,
    'y_train': y_train,
    'max_train_samples': 0,
    'seed': 42,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
judged_path Ran
ran; our contract draft was wrong, not the code
Scabbards1500/Foresight/steer/evaluate.py
code served (permissive licence) · get_code("c1586399f6fa28bf")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned PosixPath. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from pathlib import Path

ARGS = {
    "source": Path("data/example.jsonl"),
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PosixPath — a PosixPath output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PosixPath output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_json_rows Ran
ran; our contract draft was wrong, not the code
Scabbards1500/Foresight/steer/lib.py
code served (permissive licence) · get_code("ed9cbeadadd039a8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import os
import tempfile
from pathlib import Path

# Create a temporary directory structure with test JSON files
temp_dir = tempfile.TemporaryDirectory()
temp_path = Path(temp_dir.name)

# Create dataset directory structure
dataset_dir = temp_path / "test_dataset" / "test_model"
dataset_dir.mkdir(parents=True, exist_ok=True)

# Create a test JSON file for the split
test_data = [
    {"id": 1, "text": "sample1"},
    {"id": 2, "text": "sample2"}
]

split_file = dataset_dir / "test_split.json"
with open(split_file, "w", encoding="utf-8") as f:
    json.dump(test_data, f)

# Set environment variable to point to our temp directory
os.environ['HARMFUL_DATASETS_DIR'] = str(temp_path)

# Define the arguments for load_json_rows function
ARGS = {
    "dataset": "test_dataset",
    "model_key": "test_model",
    "split": "test_split"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_json_rows_split Ran
ran; our contract draft was wrong, not the code
Scabbards1500/Foresight/steer/lib.py
code served (permissive licence) · get_code("5d56cdadc4dea7d6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import os
import tempfile
from pathlib import Path

# Create a temporary directory structure with test data
temp_dir = tempfile.mkdtemp()
dataset_dir = Path(temp_dir) / 'test_dataset' / 'test_model'
dataset_dir.mkdir(parents=True, exist_ok=True)

# Create test JSON files
test_data = [
    {'id': 1, 'text': 'example 1'},
    {'id': 2, 'text': 'example 2'}
]

# Write primary split file
split_file = dataset_dir / 'train.json'
with open(split_file, 'w', encoding='utf-8') as f:
    json.dump(test_data, f)

# Write fallback split file
fallback_file = dataset_dir / 'validation.json'
with open(fallback_file, 'w', encoding='utf-8') as f:
    json.dump(test_data, f)

# Set environment variable to point to our temp directory
os.environ['HARMFUL_DATASETS_DIR'] = temp_dir

ARGS = {
    'dataset': 'test_dataset',
    'model_key': 'test_model',
    'split': 'train',
    'fallbacks': ('validation', 'test')
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
npz_to_representations Ran
ran; our contract draft was wrong, not the code
Scabbards1500/Foresight/train/npz_hidden.py
code served (permissive licence) · get_code("5584fc63e586901a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import tempfile
from pathlib import Path

# Create a temporary NPZ file with the required structure
temp_dir = tempfile.mkdtemp()
npz_path = Path(temp_dir) / "test_representations.npz"

# Create sample data with 3 layers and feature dimension 128
num_layers = 3
feature_dim = 128

# Build arrays that match the expected structure
residual_data = np.random.randn(num_layers, feature_dim).astype(np.float32)
mlp_data = np.random.randn(num_layers, feature_dim).astype(np.float32)

# Save to NPZ file
np.savez(npz_path, residual=residual_data, mlp=mlp_data)

ARGS = {
    "npz_path": npz_path,
    "num_layers": 3,
    "rep_types": ["residual_mean", "mlp_mean"]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
resolve_input_jsonl Ran
ran; our contract draft was wrong, not the code
Scabbards1500/Foresight/steer/evaluate.py
code served (permissive licence) · get_code("e75b5e64884712cc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned PosixPath. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from pathlib import Path
import tempfile

# Create a temporary directory to work with
temp_dir = tempfile.mkdtemp()
temp_path = Path(temp_dir)

# Create test files to make the function work correctly
# Create a base jsonl file
base_file = temp_path / "data.jsonl"
base_file.write_text('{"test": "data"}\n')

# Create a judged jsonl file
judged_file = temp_path / "data.judged.jsonl"
judged_file.write_text('{"test": "judged"}\n')

# The function takes a Path object and resolves it
# It checks if a .judged.jsonl version exists, and returns that if it does,
# otherwise returns the base .jsonl path
path_arg = judged_file

ARGS = {
    "path": path_arg
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PosixPath — a PosixPath output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PosixPath output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
resolve_steer_layers Ran
ran; our contract draft was wrong, not the code
Scabbards1500/Foresight/steer/lib.py
code served (permissive licence) · get_code("74e8b7fbdbf7b102")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# The function resolve_steer_layers takes:
# - selected_layers: list[int] - a list of layer indices
# - last_n_layers: int - number of last layers to keep

# Looking at the function body:
# - It converts selected_layers to integers and sorts them
# - It checks if last_n_layers is <= 0 or >= len(layers)
# - It returns either all layers or the last N layers

# Test case 1: Normal case with multiple layers and valid last_n_layers
ARGS = {
    "selected_layers": [2, 0, 5, 1, 3],
    "last_n_layers": 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
select_salient_neurons Ran
ran, honoured the contract we drafted
Scabbards1500/Foresight/train/train_foresight.py
code served (permissive licence) · get_code("6c738d56001355d3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

class MockProbe:
    def __init__(self, feature_importance):
        self.feature_importance = feature_importance
    
    def get_feature_importance(self):
        return self.feature_importance

# Create feature importance weights with distinct values
# Using 5 neurons with varying importance scores
feature_weights = np.array([0.1, 0.3, 0.05, 0.45, 0.1], dtype=np.float32)

probe = MockProbe(feature_weights)
threshold = 0.7

ARGS = {
    "probe": probe,
    "threshold": threshold,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
preprocess_dataset Not yet run
unverified (harvested, no recorded run)
Scabbards1500/Foresight/train/preprocess.py
code served (permissive licence) · get_code("02a30e29a00dfe0e")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 14 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

As large language models (LLMs) are increasingly deployed, the generation of harmful content has become a critical safety concern. Existing safeguards operate at the input, output, or streaming-generation stages, while early-risk methods that rely on surface tokens or output logits may suffer from weak initial signals, and internals-based detectors using dense representations may retain highly entangled and redundant safety-irrelevant information. It therefore remains unclear whether the earliest post-generation hidden states already contain reliable signals about final-response harmfulness. To address this gap, we propose ForeSight, a first-token output-risk forecasting framework that distills weak and redundant early safety signals into compact, layer-aware risk representations. Experiments on five safety benchmarks and two target models demonstrate that ForeSight achieves superior and efficient early-risk forecasting while relying solely on first-token hidden states. The code is available at: https://github.com/Scabbards1500/Foresight

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2609.13737")
get_code_for_paper("2609.13737")
have("2609.13737")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2609.13737.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2609.13737.svg)](https://syntology.ai/paper/2609.13737)

Connect an agent — have() is free.