Skip to content

Commit 5e477b7

Browse files
author
Muhammad Labeeb Aryan Bin Mohd Lokman
committed
Harden Fisher smoke prerequisite authentication
1 parent 5433473 commit 5e477b7

3 files changed

Lines changed: 368 additions & 25 deletions

File tree

research/EXPERIMENT_013_STATIC_RHT_Q468_PROTOCOL.md

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Experiment 013: static RHT-Q468 packed-native adoption protocol
22

3-
> **Status: fifth replacement-H0 candidate after a preserved pre-model,
4-
> pre-dataset-row Fisher-smoke failure exposed sealed-runtime mutation, a
5-
> missing calibration dependency, and an unresolved identity-capture runtime-
6-
> provenance gap; not yet re-preregistered.**
3+
> **Status: unbound fifth replacement-H0 candidate. Fisher-smoke prerequisite
4+
> semantics are being hardened, and capture-completion custody remains an open
5+
> blocker; not yet re-preregistered.**
76
>
87
> This replacement working copy becomes the next frozen Experiment 013
98
> preregistration only when its exact bytes and dependencies are committed in a
@@ -21,7 +20,7 @@
2120
2221
Protocol draft initiated: 2026-08-02
2322

24-
Current fifth replacement-H0 candidate amended: 2026-08-15
23+
Current fifth replacement-H0 candidate amended: 2026-08-23
2524

2625
Pre-resolution audit amendment: 2026-08-02. The amendment corrects a
2726
cache-exposed-span off-by-one, binds the Stage-A calibration chain by exact
@@ -941,6 +940,36 @@ content field remain byte-for-byte unchanged. This amendment repairs
941940
execution provenance and containment only. It is not a Fisher result, a
942941
quality result, an adoption result, or a breakthrough claim.
943942

943+
Eighteenth pre-H0 Fisher-smoke prerequisite authentication amendment:
944+
2026-08-23. A source-only mutation probe found that the full-calibration
945+
prerequisite verifier authenticated the smoke report's outer canonical hash and
946+
primary identity bindings but inspected the nested runtime and adapter records
947+
only shallowly. After recomputing the unkeyed canonical hash, a report with an
948+
empty GPU record, a non-float elapsed-time string, or an extra forged adapter
949+
field could still pass that gate. No protected receipt body, model payload,
950+
CUDA computation, calibration score, policy, stability value, or quality result
951+
was accessed to find the defect.
952+
953+
The runner now requires exact runtime, GPU, adapter, and model-loading-
954+
diagnostic field sets; canonical finite non-negative elapsed time; the frozen
955+
Torch 2.13.0+cu130 and CUDA 13.0 identities; typed GPU identity and consistent
956+
non-negative peak-memory counters; the exact reviewed adapter revision,
957+
backend, dtype, shapes, recurrent layers, model contract, full-materialization
958+
count, model-open status, empty loading diagnostics, the exact identity-bound
959+
capture and token-sequence hashes, and the exact Fisher-step count. Rehashed
960+
malformed receipts fail before canonical calibration materialization or model
961+
loading. Regression coverage includes the previously accepted mutations and
962+
additional type, counter, identity, and completion-state drifts.
963+
964+
This is semantic fail-closed validation, not proof that a local receipt is
965+
unforgeable. External signing or append-only anchoring remains outside this
966+
evaluator. A separate review also found that the identity-capture provenance
967+
receipt can be published before launcher postconditions and cleanup are final;
968+
that custody blocker remains open. Therefore no descendant containing only this
969+
amendment may be tagged as H0. The fifth replacement candidate remains unbound
970+
until capture completion is bound to successful launcher finalization and all
971+
focused, full, and CI tests pass.
972+
944973
## Question
945974

946975
Can a calibration-frozen, static Q4/Q6/Q8 recurrent-state layout satisfy the

scripts/run_static_q468_calibration.py

