mixle.inference.select module¶
Verifier-based selection — the generic test-time-compute selector.
Pure orchestration over a user score function: score every candidate, return the best (the
largest score, or the smallest when lower_is_better). This is the “best-of-N” / verifier pattern
that test-time-compute stacks lean on — generate several candidates, score each with a verifier, keep
the winner — with no assumption about what a candidate is (a string, a model, a plan, a sample).
When heuristic_alpha is given, the result also carries a confident flag: whether the winner’s
lead over the runner-up clears a normal score-spread heuristic. This is a ranking diagnostic, not a
conformal or bootstrap coverage guarantee. The former conformal_alpha spelling remains as a
deprecated compatibility alias and produces the same explicitly heuristic result.
- class SelectionResult(best, best_index, scores, confident=None, margin=None, band=None, confidence_method=None, coverage_guarantee=False, _extras=<factory>)[source]
Bases:
objectResult of a
select_best()call.- Parameters:
- best
the winning candidate (the actual object, not its index).
- Type:
Any
- best_index
the position of the winner in the input
candidates.- Type:
- scores
per-candidate scores in input order (a numpy float array).
- Type:
- confident
whether the winner’s lead clears the optional score-spread heuristic —
Nonewhen neitherheuristic_alphanor its deprecated alias was supplied.- Type:
bool | None
- margin
the winner’s lead over the runner-up (in score units, always
>= 0);Nonewhen there is a single candidate.- Type:
float | None
- band
the heuristic band the margin was compared against —
Nonewhen no threshold was requested or there is a single candidate.- Type:
float | None
- confidence_method
the executed diagnostic,
"normal_score_spread_heuristic", orNone.- Type:
str | None
- coverage_guarantee
always
False; one verifier score per selected candidate cannot establish held-out conformal or bootstrap coverage.- Type:
- select_best(candidates, *, score, lower_is_better=False, conformal_alpha=None, heuristic_alpha=None)[source]
Score each candidate and return the best, the verifier-based test-time-compute selector.
- Parameters:
candidates (Any) – an iterable of candidate objects (anything
scoreaccepts).score (Callable[[Any], float]) – a verifier
score(candidate) -> float; the winner maximizes it (or minimizes it whenlower_is_better).lower_is_better (bool) – if
True, the winner is the candidate with the smallest score.conformal_alpha (float | None) – deprecated compatibility alias for
heuristic_alpha. It does not provide conformal coverage because candidate scores are neither held-out conformity scores nor exchangeable repeated measurements.heuristic_alpha (float | None) – optional normal score-spread threshold level in
(0, 1). When given,confidentis a heuristic ranking flag only;coverage_guaranteeremainsFalse. With exactly TWO candidates the heuristic is undefined – margin and spread are the same number up to sqrt(2), so the flag would be decided byalphaalone (never at 0.05, always at 0.20, whatever the scores) – andconfidentis returnedFalsewithconfidence_methodnaming the degeneracy.
- Returns:
A
SelectionResult. It is also subscriptable (result["best"]), so callers may treat it as a small dict with keysbest,best_index,scores,confident.- Raises:
ValueError – if
candidatesis empty, orconformal_alphais outside(0, 1).- Return type:
SelectionResult