recall_guard.harness.runner
recall_guard.harness.runner
End-to-end run orchestrator for the honest-model-ranking harness.
This module drives the current build-only harness flow:
- resolve the shortlist (
--shortlistdirectly or--candidatesvia the smoke test) - enforce the cutoff guard before any model calls
- build the control baseline and per-model MCS classifier
- evaluate the shortlisted models on the eval set
- rank the results and write the run artifacts
The successful run writes records.jsonl, summary.csv, top3.md, and
manifest.json, then prints the artifact paths. When the run starts from
--candidates, it also writes shortlist.json.
Key behavior:
--shortlistskips the smoke test and does not writeshortlist.json.- The cutoff guard runs immediately after shortlist resolution and before any HTTP call to a candidate model.
- The manifest records input hashes, the seed, the resolved shortlist, the composite-score formula, MCS hyperparameters, the bootstrap count, and the artifact path map.
- Temperature-0 problems are surfaced through evaluator warnings rather than a runner-specific enforcement layer.
Pipeline summary:
- Load
.envand readNVIDIA_API_KEY. Missing key -> exit code2. - Load the eval set and cutoff registry. Missing eval-set file -> exit code
2. - Resolve the shortlist.
- Run
assert_cutoff_safe(eval_set, shortlist, cutoffs). AnyCutoffViolationaborts with exit code3. - Load the IS and OOS calibration corpora.
- Construct the optional reference-model LM via the injected
lm_factory. - For each shortlisted model, build the control baseline. If it is not
calibrated, append a stub
ModelEvalResultwith theuncalibratedwarning. Otherwise train the MCS classifier and evaluate the model on the eval set. - Compute the majority baseline, rank the models, and write the run artifacts.
- Render the terminal table and print the artifact-path summary.
run(args, *, lm_factory=...) accepts a factory (api_key, model, timeout_s) -> NvidiaLM
so tests can inject a fake LM that records calls and returns scripted CompletionResult
objects.
build_parser
build_parser()
Top-level CLI parser. Single build flow.
Source code in recall_guard/harness/runner.py
287 288 289 290 291 292 293 294 295 296 297 298 299 | |
parse_argv
parse_argv(argv)
Parse CLI arguments. build is the only mode now.
Accepts an optional leading build token for back-compat with
older scripts that wrote harness build --eval-set X; it gets
stripped before parsing.
Source code in recall_guard/harness/runner.py
302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
run
run(args, *, lm_factory=None)
Execute one harness run.
Returns:
| Type | Description |
|---|---|
int
|
Process exit code: |
Source code in recall_guard/harness/runner.py
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 | |