Reference baselines¶
Unreleased
metria baseline and metria verify --baseline are on main and ship in
the next release after 0.1.7.
A paired verification runs the reference and the candidate together. When you check many candidates against the same reference, rerunning the reference every time is expensive. Reusing old evidence blindly is worse: if the workload, model, runtime, verifier or hardware changed, the comparison is invalid. A baseline is reference evidence you keep on purpose, with the identity and freshness needed to say when it can be reused.
flowchart LR
A[Completed verification] --> B[metria baseline capture]
B --> S[(Local store: one immutable directory per baseline ID)]
C[New recipe] --> K{metria baseline check}
S --> K
K -->|identical controls, fresh| R[Reuse for eligible metrics]
K -->|anything else| F[Fresh paired run, with reasons]
Capture¶
metria baseline capture \
--evidence verification \
--recipe study.json \
--store baselines \
--max-age-days 14
--evidence is a completed metria verify output directory, and --recipe is
the exact recipe that produced it; its digest must match the bundle. Capture
refuses a verification that is NOT_COMPARABLE, INSUFFICIENT_EVIDENCE or
EXECUTION_FAILED, a reference run that is incomplete or has evidence gaps, and
synthetic demo bundles.
The store gets one new directory named by the baseline ID. It holds the
original verification.json, both run records, report.md and the recipe,
byte for byte, plus receipt.json. The receipt records:
- the SHA-256 of every file and of the recipe;
- the reference run's ID and record and evidence digests;
- digests of the reference configuration, workload and task checks, capture environment and analyses;
- the verifier implementation and hardware fingerprint;
- the creation time, the expiry, and an optional performance reuse window.
The baseline ID is the SHA-256 of the receipt's canonical content, so editing any byte, including the expiry, is detected. A directory is published with a single rename, and a rename never replaces an existing directory, so a concurrent capture cannot overwrite retained evidence. Capturing the same evidence twice is refused. Baselines are local files: store them, like any verification output, where your run data is allowed to live, and delete expired ones under your own retention policy.
Validate and inspect¶
validate rechecks every file against the receipt, the bundle's own record
digests and the report, the recipe digest and the directory name. A missing,
extra, edited or renamed file fails closed. inspect prints the validated
receipt.
Check eligibility for a new recipe¶
The result is per metric family:
| Family | Eligible only when |
|---|---|
| Behavior, quality | The reference configuration (model, tokenizer pins, runtime, deployment and trust settings, generation settings, measurements, trial policy), workload and checks, capture environment, analyses and verifier implementation are all identical, the baseline is not synthetic, and it has not expired |
| Timing, memory | All of the above, plus a performance window set at capture with --performance-max-age-hours that has not elapsed, on hardware with an identical fingerprint |
Each ineligible family lists its reasons, such as workload or task checks
changed or baseline expired at …. Timing and memory are never reused unless
you choose a window at capture. The decision is reuse_reference when any
family is eligible (exit code 0) and fresh_paired_run otherwise (exit code
3); fresh_paired_run_required_for names the families that need a fresh
paired run. Invalid or tampered baselines exit 2. Add --json for a
metria.baseline_check.v1 result.
A baseline says only that its reference evidence was produced under these controls. Capturing one does not approve a candidate, and a candidate passing against it does not promote that candidate to a new baseline.
Verify against a baseline¶
When behavior and quality are eligible, the stored reference record replaces
the reference run; the candidate always runs fresh. The reused record keeps its
original verification provenance under provenance.baseline, and
verification.json gains a baseline section naming the baseline, its expiry,
the families reused and those that need a fresh paired run. The report says the
reference was reused.
If timing is not eligible, the cold-process performance comparison is withheld
as unavailable, and a policy with performance.*, serving.* or memory.*
criteria refuses the baseline, so a reused reference can never make a latency
criterion pass.
An ineligible baseline is an error (exit code 2) listing the reasons. Add
--fresh-if-ineligible to run a fresh paired verification instead; the
manifest then records that the baseline was not used and why. A tampered or
invalid baseline is always an error, even with that flag.
Reuse is not yet available for the isolated native vLLM profiles (prefix caching, serving, FP8 KV cache and parallelism); verify those with fresh paired runs. For endpoints, a reused reference describes the reference deployment as it was when the baseline was captured, including any collector evidence. Its expiry bounds how long you rely on that.