mixle.doe.amplify module¶
Capture an amplified teacher with collapse monitoring.
The “amplified teacher” here is optimize_under_oracle()’s search itself: round 1
spends an n_init + n_iter oracle-call budget searching, and must be verified stronger than a
budget-matched random baseline of the same size before anything else happens. A search’s best-of-N
compared against a single extra random draw is a multiple-comparisons trap, not a fair test: for N+1
values drawn i.i.d. from the same distribution, exchangeability alone gives P(max of the first N > the
last one) = N / (N+1), so passage becomes increasingly automatic as the budget N grows even when the
search adds no real capability, and the one extra draw was never counted against the stated budget
either. Matching the baseline’s budget to the search’s and testing “is round 1’s best score bigger than
the baseline’s best score by more than a fair reshuffling of the same 2N scores would typically
produce” with a one-sided permutation test (rather than a bare, un-tested “is my number bigger” check on
two single points) is what keeps the gate a calibrated statistical claim instead of a counter that trends
toward “always passes”. If the search does not clear the gate at the significance level, there is
nothing to capture, and this function stops with an explicit reason rather than distilling nothing.
The student captured from round 1 is a low-cost regression surrogate of the oracle’s score landscape, fit
only from round 1’s oracle-verified (x, score) pairs. It never grades a candidate itself; it only
proposes where round 2 should spend its matched oracle-call budget – against a FRESH candidate pool that
excludes round 1’s own points, so round 2 cannot pad its score by re-verifying already-known winners (see
amplify_and_capture). student(x) is a plain candidate -> predicted_score callable, the same
shape any other teacher/task-model in this codebase is called with. Every accepted score in round 2
still comes from the oracle. No student or LLM self-grade enters DesignRun.history.
mixle.task.collapse.collapse_monitor() checks the two-round trajectory for
regression or mode collapse; it is reused here rather than reimplemented.
- class StudentTeacher(coef, degree)[source]
Bases:
objectCaptured regression surrogate used to rank follow-up design candidates.
The object is callable as
student(x) -> predicted_scoreso it can be used like other teacher/task-model callables, but its role here is only proposal ranking. Accepted scores still come from the verifiable oracle.
- fit_student(run, *, degree=2)[source]
Fit
StudentTeacherfromrun’s GENUINE (non-abstained) oracle-verified history.Fits against
run.genuine_history, notrun.history: an abstained candidate’s placeholder-infscore (OracleResult.abstained– e.g. a timeout) is not a real observation of the oracle’s objective, and least-squares regression has no tolerance for a non-finite target at all – unlike the permutation test inamplify_and_capture, where a lone-infonly nudges a p-value, here a SINGLE abstained candidate anywhere inrun.historydrives every coefficient incoeftonan(confirmed: a clean fit against 8 well-posed genuine points, then adding one abstained candidate to the same history turns the entire coefficient vector tonan), silently turning the captured student that guides round 2’s candidate ranking into a useless, uniformly-nanpredictor with no visible error at the call site.- Parameters:
run (DesignRun)
degree (int)
- Return type:
StudentTeacher
- class AmplificationRound(run, best_score, xs)[source]
Bases:
objectOne oracle-verified amplification round and its best observed score.
- class AmplificationSeeds(search, baseline, permutation, round2_pool)[source]
Bases:
objectConcrete independent random streams used by an amplification receipt.
- class AmplifyReport(round1, round2, baseline, baseline_p_value, significance, beats_baseline, round2_beats_round1, incumbent_best_score, collapse, student, stopped_early, reason, seeds, round1_effective_n, baseline_effective_n, round2_effective_n)[source]
Bases:
objectReceipt for a two-round amplify-and-capture run.
round1is the initial oracle-driven search.baselineis a random draw matched to round 1’s exact oracle-call budget (not a single draw – seeamplify_and_capture), so every oracle call either side spent is accounted for in its own receiptedAmplificationRound.baseline_p_valueis the one-sided permutation-test p-value for “round 1’s best score exceeds the baseline’s best score by more than chance”, tested against the prespecifiedsignificancelevel to producebeats_baseline.round2is present only when round 1 clears that gate, and a captured student is used to propose the matched-budget follow-up batch from a FRESH candidate pool (round 1’s own points are never re-offered to round 2, soround2_beats_round1measures generalization to unseen candidates, not re-verification of already-known ones).incumbent_best_scoreis bookkeeping only – the best score retained across whichever rounds ran – and, unlike round 1’s era of this report, plays no part in computinground2_beats_round1orcollapse.collapserecords the trajectory-level collapse verdict when both rounds run.- Parameters:
round1 (AmplificationRound)
round2 (AmplificationRound | None)
baseline (AmplificationRound)
baseline_p_value (float | None)
significance (float)
beats_baseline (bool)
round2_beats_round1 (bool)
incumbent_best_score (float | None)
collapse (CollapseVerdict | None)
student (StudentTeacher | None)
stopped_early (bool)
reason (str | None)
seeds (AmplificationSeeds)
round1_effective_n (int)
baseline_effective_n (int)
round2_effective_n (int | None)
- amplify_and_capture(oracle, bounds, *, n_init=5, n_iter=10, candidate_pool_size=200, degree=2, significance=0.05, seed=None)[source]
Round 1: search the oracle for a budget of
n_init + n_itercalls (the amplified teacher).The search must beat a budget-matched random baseline – also
n_init + n_iteroracle-verified draws, not one – on a one-sided permutation test of “round 1’s best score exceeds the baseline’s best score by more than a fair reshuffling of the pooled2 * budgetscores would typically produce”, at the prespecifiedsignificancelevel. A single best-of-N-vs-one-draw comparison is a multiple-comparisons trap (see the module docstring): matching the baseline’s budget to the search’s, and testing the two best-of-budget scores against the null distribution obtained by repeatedly reshuffling which of the2 * budgetoracle-verified scores “belong” to round 1 versus the baseline (rather than a bare, un-tested “is my number bigger” check), is what makesbeats_baselinea calibrated claim instead of a counter that trends toward “always passes” as the budget grows. If the search does not clear the gate, this returns the explicitstopped_early=Trueresult with nothing distilled.Otherwise: fit
StudentTeacherfrom round 1’s history; round 2 uses the student to rank a large, FRESH candidate pool (never round 1’s own points – see the round 2 comment below) and spends the same oracle-call budget verifying only the top-ranked fresh candidates – student-guided, not blind, but every accepted score is still oracle-verified. Runsmixle.task.collapse.collapse_monitor()over the two rounds.