From debf6c66b4e1a4c95fb0309a991a4e9b87fd8f9c Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Sun, 30 Aug 2026 21:53:48 +0200 Subject: [PATCH] feat(distill): content-hash label provenance into final_eval.json The run-004 forensics lesson as enforced protocol: labels sha256 + bytes recorded with every verdict, so identical numbers must mean identical data. --- src/gpu/modal_distill.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gpu/modal_distill.py b/src/gpu/modal_distill.py index b611650..fd4ab46 100644 --- a/src/gpu/modal_distill.py +++ b/src/gpu/modal_distill.py @@ -1187,10 +1187,21 @@ def der_ce(model) -> dict: result["gate_pass"] = result["gate_delta"] <= 0.5 # durable verdict marker: the run dir is the provenance record (also # what r7-style _init_choice probes read) + import hashlib import json out_root = Path(paths["out_root"]) out_root.mkdir(parents=True, exist_ok=True) + # label provenance, content-hashed: the mojibake forensics lesson + # (run-004 reproduced the retracted number on the same poisoned + # labels; identical numbers must mean identical data) + labels_src = out_root / spec.get("labels_file", "teacher_labels.jsonl") + if labels_src.exists(): + result["labels"] = { + "file": labels_src.name, + "sha256": hashlib.sha256(labels_src.read_bytes()).hexdigest(), + "bytes": labels_src.stat().st_size, + } (out_root / "final_eval.json").write_text( json.dumps(result, indent=2), encoding="utf-8" )