Files
OBLITERATUS/docs/MUTATION_SEARCH.md
Joseph MaglyandClaude Opus 5.5 b04906e15c feat(experiments): bounded mutation search with Pareto selection
Add F19: a replayable, budgeted search over qualified operations only,
with an all-attempt ledger, Pareto-first selection and independently
confirmed finalists.

- The space is built from persistent-pilot eligible registrations
  (declared coefficient grids and forms), selected candidates and
  recovered candidates, and complete sequences in their evidenced
  order; anything else is refused. Confirmation and test rows are
  refused for search. The space is write-once and digest-identified.
- Proposals reuse the project's Optuna TPE multi-objective approach
  with per-trial seeding, so replay reproduces the ledger; pruning uses
  the anytime-valid screening rule.
- An append-only, hash-chained ledger records every trial; trial ids are
  content digests, and an interrupted trial is marked incomplete and
  re-run or discarded once. Incomplete trials never win.
- Trials with invalid outputs, failing or unmeasured collateral
  endpoints, or target gains flagged by the weak-scorer check are
  infeasible. The Pareto front is reported before any pre-declared
  aggregate score.
- Finalists must pass a fresh locked confirmation registration created
  after the search and disjoint from development rows; search winner
  and confirmed finalist are reported separately.
- `obliteratus experiments search plan|run|resume|front|confirm`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 13:26:24 -05:00

149 lines
7.8 KiB
Markdown

