Files
OBLITERATUS/docs/EXAMPLE_SELECTION.md
T
Joseph MaglyandClaude Opus 5.5 bb9dff57e5 feat(analysis): example selection study against random and lexical baselines
Add optimization study O02: does choosing fewer, better examples
preserve targeting quality at lower cost?

- Arms at matched budgets over fit rows only: uniform stratified
  sampling (exact inclusion probabilities), lexical max-min diversity
  on hashed n-grams (no text kept), and representation arms (k-means
  representatives, k-center coreset, boundary hard negatives fitted on
  a disjoint half).
- Quality is held-out: a difference-of-means direction fitted on the
  selection is scored on select rows or a fixed group-disjoint holdout
  no arm sees. In-sample AUC is reported as optimistic and never used.
- Cost counts forward passes and activation bytes (representation arms
  pay for embedding the pool unless amortization is declared); host
  timings are reported but excluded from the verdict and digest.
- Coverage limits (every set, rare sets) flag arms that drop cases.
- The verdict is "no improvement" unless a representation arm beats
  both baselines beyond seed spread at equal or lower cost without a
  coverage flag. Locked test is refused; reports are reproducible.
- `obliteratus experiments select-examples` and a Python API.

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

5.5 KiB
Raw Permalink Blame History

Example selection study (O02)

The example-selection study asks whether fewer, better-chosen development examples keep held-out targeting quality and coverage while costing less. It compares three kinds of arm at matched example budgets, and its default answer is "no improvement".

# next to an observation run: pack and model come from <run>/spec.json
obliteratus experiments select-examples --run ./observations/<digest> --layer 3
# or explicitly, with a study config
obliteratus experiments select-examples --pack ./my-pack --model org/model --layer 3 \
    --config ./selection.json --out ./selection
from obliteratus.analysis.example_selection import lexical_features
from obliteratus.analysis.example_selection_study import run_selection_study

report = run_selection_study(labeled, "layer.3", lexical=lexical_features(plan["rows"]),
                             config={"budgets": [8, 16, 32], "seeds": 5})

The command captures the pack's labeled sets for roles fit and select as a labeled activation set, or reuses a stored set after full verification, and writes <site>.json into <run>/example-selection/ or --out. --no-timings leaves out host timings, so a fixed configuration gives a byte-identical file.

Arms

All arms choose rows from the permitted development partition only (fit by default). Each budget is split between positives and negatives in proportion to the pool, so every arm gets the same class balance.

Arm Family Method
uniform_stratified uniform baseline Strata are set labels within each class, with proportional allocation and at least one row per stratum when the budget allows. Within a stratum it samples distinct independence groups uniformly, then one row per group. Each row's inclusion probability is exact and recorded.
lexical_maxmin non-geometric baseline Greedy max-min on Jaccard distance between hashed word 1–2-gram sets. The sets come from the row text, which is held in memory only and never written.
kmeans_representatives representation Seeded k-means++ followed by Lloyd iterations; keeps the row nearest each centroid.
kcenter_coreset representation Greedy k-center (farthest point) on activations.
boundary_hard_negatives representation Fits a difference-of-means boundary on one group-disjoint half of the pool. From the other half it takes the negatives with the smallest margin, then picks a diverse subset of them by max-min. Positives come from k-center on that same half.

Evaluation

For each selected subset the study fits a difference-of-means direction (controls pooled mean-of-means). It scores the direction on independent rows: the select partition, or, when that partition is absent, a group-disjoint holdout fold of the pool that no arm sees. It reports AUC and balanced accuracy, the latter at the midpoint between the two fitted class means. Labeled sets that contain locked test rows are refused. In-sample AUC on the selected rows is reported and labelled optimistic, and the recommendation never uses it. Uncertainty is the [min, max] range over seeds; the mean and SD are reported alongside it. The full development pool and a uniform reference sample (with record ids and inclusion probability) are always reported.

Coverage limits

Limits are declared up front in config.coverage. The defaults are:

  • min_set_coverage: 1.0: every set label in the pool keeps at least one row.
  • min_rare_recall: 1.0: every rare set keeps at least min_rare_rows (default 1) rows.
  • A set is rare when its pool share is below rare_share: 0.1, or when it is listed in rare_sets.

Limits are checked only at budgets large enough to meet them. If any seed of an arm violates a limit at such a budget, the arm is flagged and cannot be recommended.

Cost accounting

Deterministic counters:

  • forward passes, meaning the rows whose activations an arm needs;
  • activation bytes at the site.

Representation arms are charged the whole pool, because they must embed every candidate. The exception is embedding_cost: "amortized", which declares that the pool activations already exist for another purpose. The boundary arm also records how many labels it consulted. Measured host values go to host_measurements: capture wall time and bytes from the capture manifest, lexical feature time and selection time. They are labelled as measurements on this host, and are excluded from report_sha256 and from the recommendation.

Adoption rule

The verdict is improvement only if all of the following hold for one representation arm:

  1. It has no coverage violation.
  2. At a budget where the limits can be checked, its lowest held-out AUC over seeds is above the highest held-out AUC of both baselines at that budget.
  3. It is not dominated on quality against cost. That is, no baseline point and no full-pool point that needs at most as many forward passes reaches that lowest AUC on mean held-out AUC.
  4. The study used at least min_seeds_for_recommendation seeds (default 3).

The verdict is no improvement in every other case. It is also no improvement when a baseline is unavailable, for example when no row text was supplied. When one of several representation variants wins, the report says it is a best-of-variants result that needs confirmation on new data.

Results on synthetic fixtures, including this project's tests, are not evidence for real models. Activation proximity is a selection aid. It does not establish semantic equivalence and does not authorize deleting records.