Lines changed: 217 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,40 @@
103103
OFFICIAL_DATASETS_DISTRIBUTION_VERSION: Final = "4.8.5"
104104
RUN_REPORT_KIND: Final = "recurquant_experiment013_calibration_run"
105105
RUN_REPORT_SCHEMA: Final = 2
106+
CANONICAL_ADAPTER_REVISION: Final = "experiment-013-qwen35-live-adapter-v2"
107+
CANONICAL_ADAPTER_KERNEL_BACKEND: Final = "transformers_pure_torch_gated_delta_rule"
108+
CANONICAL_ADAPTER_MODEL_DTYPE: Final = "bfloat16"
109+
CANONICAL_TORCH_DISTRIBUTION_VERSION: Final = "2.13.0+cu130"
110+
CANONICAL_TORCH_RUNTIME_VERSION: Final = "2.13.0+cu130"
111+
CANONICAL_CUDA_RUNTIME_VERSION: Final = "13.0"
112+
CANONICAL_ADAPTER_QUERY_SHAPE: Final = (1, 1, 16, 128)
113+
CANONICAL_ADAPTER_STATE_SHAPE: Final = (1, 16, 128, 128)
114+
CANONICAL_ADAPTER_RECURRENT_LAYER_INDICES: Final = (
115+
0,
116+
1,
117+
2,
118+
4,
119+
5,
120+
6,
121+
8,
122+
9,
123+
10,
124+
12,
125+
13,
126+
14,
127+
16,
128+
17,
129+
18,
130+
20,
131+
21,
132+
22,
133+
)
134+
CANONICAL_ADAPTER_LOADING_DIAGNOSTICS: Final = (
135+
"error_msgs",
136+
"mismatched_keys",
137+
"missing_keys",
138+
"unexpected_keys",
139+
)
106140

107141
QUERY_EMA_DECAY: Final = 2.0 ** (-1.0 / 32.0)
108142
QUERY_ENERGY_EPSILON: Final = 1.0e-6
@@ -326,6 +360,18 @@ def _nonnegative_int(value: object, *, context: str) -> int:
326360
return value
327361

328362

