Files
OBLITERATUS/docs/CANDIDATE_DISCOVERY.md
Joseph MaglyandClaude Opus 5.5 5f0eafe14b feat(experiments): controlled interventions on direction and subspace estimates
Extend the controlled intervention harness beyond single channels.

- Fixed directions (rows of the pack's stored basis) and rank-k
  subspaces load from their direction artifact before the model does.
  The artifact must match the file, tensor and metadata digests that the
  dossier's source report recorded; discovery and subspace reports now
  record that binding, and reports without it are refused. Refitted
  difference-of-means directions stay refused.
- Subspace ablation removes the dose fraction of the projection onto the
  whole span. Steering a rank > 1 span needs one declared direction
  inside it (within 1e-4).
- Random controls are rank- and norm-matched: a seeded rank-k span
  orthogonal to the target span, and for a declared steering direction a
  rank-1 vector orthogonal to the whole span. Mismatched controls are
  refused before the arms run and at attachment.
- Each arm records target kind, rank, digests and orthogonalization.
  Evaluation rows on the artifact's own fit role and revision are
  refused. Channel specs and digests are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 20:26:07 -05:00

6.9 KiB

Dataset-level candidate discovery

Candidate discovery extends the two-prompt neuron candidate scan to distributions over a labeled activation set (see docs/LABELED_SUBSPACE.md). At one decoder site it ranks single coordinates by how well they separate labeled classes on held-out rows, and reports every measure separately. There is no combined importance score. A table is a descriptive association between a coordinate and set labels, not a causal or intervention claim.

# next to an observation run: pack and model come from <run>/spec.json
obliteratus experiments discover --run ./observations/<digest> --layer 3
# or explicitly, with the pack's extracted direction as extra candidates
obliteratus experiments discover --pack ./my-pack --model org/model --layer 3 \
    --direction ./baseline/direction.safetensors --out ./candidates
from obliteratus.analysis.candidate_confounds import confound_features
from obliteratus.analysis.candidate_discovery import discover_candidates
from obliteratus.experiments.discover import run_discover

result = discover_candidates(labeled, "layer.3", mode="binary",
                             discovery_roles=["fit"], validation_roles=["select"],
                             direction=direction,
                             confounds=confound_features(pack, tokenizer, labeled))
summary = run_discover(pack, model, tokenizer, 3, "./candidates", model_id="org/model")

Candidates and classes

Coordinate type Identity Fit
channel one hidden unit of the site (channel:<site>:<index>) sign and midpoint per training fold
residual_direction, difference_of_means_refit unit difference of class means refitted inside every training fold
residual_direction, pack_direction each row of the pack's stored basis at the layer fixed vector; sign and midpoint per training fold

--mode binary (default) contrasts the positive set with every control set; neighbour and battery sets are not used. --mode sets contrasts each non-battery set with all other non-battery sets, one table per class. Feature dictionaries are out of scope.

Rows, folds and refits

  • Discovery rows (--discovery-role, default fit) are split into group-disjoint, label-stratified folds over dataset independence units. Every fitted step (difference-of-means direction, sign, midpoint, channel ranking, confound baselines) is refitted on each training fold; held-out scores are pooled across folds.
  • Tables are ordered by held-out AUC. Choosing the best of many channels inflates its held-out AUC, so each contrast also reports recipe_top1: the pooled held-out AUC of each fold's own top channel, ranked on that fold's training rows only.
  • Selected candidates are then refitted on all discovery rows and scored on validation rows (--validation-role, default select) when they exist, with their own group-bootstrap intervals. Use --no-validation for packs without partitions (legacy packs are fit-only).
  • Each candidate has three sections, each with fit_on_evaluation_data: heldout (false for refits; for a pack direction, read from its dataset access receipt as in the subspace report), validation (same rule), and in_sample (always true: fitted and scored on the same rows). A held-out overlap that is true or unknown is also listed in the candidate's flags.

Measures (reported separately)

  • Separability: held-out AUC and balanced accuracy at the training-fold midpoint, plus per-fold AUC.
  • Effect magnitude: standardized mean difference (pooled SD) of held-out scores.
  • Uncertainty: 95% percentile intervals from resampling whole groups (--n-bootstrap).
  • Stability: fraction of folds agreeing with the majority sign; for channels, the fraction of folds where the channel is in the training-fold top N and its mean training-fold rank; for the refitted direction, the mean pairwise cosine of the fold directions.
  • Nulls: a shuffled-label null that permutes labels between whole groups (groups holding both classes shuffle labels inside the group) and reruns the whole recipe (--n-permutations). Channels are compared with the null maximum over all scanned channels, pack rows with the maximum over pack rows. Also reported: the quantile among random unit directions (--n-random) and, for channels, among all scanned channels. exceeds_q95 compares with the null 0.95 quantile.
  • Confounds: a prompt-length baseline (token count of each input) and a lexical baseline (ridge probe on hashed token-id presence, 256 buckets), both refitted per fold, plus each candidate's rank correlation with length. A candidate gets length_baseline_matches or lexical_baseline_matches when that baseline reaches AUC at least 0.5 + margin and lies within the margin (default 0.05) of the candidate's held-out AUC, and length_correlated when |rho| >= 0.5. Features are derived in memory from the pack rows and the tokenizer; no text is stored.

Locked test and compute caps

Rows with role test are never used for discovery or validation, even in a labeled set captured with --allow-locked-test; requesting role test for either purpose is refused, and such rows are counted in excluded_rows.locked_test.

Option Default Cap
--folds 5 20
--top-n (per coordinate type and class) 10 50
--max-channels 4096 65536
--n-bootstrap 200 2000
--n-permutations 100 1000
--n-random 100 1000
--top-examples 5 20

When a site is wider than --max-channels, the highest-variance channels over discovery rows are scanned (a label-free screen).

Output

<out>/labeled-<site>-<roles>/        verified labeled set (reused when present)
<out>/<site>-<mode>-<discovery roles>.json   obliteratus.candidate-discovery, schema_version 1

Each contrast holds row and group counts, confound baselines, recipe_top1, null summaries and two tables (channel, residual_direction). Each candidate holds its coordinate, the three scoring sections, stability, nulls, confound flags, target/rest score distributions (summary statistics and a shared-bin histogram, from validation scores when present, otherwise held-out scores) and top examples by record id, set, role and input SHA-256 only.

With --direction, the report's pack_direction block records the stored basis (concept id, layer, rank, fit overlap) and its artifact binding artifact: {path, file_sha256, tensor_sha256, metadata_sha256}: the resolved path, the SHA-256 of the .safetensors bytes, the tensor digest the sidecar records and the SHA-256 of the sidecar bytes. The artifact must hold exactly the tensors discovery used. A controlled intervention on a pack-basis row uses only an artifact matching this binding.

When <run>/candidates/ holds results, the Explorer's "Candidate discoveries" section lists the first candidates of each table as a descriptive table.