3.2 KiB
Method execution contracts
Bayesian search
Scoring and final replay use the same BayesianTrialPlan: selected directions,
per-layer attention/MLP regularization, writer scope, and projection policy.
Every trial starts from the captured parent. Search rejects missing KL evidence
and trials above the configured KL budget. Final replay checks the selected plan
hash and records its evidence in checkpoint metadata.
The default executor supports resident generic writers and the output head.
Additional mutation modes require an executor that covers their complete write
scope. Unsupported combinations fail before capture. A pipeline can supply
_bayesian_executor_factory(pipeline) implementing BayesianExecution; resource
estimates and a stable identity are required before capture.
Set _bayesian_study_path to a directory for durable studies. Completed trials
have atomic JSON receipts and consistent SQLite backups. Resume requires the
same model/executor, prompts, options, seed, dependencies, and execution source.
_on_bayesian_trial(path) can publish the completed receipt and its named backup.
BayesianKernelOptimizer is a separate activation-only search. Its class
separation and reconstruction objectives are proxies, not measured refusal,
KL, or benchmark scores.
Refinement
Iterative passes refresh directions and expert state before selecting targets. Informed compensation snapshots that new target scope and preserves the parent recipe. A rejected or failed pass restores weights, metrics, and recipe together. Missing or nonfinite candidate measurements cannot accept a pass.
Architecture integrations can provide bounded snapshots and observe candidate transitions through the protected refinement hooks. Ordinary single-pass runs with the default observer do no additional snapshotting or tensor hashing. Informed-only analysis and sparse surgery require explicit workspace estimates; native export must use the bounded writer before claiming its admission bound.
Tournament execution
TourneyRunner accepts a paired arm_executor and winner_publisher, a stable
executor_identity, and a positive artifact_budget_bytes. The existing round
schedule remains unchanged. Selection prompts are disjoint from intervention
prompts. Required metrics must be finite and within the configured KL budget.
An arm returns metrics, a candidate hash, replay identity, and bounded artifact receipts. Checkpoints bind the experiment and artifact hashes. The publisher must replay the selected candidate and return a matching completion receipt. Publication failure retains the scored result and checkpoint for retry.
Executor failures raise TournamentExecutionError and save interrupted-round
progress before stopping. TournamentArmRejected excludes a completed,
unacceptable method without inventing a candidate. Missing measurements and
execution errors are failures, not quality rejections. Finite quality-limit
violations use PipelineQualityRejectedError. Informed compensation restores
and retains the accepted parent when a candidate raises this rejection.
These contracts do not establish full-model hardware capacity, throughput, or capability retention. Those require measurements on the target runtime.