363+
def _canonical_nonnegative_float_hex(value: object, *, context: str) -> float:
364+
if not isinstance(value, str):
365+
raise ValueError(f"{context} must be a canonical hexadecimal float")
366+
try:
367+
parsed = float.fromhex(value)
368+
except (OverflowError, ValueError) as exc:
369+
raise ValueError(f"{context} must be a canonical hexadecimal float") from exc
370+
if not math.isfinite(parsed) or parsed < 0.0 or value.startswith("-") or parsed.hex() != value:
371+
raise ValueError(f"{context} must be finite, non-negative, and canonical")
372+
return parsed
373+
374+
329375
@dataclass(frozen=True, slots=True)
330376
class BootstrapIdentityBindings:
331377
repository_source_manifest_file_sha256: str
@@ -5506,6 +5552,40 @@ def _report_bytes(
55065552
return canonical_json_bytes(document)
55075553

55085554

5555+
def _frozen_token_sequence_manifest_sha256(
5556+
records: Sequence[Mapping[str, object]],
5557+
) -> str:
5558+
commitments: list[dict[str, object]] = []
5559+
for index, record in enumerate(records):
5560+
if not isinstance(record, Mapping):
5561+
raise ValueError(f"frozen calibration record {index} is not a mapping")
5562+
commitments.append(
5563+
{
5564+
"identity_record_sha256": _sha256(
5565+
record.get("identity_record_sha256"),
5566+
context=f"frozen calibration record {index} identity SHA-256",
5567+
),
5568+
"prompt_token_ids_sha256": _sha256(
5569+
record.get("prompt_token_ids_sha256"),
5570+
context=f"frozen calibration record {index} prompt-token SHA-256",
5571+
),
5572+
"sequence_length": _positive_int(
5573+
record.get("sequence_length"),
5574+
context=f"frozen calibration record {index} sequence length",
5575+
),
5576+
"sequence_token_ids_sha256": _sha256(
5577+
record.get("sequence_token_ids_sha256"),
5578+
context=f"frozen calibration record {index} sequence-token SHA-256",
5579+
),
5580+
"target_token_ids_sha256": _sha256(
5581+
record.get("target_token_ids_sha256"),
5582+
context=f"frozen calibration record {index} target-token SHA-256",
5583+
),
5584+
}
5585+
)
5586+
return sha256_bytes(canonical_json_bytes(commitments))
5587+
5588+
55095589
def _authenticate_fisher_h1_smoke_prerequisite_unchecked(
55105590
report_bytes: bytes,
55115591
complete_marker_bytes: bytes,
@@ -5660,19 +5740,147 @@ def _authenticate_fisher_h1_smoke_prerequisite_unchecked(
56605740
runtime = evidence["runtime"]
56615741
if not isinstance(runtime, Mapping):
56625742
raise CalibrationRunError("Fisher H=1 smoke runtime receipt is missing")
5743+
_exact_fields(
5744+
runtime,
5745+
{
5746+
"adapter",
5747+
"authenticated_distribution_count",
5748+
"authenticated_file_count",
5749+
"cuda_available",
5750+
"cuda_runtime",
5751+
"elapsed_seconds_hex",
5752+
"gpu",
5753+
"packages",
5754+
"platform",
5755+
"python",
5756+
"runtime_manifest_file_sha256",
5757+
"torch",
5758+
},
5759+
context="Fisher H=1 smoke runtime receipt",
5760+
)
5761+
expected_packages = dict(authenticated_runtime.distributions)
56635762
if (
5664-
runtime.get("runtime_manifest_file_sha256") != authenticated_runtime.manifest_file_sha256
5665-
or runtime.get("authenticated_distribution_count")
5666-
!= authenticated_runtime.distribution_count
5667-
or runtime.get("authenticated_file_count") != authenticated_runtime.file_count
5668-
or runtime.get("packages") != dict(authenticated_runtime.distributions)
5669-
or runtime.get("cuda_available") is not True
5670-
or not isinstance(runtime.get("gpu"), Mapping)
5763+
runtime["runtime_manifest_file_sha256"] != authenticated_runtime.manifest_file_sha256
5764+
or runtime["authenticated_distribution_count"] != authenticated_runtime.distribution_count
5765+
or type(runtime["authenticated_distribution_count"]) is not int
5766+
or runtime["authenticated_file_count"] != authenticated_runtime.file_count
5767+
or type(runtime["authenticated_file_count"]) is not int
5768+
or runtime["packages"] != expected_packages
5769+
or runtime["python"] != authenticated_runtime.python_version
5770+
or expected_packages.get("torch") != CANONICAL_TORCH_DISTRIBUTION_VERSION
5771+
or runtime["torch"] != CANONICAL_TORCH_RUNTIME_VERSION
5772+
or runtime["cuda_available"] is not True
5773+
or runtime["cuda_runtime"] != CANONICAL_CUDA_RUNTIME_VERSION
5774+
or not isinstance(runtime["platform"], str)
5775+
or not runtime["platform"]
56715776
):
56725777
raise CalibrationRunError("Fisher H=1 smoke runtime identity drifted")
5778+
_canonical_nonnegative_float_hex(
5779+
runtime["elapsed_seconds_hex"],
5780+
context="Fisher H=1 smoke elapsed seconds",
5781+
)
5782+
5783+
gpu = runtime["gpu"]
5784+
if not isinstance(gpu, Mapping):
5785+
raise CalibrationRunError("Fisher H=1 smoke GPU receipt is missing")
5786+
_exact_fields(
5787+
gpu,
5788+
{
5789+
"capability",
5790+
"device_index",
5791+
"name",
5792+
"peak_allocated_bytes",
5793+
"peak_reserved_bytes",
5794+
},
5795+
context="Fisher H=1 smoke GPU receipt",
5796+
)
5797+
device_index = _nonnegative_int(
5798+
gpu["device_index"],
5799+
context="Fisher H=1 smoke GPU device index",
5800+
)
5801+
capability = gpu["capability"]
5802+
if (
5803+
not isinstance(capability, list)
5804+
or len(capability) != 2
5805+
or type(capability[0]) is not int
5806+
or capability[0] <= 0
5807+
or type(capability[1]) is not int
5808+
or capability[1] < 0
5809+
or not isinstance(gpu["name"], str)
5810+
or not gpu["name"]
5811+
):
5812+
raise CalibrationRunError("Fisher H=1 smoke GPU identity drifted")
5813+
peak_allocated = _nonnegative_int(
5814+
gpu["peak_allocated_bytes"],
5815+
context="Fisher H=1 smoke GPU peak allocated bytes",
5816+
)
5817+
peak_reserved = _nonnegative_int(
5818+
gpu["peak_reserved_bytes"],
5819+
context="Fisher H=1 smoke GPU peak reserved bytes",
5820+
)
5821+
if peak_reserved < peak_allocated:
5822+
raise CalibrationRunError("Fisher H=1 smoke GPU peak counters are inconsistent")
5823+
56735824
adapter = runtime.get("adapter")
5674-
if not isinstance(adapter, Mapping) or adapter.get("fisher_step_count") != fisher_count:
5675-
raise CalibrationRunError("Fisher H=1 smoke adapter step receipt drifted")
5825+
if not isinstance(adapter, Mapping):
5826+
raise CalibrationRunError("Fisher H=1 smoke adapter receipt is missing")
5827+
_exact_fields(
5828+
adapter,
5829+
{
5830+
"adapter_revision",
5831+
"capture_input_sha256",
5832+
"device",
5833+
"fisher_step_count",
5834+
"kernel_backend",
5835+
"materialization_attempted",
5836+
"materialized_sequence_count",
5837+
"model_dtype",
5838+
"model_id",
5839+
"model_loaded",
5840+
"model_loading_diagnostic_counts",
5841+
"model_revision",
5842+
"query_shape",
5843+
"recurrent_layer_indices",
5844+
"state_shape",
5845+
"token_sequence_manifest_sha256",
5846+
"transformers_version",
5847+
},
5848+
context="Fisher H=1 smoke adapter receipt",
5849+
)
5850+
diagnostics = adapter["model_loading_diagnostic_counts"]
5851+
if not isinstance(diagnostics, Mapping):
5852+
raise CalibrationRunError("Fisher H=1 smoke model diagnostics are missing")
5853+
_exact_fields(
5854+
diagnostics,
5855+
set(CANONICAL_ADAPTER_LOADING_DIAGNOSTICS),
5856+
context="Fisher H=1 smoke model diagnostics",
5857+
)
5858+
if any(type(diagnostics[name]) is not int or diagnostics[name] != 0 for name in diagnostics):
5859+
raise CalibrationRunError("Fisher H=1 smoke model diagnostics are not empty")
5860+
expected_token_sequence_manifest_sha256 = _frozen_token_sequence_manifest_sha256(
5861+
identity.records
5862+
)
5863+
if (
5864+
adapter["adapter_revision"] != CANONICAL_ADAPTER_REVISION
5865+
or adapter["kernel_backend"] != CANONICAL_ADAPTER_KERNEL_BACKEND
5866+
or adapter["model_dtype"] != CANONICAL_ADAPTER_MODEL_DTYPE
5867+
or adapter["model_id"] != model_manifest.model_id
5868+
or adapter["model_revision"] != model_manifest.revision
5869+
or adapter["transformers_version"] != model_manifest.transformers_version
5870+
or adapter["device"] != f"cuda:{device_index}"
5871+
or adapter["fisher_step_count"] != fisher_count
5872+
or type(adapter["fisher_step_count"]) is not int
5873+
or adapter["materialization_attempted"] is not True
5874+
or adapter["materialized_sequence_count"] != len(identity.records)
5875+
or type(adapter["materialized_sequence_count"]) is not int
5876+
or adapter["model_loaded"] is not True
5877+
or adapter["query_shape"] != list(CANONICAL_ADAPTER_QUERY_SHAPE)
5878+
or adapter["recurrent_layer_indices"] != list(CANONICAL_ADAPTER_RECURRENT_LAYER_INDICES)
5879+
or adapter["state_shape"] != list(CANONICAL_ADAPTER_STATE_SHAPE)
5880+
or adapter["capture_input_sha256"] != identity.identity_input_manifest_sha256
5881+
or adapter["token_sequence_manifest_sha256"] != expected_token_sequence_manifest_sha256
5882+
):
5883+
raise CalibrationRunError("Fisher H=1 smoke adapter identity drifted")
56765884
return sha256_bytes(report_bytes)
56775885

56785886

0 commit comments

Comments
 (0)