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.
- 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.
- 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.