Files
OBLITERATUS/docs/BACKEND_QUALIFICATION.md
Joseph MaglyandClaude Opus 5.5 458059e066 feat(experiments): backend qualification and support matrix
Start milestone 5 (F20): qualify each saved artifact on an explicit
backend against the CPU float32 reference of the same artifact, and
record exactly which pairs qualify.

- Only fully verified persistent candidates are accepted; each run
  loads the saved artifact fresh from disk on the reference and on the
  declared backend after checking digests.
- Backend descriptors make device, dtype, quantization, attention,
  tokenizer and cache mode explicit; their digest is the backend id, so
  native and quantized results are separate rows.
- Paired evaluation on independent rows checks realized settings,
  target rate, completion agreement, logit and site-activation drift and
  collateral endpoints. Latency and memory stay outside the digest.
- Unsupported combinations are recorded unsupported without loading or
  falling back; unavailable hardware is refused and leaves the pair
  untested. Failures are permanent and block broader claims.
- A versioned support matrix lists exactly the qualified pairs. CUDA
  tests run in the cuda-runtime conditional gate.
- `obliteratus experiments qualify run|matrix`.

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

114 lines
5.7 KiB
Markdown

# 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.
```bash
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"}'
```
```python
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. `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 1) has one
row per (candidate, backend id) with 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.
## 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.