mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-12-05 18:44:41 +01:00
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>
80 lines
4.9 KiB
Python
80 lines
4.9 KiB
Python
"""``obliteratus experiments qualify run|reasoning|matrix``."""
|
|
|
|
import json
|
|
|
|
|
|
def add_qualify(commands):
|
|
parser = commands.add_parser(
|
|
"qualify", help="Backend qualification: run a saved persistent candidate on a declared "
|
|
"backend against its CPU reference, and list the support matrix")
|
|
sub = parser.add_subparsers(dest="qualify_command", required=True)
|
|
run = sub.add_parser("run", help="Qualify one (saved candidate, backend) pair")
|
|
run.add_argument("candidate", help="Candidate id (sha256:...) that passed verification")
|
|
run.add_argument("--run", required=True, help="Run directory holding the candidate")
|
|
run.add_argument("--pack", required=True, help="Independent qualification dataset pack")
|
|
run.add_argument("--revision", required=True, help="Qualification dataset revision")
|
|
run.add_argument("--role", required=True, choices=("select", "calibrate", "test"))
|
|
run.add_argument("--allow-locked-test", action="store_true")
|
|
run.add_argument("--device", required=True, help="cpu or cuda[:N]")
|
|
run.add_argument("--dtype", required=True, help="float32, float16 or bfloat16")
|
|
run.add_argument("--cache", required=True, choices=("cached", "uncached"),
|
|
help="Generation cache mode")
|
|
run.add_argument("--quantization", default="none", help="none, bnb-int8 or bnb-nf4")
|
|
run.add_argument("--attention", default="default", help="Attention implementation")
|
|
run.add_argument("--tokenizer-sha256",
|
|
help="Expected tokenizer vocabulary digest (default: the parent's)")
|
|
run.add_argument("--logit-atol", type=float)
|
|
run.add_argument("--activation-atol", type=float)
|
|
run.add_argument("--target-rate-tolerance", type=float)
|
|
run.add_argument("--agreement", type=float)
|
|
run.add_argument("--actor", help="Who qualifies (default: the login name)")
|
|
pilot = sub.add_parser(
|
|
"reasoning", help="Opt-in matched-precision reasoning pilot: no-op parent and saved "
|
|
"candidate on the CPU float32 reference and one declared precision")
|
|
pilot.add_argument("protocol", help="Preregistered pilot protocol (JSON file)")
|
|
pilot.add_argument("--run", required=True, help="Run directory holding the candidate")
|
|
pilot.add_argument("--actor", help="Who runs the pilot (default: the login name)")
|
|
matrix = sub.add_parser("matrix", help="Support matrix of a run's stored qualifications")
|
|
matrix.add_argument("--run", required=True)
|
|
matrix.add_argument("--candidate", help="Only this candidate")
|
|
matrix.add_argument("--backend", action="append", default=[], type=json.loads,
|
|
help="Declared backend descriptor (JSON); listed untested when it "
|
|
"has no stored attempt. Repeatable.")
|
|
|
|
|
|
def run_qualify_command(args):
|
|
if args.qualify_command == "matrix":
|
|
from obliteratus.experiments.backend_matrix import support_matrix
|
|
return support_matrix(args.run, candidate=args.candidate, backends=args.backend)
|
|
from obliteratus.experiments.inputs import default_pack_resolver
|
|
if args.qualify_command == "reasoning":
|
|
from pathlib import Path
|
|
from obliteratus.experiments.precision_pilot import run_pilot
|
|
protocol = json.loads(Path(args.protocol).read_text(encoding="utf-8"))
|
|
record = run_pilot(args.run, protocol, pack_resolver=default_pack_resolver,
|
|
actor=args.actor)
|
|
return {k: record.get(k) for k in ("candidate", "declared_backend_id", "class",
|
|
"status", "reason", "attempt", "efficiency",
|
|
"evaluation_sha256", "location")} | {
|
|
"decision": (record.get("analysis") or {}).get("decision")}
|
|
from obliteratus.experiments.backend_qualify import qualify
|
|
backend = {"device": args.device, "dtype": args.dtype, "cache": args.cache,
|
|
"quantization": args.quantization, "attention": args.attention}
|
|
if args.tokenizer_sha256:
|
|
backend["tokenizer"] = args.tokenizer_sha256
|
|
overrides = {k: v for k, v in (("logit_atol", args.logit_atol),
|
|
("activation_atol", args.activation_atol),
|
|
("target_rate", args.target_rate_tolerance),
|
|
("agreement", args.agreement)) if v is not None}
|
|
dataset = {"pack": args.pack, "revision": args.revision, "role": args.role,
|
|
"allow_locked_test": args.allow_locked_test}
|
|
record = qualify(args.run, args.candidate, backend, dataset,
|
|
pack_resolver=default_pack_resolver, tolerances_override=overrides,
|
|
actor=args.actor)
|
|
return {k: record[k] for k in ("candidate", "backend", "backend_id", "class", "status",
|
|
"reason", "attempt", "comparison", "checks",
|
|
"evaluation_sha256", "location")}
|
|
|
|
|
|
__all__ = ["add_qualify", "run_qualify_command"]
|