# Bounded mutation search
The search looks for a better edit only among operations that are already
qualified. It runs on development data, records every attempt, shows the
tradeoff between target effect, retained capability and cost, and treats its
winner as a development result until a finalist passes a fresh locked
confirmation.
```bash
obliteratus experiments search plan search-spec.json --out ./search
obliteratus experiments search run ./search --source ./models/reference
obliteratus experiments search resume ./search --source ./models/reference [--incomplete discard]
obliteratus experiments search front ./search
obliteratus experiments search confirm ./search --trial sha256:<trial> \
--registration sha256:<fresh registration> --candidate sha256:<candidate>
```
`run` and `resume` take `--outcomes outcomes.json` (`obliteratus.search-outcomes/1`)
instead of `--source` to replay recorded per-point outcomes.
```python
from obliteratus.experiments.search_space import plan_search
from obliteratus.experiments.search_eval import ModelEvaluator
from obliteratus.experiments.search_run import front, run_search
from obliteratus.experiments.search_confirm import confirm_finalist
space = plan_search("search-spec.json", "search")
run_search("search", ModelEvaluator(space, "models/reference"))
report = front("search")
```
## Space
The spec (`obliteratus.search-spec/1`) lists arms, development data and rules:
```json
{"schema": "obliteratus.search-spec/1", "seed": 0,
"arms": [{"id": "steer", "kind": "registration", "run": "obs/run", "registration": "sha256:...",
"coefficient": {"low": 2.0, "high": 6.0, "step": 1.0},
"forms": ["activation_adapter", "weight_edit"]},
{"id": "saved", "kind": "candidate", "run": "obs/run", "candidate": "sha256:...",
"recovery": ["sha256:..."]},
{"id": "pair", "kind": "sequence", "store": "seq-store", "sequence": "sha256:..."}],
"development": {"dataset": {"pack": "packs/dev", "revision": "sha256:...", "role": "select"}},
"constraints": {"collateral_margin": null, "min_pairs": 1},
"weak_scorer": {"sample": 16, "max_degenerate_gain_fraction": 0.0, "min_agreement": 0.9},
"pruning": {"rows": 0, "below": 0.2, "alpha": 0.05, "method": "mixture-martingale"},
"early_stopping": {"patience": null},
"budget": {"max_trials": 20, "max_artifacts": 0, "max_bytes": 0, "max_cost": null},
"sampler": {"startup_trials": 4, "resamples": 4},
"selection": {"max_finalists": 3, "weights": null}}
```
`plan` refuses, before anything runs:
* a `registration` arm whose key is not `persistent-pilot eligible` (the
persistent-candidate gate, see `CONFIRMATION_REGISTRY.md`), a coefficient
range outside `(0, 1]` for projection fractions or of the opposite sign to
the registered decision coefficient for steering, and unknown forms;
* a `candidate` arm that is not selected (`PERSISTENT_CANDIDATES.md`), a
recovery option that is not a selected recovered candidate of that parent
(`CANDIDATE_RECOVERY.md`), and a `sequence` arm that is not complete
(`TRANSACTIONAL_SEQUENCES.md`; its order is the one its interaction evidence
admitted). Every component registration must still pass the gate;
* arms with different target tasks or effect directions, unknown kinds or keys;
* development rows with role `test` or `confirmation`, a dataset role other
than `select` or `calibrate`, and any row of a registered confirmation set in
a run the space uses.
The space (`<out>/space.json`) is written once. Its id is the canonical digest
of its frozen content: resolved arms and their evidence, coefficient grids,
development row digests, rules, weights, the seed and the registrations that
existed at planning time. Fixture results count only with
`"allow_fixture_results": true` (tests), which marks the space
`software-contract`.
## Trials and ledger
Proposals reuse the Optuna TPE sampler in multi-objective mode, as the
abliteration optimizer does. The proposal for trial `i` is a pure function of
the space, its seed, `i` and the finished trials before `i`, so a resumed search
proposes exactly what an uninterrupted one would. A repeated point is resampled,
then replaced by the first untried point; a fully tried space stops the search.
With `pruning.rows > 0` a trial is first screened on a seeded prefix of target
rows with the anytime-valid stage-1 rule of `CALIBRATED_SCREENING.md` and pruned
on evidence that its desired-outcome rate is below `pruning.below`. Survivors are
evaluated on every development row. Before each trial the search stops on
`max_trials`, `max_cost` (summed compute), an exceeded storage budget (the
offending trial is failed and its files removed) or early stopping (the
development front unchanged for `patience` trials).
`<out>/ledger.jsonl` is append-only and hash-chained. It records `start`,
`finish` (status `completed`, `failed` or `pruned`, metrics, endpoints, collateral
pairs, artifact paths, digests and sizes), `incomplete`, `discard` and `stop`.
Trial ids are digests of space, index and point. A trial that started and never
finished is marked `incomplete` on resume, then re-run under the same id (the
default) or discarded. Either way it is counted once, and an incomplete,
running or discarded trial never enters the front or confirmation. Failed,
pruned and infeasible trials stay in the ledger.
## Selection and scorer exploitation
A completed trial is feasible only when its target task's invalid-output
endpoint and every collateral endpoint are `PASS` (the scorecards' paired
non-degradation rule at the collateral margin), at least one collateral
endpoint was measured, and the weak-scorer check passes. On a deterministic
sample of target rows the check flags target gains whose outputs are invalid or
fail an independent format check (empty, or no letter or digit), and requires
the primary scorer to agree with that check and with an evaluator's
independent `secondary` judgement on at least `min_agreement` of the sample. An
infeasible trial is excluded whatever its target score.
`front` reports the Pareto front over feasible trials (target effect up,
retained capability `1 - max collateral loss rate` up, cost down) first, then
the weighted score. Weights must be declared in the spec, so they are part of
the space identity; without them no aggregate is computed and finalists are
ordered by effect, retained capability and cost. The report also lists every
excluded trial with its reason, usage against the budgets and a
`ledger_digest`, which is equal for runs replayed with the same space, seed and
outcomes.
## Confirmation
The search winner is not a confirmed result. `confirm` checks one front trial:
* the finalist artifact must be selected and bound to the trial: a persistent
candidate with the same target key, operation, coefficient and form, the arm's
candidate or selected recovered candidate, or the arm's complete sequence;
* the registration must be a confirmation registration of the same target key
(and, for single edits, operation and decision coefficient) that did not
exist at planning time, was created after the last trial finished and shares
no rows with the development data;
* its outcome is recomputed from the registry: `pending` while locked,
`confirmed` only when unlocked as `supported`, otherwise `not confirmed`.
Attempts are appended to `<out>/confirmations.jsonl`; `front` recomputes them
and lists confirmed and not-confirmed finalists next to the search winner. A
coefficient other than the registered decision coefficient needs its own
dossier hypothesis and registration before a candidate can be built and
confirmed.
## Limits
The model evaluator covers registration arms (the operation installed
temporarily, with restoration checked) and candidate arms (loaded from disk);
sequence arms and recovery options need recorded outcomes or a custom evaluator.
Results hold for the evaluated model, rows and backend only.