Skip to content

Commit debf6c6

Browse files
author
Ronald Tse
committed
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.
1 parent f93ac41 commit debf6c6

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎src/gpu/modal_distill.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,10 +1187,21 @@ def der_ce(model) -> dict:
11871187
result["gate_pass"] = result["gate_delta"] <= 0.5
11881188
# durable verdict marker: the run dir is the provenance record (also
11891189
# what r7-style _init_choice probes read)
1190+
import hashlib
11901191
import json
11911192

11921193
out_root = Path(paths["out_root"])
11931194
out_root.mkdir(parents=True, exist_ok=True)
1195+
# label provenance, content-hashed: the mojibake forensics lesson
1196+
# (run-004 reproduced the retracted number on the same poisoned
1197+
# labels; identical numbers must mean identical data)
1198+
labels_src = out_root / spec.get("labels_file", "teacher_labels.jsonl")
1199+
if labels_src.exists():
1200+
result["labels"] = {
1201+
"file": labels_src.name,
1202+
"sha256": hashlib.sha256(labels_src.read_bytes()).hexdigest(),
1203+
"bytes": labels_src.stat().st_size,
1204+
}
11941205
(out_root / "final_eval.json").write_text(
11951206
json.dumps(result, indent=2), encoding="utf-8"
11961207
)

0 commit comments

Comments
 (0)