mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-12-05 10:34:23 +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>
50 lines
2.4 KiB
Python
50 lines
2.4 KiB
Python
"""CUDA matched-precision reasoning pilot of a saved fixture candidate.
|
|
|
|
The planted fixture establishes software contracts only (four fresh cells, the
|
|
declared CUDA precision realized, shared-prefix KL across devices, matrix
|
|
evidence), never pretrained behaviour. Pretrained and quantized checkpoints are
|
|
a separate opt-in campaign with stored receipts.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
import torch
|
|
|
|
from obliteratus.experiments.backend_matrix import support_matrix
|
|
from tests.test_backend_qualification import CPU32, selected # noqa: F401
|
|
from tests.test_persistent_candidates import env # noqa: F401
|
|
from tests.test_precision_reasoning import NATIVE_BF16, ReasoningIO, pilot
|
|
|
|
pytestmark = pytest.mark.gpu
|
|
|
|
|
|
@pytest.fixture(autouse=True, scope="module")
|
|
def require_cuda():
|
|
if not torch.cuda.is_available():
|
|
pytest.skip("requires a CUDA runner; set ENABLE_CUDA_GATE and attach the cuda label")
|
|
|
|
|
|
def test_cuda_float16_pilot_records_four_cells_and_kl(env, selected): # noqa: F811
|
|
half = {"backend": {**CPU32, "device": "cuda", "dtype": "float16"}, "weights": "float16",
|
|
"activations": "float16", "kv_cache": "float16", "quantizer": None,
|
|
"calibration": {"method": "none"}}
|
|
record = pilot(env, selected, io=ReasoningIO(), precision=half)
|
|
assert record["status"] == "measured", record["reason"]
|
|
declared = record["cells"]["declared/intervention"]
|
|
assert {c["check"]: c["passed"] for c in declared["checks"]}["realized_device"]
|
|
assert "peak_bytes" in record["host"]["declared/intervention"]
|
|
kl = record["analysis"]["shared_prefix_kl"]["intervention:declared_vs_reference"]
|
|
assert kl["positions"] > 0
|
|
run_dir, manifest = selected["adapter"]
|
|
rows = support_matrix(run_dir, candidate=manifest["id"])["reasoning"]
|
|
assert any(r["attempt"] == record["attempt"] and r["status"] == "measured" for r in rows)
|
|
|
|
|
|
def test_cuda_quantization_without_a_quantized_loader_is_unsupported(env, selected): # noqa: F811
|
|
nf4 = {**NATIVE_BF16, "backend": {**CPU32, "device": "cuda", "dtype": "bfloat16",
|
|
"quantization": "bnb-nf4"},
|
|
"weights": "nf4", "quantizer": {"name": "bitsandbytes", "version": "fixture"}}
|
|
record = pilot(env, selected, io=ReasoningIO(), precision=nf4)
|
|
assert record["status"] == "unsupported" and "provides no bnb-nf4 load" in record["reason"]
|