Files
OBLITERATUS/docs/BACKEND_QUALIFICATION.md
Joseph MaglyandClaude Opus 5.5 6c2f79672f feat(experiments): matched-precision reasoning controls for backend qualification
Extend backend qualification so precision-induced changes in reasoning
outcomes are separated from intervention effects (#512).

- Precision declarations record weight, activation and KV-cache
  precision, quantizer and calibration identity; incomplete or
  inconsistent declarations are refused.
- A bounded, preregistered pilot protocol fixes candidate, dataset,
  decoding, output budget, seed blocks, final-answer parser, margins,
  drift limit, resource objective and disjoint splits.
- The pilot loads four fresh cells on the same rows: the unedited parent
  and the saved candidate at the CPU float32 reference and at the
  declared precision.
- Per-row outcomes separate final-answer correctness from reasoning and
  total tokens and termination; truncated or unparsable outputs count
  as wrong.
- Paired bootstraps give precision effects within each artifact,
  intervention effects within each precision and their interaction.
  Gates apply per task and pooled, and expose harm hidden by a pooled
  pass. Shared-prefix KL is reported apart from free-running
  disagreement.
- Token cost never gates; an efficiency claim needs every gate to pass
  and the preregistered resource to improve.
- Support matrix schema 2 carries precision fields and pilot attempts;
  pilots never add qualified pairs, and schema 1 records still load.
- `obliteratus experiments qualify reasoning`; CUDA path in the
  conditional gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 22:03:40 -05:00

13 KiB

Backend qualification

Backend qualification measures one saved deployment artifact on one declared backend. The artifact is a persistent candidate whose every reload verification passed (see docs/PERSISTENT_CANDIDATES.md), named by its manifest id. A support claim covers exactly the (artifact, backend) pairs that qualified.

obliteratus experiments qualify run sha256:<candidate> --run ./observations/<digest> \
    --pack ./packs/qualification --revision sha256:<revision> --role select \
    --device cuda:0 --dtype float16 --cache cached
obliteratus experiments qualify matrix --run ./observations/<digest> \
    --backend '{"device": "cuda", "dtype": "bfloat16", "cache": "cached"}'
from obliteratus.experiments.backend_qualify import qualify
from obliteratus.experiments.backend_matrix import support_matrix

record = qualify(run, candidate, {"device": "cuda:0", "dtype": "float16", "cache": "cached"},
                 {"pack": "packs/qualification", "revision": revision, "role": "select"})
matrix = support_matrix(run, backends=[{"device": "cpu", "dtype": "bfloat16",
                                        "cache": "uncached"}])

Backend descriptor

Field Values Default
device cpu, cuda[:N] required
dtype float32, float16, bfloat16 required
cache cached, uncached (generation use_cache) required
quantization none, bnb-int8, bnb-nf4 none
attention default, or an implementation the loader provides (eager, sdpa) default
tokenizer the tokenizer stored with the artifact and its vocabulary digest the parent's digest

The backend id is the SHA-256 of the canonical descriptor: two backends that differ in any field are separate rows. Native (quantization: none) and quantized backends are therefore never merged.

What a run does

  1. Refuses a candidate that is not selected, a descriptor missing a required field, unknown tolerances, and rows that overlap discovery or any registered confirmation set.
  2. Records unsupported without loading anything when the combination cannot run: an unknown device type, dtype, cache mode or quantization format, a bitsandbytes format off CUDA or on a loader without a quantized load, LoRA on a quantized base, an attention implementation the loader does not provide, or a model whose cache mode cannot be enforced. Nothing is replaced by another device, dtype or format.
  3. Refuses with nothing recorded when this host lacks the device or package (the pair stays untested).
  4. Records failed without loading when the artifact files no longer match the manifest.
  5. Otherwise loads the saved artifact from disk twice into fresh objects, on the CPU float32 reference backend (cached, default attention) and on the declared backend: the edited copy for a weight edit, or the parent (whose file digests are re-checked) with the saved adapter attached. Both run the frozen recipe's tasks with greedy decoding on the same rows.

The backend side qualifies when every check passes against the reference side:

  • realized_device, realized_dtype (or realized_quantization), realized_attention: the loaded model runs the declared settings;
  • tokenizer_identity: both loaded tokenizers have the declared vocabulary digest;
  • target_effect_parity: target success rates within target_rate;
  • completion_agreement: at least agreement of completions are equal;
  • probe_logits, probe_activations: final-token logits and the edited site's final-token output for the recipe's probe prompts within logit_atol and activation_atol;
  • collateral_endpoints: every collateral task and the target's invalid-output endpoint are PASS at the dossier's collateral margin.

Tolerances default to the candidate's declared tolerances (activation_atol defaults to logit_atol); overrides are recorded with the result.

Evaluation bundle

Each attempt is written once to <run>/backend-qualification/<candidate>/<backend>/NNNN/: qualification.json plus the generations of both sides under reference/ and backend/. The record holds the descriptor, the reference descriptor, the dataset and independence basis, what was loaded (artifact and parent digests), the comparison, the paired scorecard, every check and the status. Record schema 2 adds precision: the descriptor's weight, activation and KV-cache precision, quantizer and calibration identity. Schema 1 records stay readable (their matrix rows carry precision: null); they are not rewritten. evaluation_sha256 covers all of it except host (load and generation seconds, row count, peak process RSS or peak CUDA memory, platform), provenance and the attempt number.

Support matrix

support_matrix (schema obliteratus.backend-support-matrix, version 2) has one row per (candidate, backend id), with its precision components, and status:

  • qualified: every stored attempt qualified;
  • failed: any attempt failed, a stored record no longer reproduces its evaluation_sha256, or the artifact changed afterwards; a later passing attempt does not clear a failure;
  • unsupported: the latest attempt was an unsupported combination;
  • untested: a declared backend without an attempt.

Rows carry evidence references (path, attempt, status, digest). qualified_pairs lists exactly the qualified rows, also split into claim.native and claim.quantized; claim.blocked lists each artifact's failed backends, which rule out any claim beyond its qualified pairs.

Version 2 also lists matched-precision pilot attempts under reasoning (below); they never add a qualified pair.

Matched-precision reasoning pilot

Reduced-precision inference can change reasoning outcomes without changing parity checks: a model may generate more tokens and still return a wrong final answer. The pilot separates precision effects from intervention effects for one selected candidate (which pins checkpoint, tokenizer and edit) and exactly one declared precision. It is opt-in and bounded (at most 512 examples per task, 8 seed blocks and 8192 new tokens):

obliteratus experiments qualify reasoning pilot.json --run ./observations/<digest>
{"candidate": "sha256:<candidate>",
 "dataset": {"pack": "packs/reasoning", "revision": "sha256:<r>", "role": "test",
             "allow_locked_test": true},
 "precision": {"backend": {"device": "cuda:0", "dtype": "bfloat16", "cache": "cached",
                           "quantization": "bnb-nf4"},
               "weights": "nf4", "activations": "bfloat16", "kv_cache": "bfloat16",
               "quantizer": {"name": "bitsandbytes", "version": "<installed version>"},
               "calibration": {"method": "none"}},
 "decoding": {"strategy": "greedy", "max_new_tokens": 2048}, "seed_blocks": [0],
 "max_examples": 200, "parser": {"id": "last-number", "version": 1},
 "preregistration": {"accuracy_margin": {"<task>": 0.01}, "drift_limit": 0.1,
                     "resource_objective": "latency",
                     "bootstrap": {"samples": 2000, "seed": 0, "confidence": 0.95},
                     "splits": {"calibration": null, "selection": {"...": "..."},
                                "test": {"...": "same as dataset"}}}}
  • Precision components are all required and must agree with the descriptor (a native backend runs its dtype everywhere with no quantizer or calibration; bitsandbytes stores int8/nf4 weights and is calibration-free). Calibrated methods declare method, data_id, rows_sha256, sequence_length, samples and seed. Formats without a loader (GPTQ, AWQ, GGUF, ...) are recorded unsupported without loading anything; naming a format never qualifies it. An unavailable host records nothing.
  • Cells. Four fresh loads from disk on the same rows, prompts, decoding, budget, seed blocks and parser: {CPU float32 reference, declared} x {no-op (the unedited parent), intervention (the saved candidate)}. The CPU-reference parity gate (qualify run) stays a separate check.
  • Endpoints per row: final answer (from a versioned parser: last-word, answer-marker or last-number) and its correctness against the same reference answers in every cell; reasoning and total generated tokens; termination (eos, budget, other). A truncated output (budget reached) or an unparsable one is incorrect; a correct string before the final answer is counted as intermediate_correct, diagnostically only.
  • Effects are paired over independent examples (seed blocks averaged within an example; percentile bootstrap with the preregistered seed): precision:<arm> (within artifact), intervention:<precision> (within precision) and their interaction. Per-seed-block estimates are labelled a sensitivity statistic, not a confidence interval; repeated hyperparameter settings are not seeds. Correct-to-wrong and wrong-to-correct transitions are counted separately.
  • Gates, per task and pooled, with the preregistered margins: a precision effect passes when its lower bound is >= -margin, fails when its upper bound is < -margin; the interaction passes inside +-margin; free-running final-answer disagreement of each declared cell against its reference counterpart must stay within drift_limit. The decision is PASS only when every per-task gate passes; harmful_cells, worst_cell and pooled_hides_harm make a pooled gain that hides a task failure visible. A cell that fails to load or run is kept as evidence and the decision is INCOMPLETE.
  • Drift diagnostics are separate: shared-prefix KL(reference || declared) on the reference model's own tokens (float64 log-softmax; zero reference probability contributes nothing; zero declared probability under positive reference probability is an infinite position, counted and excluded from the mean) versus free-running exact-output and final-answer disagreement.
  • Cost is reported, not gated: token counts, truncation and failed-output rates per cell; load/generation seconds and peak memory in host (outside the digest). efficiency.claim is true only when the decision is PASS and the preregistered resource objective improved. Shorter output alone is neither an efficiency nor an accuracy pass.

Each attempt is written once to <run>/backend-qualification/<candidate>/reasoning/NNNN/reasoning.json (schema obliteratus.matched-precision-reasoning, version 1) with the protocol and its digest, both precision declarations, the dataset and independence basis, every cell's rows and raw completions, the analysis and the status (measured, incomplete, failed, unsupported). evaluation_sha256 excludes host, efficiency, provenance and the attempt number. The matrix reasoning list shows each attempt with per-cell statuses (untested when unsupported), the decision and whether the record still reproduces its digest. Pilot records are not collected as regression-library cases.

Preregistration and result dossier

Before opening test outcomes, fix and record: per-task accuracy non-inferiority margins (one percentage point is a reasonable starting margin), the drift limit, the resource objective, the bootstrap settings, and three disjoint partitions: quantizer calibration data, any selection or tuning data, and the final test rows (the evaluated dataset must equal the declared test split). A result dossier lists the protocol digest, checkpoint and tokenizer digests, quantizer version and calibration identity, every attempt (including failed, incomplete and unsupported ones), per-task and worst-cell outcomes and the resource measurements with their host. Default decoding has no hesitation-token or other logit penalty, and the protocol refuses unknown decoding fields. An experimental penalty arm would need its own tokenizer mapping, calibration and checks that corrective reasoning survives, and is not implemented. The motivating study (Quantized reasoning and overthinking, arXiv:2606.00206) reports model- and method-specific length changes under selected settings; this pilot reproduces none of its numbers, and training-time precision effects are a separate question.

Pull-request CI runs the pilot on planted CPU fixtures (float32 vs bfloat16); the CUDA fixture test runs in the conditional CUDA gate. Pretrained, quantized or GPU pilots are explicit opt-in campaigns whose stored records are the receipts.

Limits

Only cpu and cuda devices and bitsandbytes formats are supported; GGUF, GPTQ, AWQ and other formats are unsupported. The bitsandbytes path requires the transformers loader and a CUDA device. Cached-versus-uncached trace parity is a separate check (docs/TEMPORAL_TRACES.md); here the cache mode is a backend setting compared against the reference execution. Pull-request CI covers the CPU paths; the CUDA tests run in the conditional CUDA gate.