mixle.task.propose module¶
Budgeted propose-verify-retrain loop over a discrete structured design space.
This module handles structured and discrete candidates such as short protein-like sequences or compact
program sketches. It uses a proposal distribution over short fixed-length symbol sequences, with one
CategoricalDistribution per position, then
samples K candidates per round, verifies every one against a
VerifiableOracle, keeps the verifiably-better ones, and refits the proposal
on the winners (reweighted MLE through the shared mixle.inference.optimize() EM driver – no
hand-rolled counting) for a fixed number of rounds under a hard oracle-call budget
(k_per_round * rounds). Every candidate tried is retained in the round log, dead ends included;
only keep_frac of each round feeds the refit.
Same “no verifiable objective, no optimization” precondition as optimize_under_oracle:
oracle=None refuses immediately rather than fabricating a candidate.
An abstained oracle call (OracleResult.abstained – e.g. a timeout; see
VerifiableOracle) is never selected as a “winner” to refit on, and never
becomes best_result: its placeholder -inf score is not a real observation of the oracle’s
objective, only a record that the oracle did not answer. Every attempted candidate is still logged in
its round’s RoundLog, abstained or not, for the full receipted record – only the selection
and best-result bookkeeping exclude abstentions, mirroring
mixle.doe.oracle.optimize_under_oracle()’s own “always record, selectively use” pattern.
- class SequenceProposal(alphabet, length, pseudo_count=1.0, position_models=<factory>)[source]
Bases:
objectA position-independent categorical proposal over fixed-length sequences from
alphabet.- Parameters:
- sample(k, rng)[source]
Draw
ki.i.d. sequences (eachlengthsymbols) from the current proposal.
- refit(sequences, weights)[source]
Reweighted MLE: refit each position’s categorical on
sequences, replicated in that position’s training multiset proportional toweights, through the sharedoptimizeEM driver – never a hand-rolled frequency count.
- class RoundLog(round_index, candidates, results, kept_indices)[source]
Bases:
objectOne round’s full record: every candidate tried and its oracle result, plus which were kept.
candidates/resultsinclude every attempted candidate, abstained or not – dead ends and abstentions alike are never dropped from the receipted record.kept_indicesnever includes an abstained candidate’s index (seepropose_verify_retrain): an abstention is not a real observation of the oracle’s objective, so it is excluded from the ranking that produceskept_indiceseven when there are too few genuine candidates in the round to fill the usual quota.
- class ProposeVerifyResult(proposal, rounds=<factory>, best_candidate=None, best_result=None)[source]
Bases:
objectThe full receipted history of a propose-verify-retrain run.
- Parameters:
- property oracle_calls: int
Return the total number of candidate evaluations sent to the oracle.
- propose_verify_retrain(proposal, oracle, *, k_per_round, rounds, keep_frac=0.25, seed=None)[source]
Sample, verify, keep, and refit under a fixed oracle-call budget.
Each round draws
k_per_roundcandidates fromproposal, verifies every one withoracle, keeps the topkeep_fracby oracle score, and refitsproposalon the kept winners weighted by score. The exact oracle-call budget isk_per_round * rounds.oracle=Noneraises immediately because this routine requires a verifiable objective rather than fabricating one.An abstained oracle result (
OracleResult.abstained) never wins a “kept” slot and never becomesbest_result: both are ranked/compared only among that round’s GENUINE candidates. A round in which every candidate abstains leavesproposalunchanged for that round rather than refitting on a fabricated all-abstained weight vector; every attempted candidate, abstained or not, still appears in that round’sRoundLog.