"""Run the frozen, registered marker-replication script on the 512-question panel, unchanged. uv run --no-project --with zstandard --with tokenizers python code/run_marker_replication.py \ path/to/Qwen3.5-9B/tokenizer.json [--with-readouts] The frozen script (markers/registration/recheck_markers_512_frozen_amend1.py, SHA-256 checked below) expects the experiment layout //.jsonl. This wrapper decompresses the two traces into a temporary folder with that layout and runs the script there. Without --with-readouts the scored forced readouts are left out, which reproduces the registered result exactly (the secondary analysis was not computed because the transplant arm's readouts had not arrived). With --with-readouts the secondary descriptive analysis is computed as well; the primary endpoints are the same either way. Writes outputs/MARKER_REPLICATION_RESULT*.json. """ from __future__ import annotations import hashlib import shutil import subprocess import sys import tempfile from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent)) from common import RECORDS, ROOT, _zstd_bytes # noqa: E402 FROZEN = ROOT / "markers/registration/recheck_markers_512_frozen_amend1.py" FROZEN_SHA256 = "3e423fdbdd799b1d41e7993bc07bb495621b58da0355c9f1a786059132017190" ARMS = {"replicate_baseline": "base", "replicate_full_mlp_forward": "base_mlp_all"} def main(): tokenizer = sys.argv[1] with_readouts = "--with-readouts" in sys.argv assert hashlib.sha256(FROZEN.read_bytes()).hexdigest() == FROZEN_SHA256, "frozen script changed" out = ROOT / "outputs" / ("MARKER_REPLICATION_RESULT_with_readouts.json" if with_readouts else "MARKER_REPLICATION_RESULT.json") out.parent.mkdir(exist_ok=True) with tempfile.TemporaryDirectory() as tmp: for run, stem in ARMS.items(): d = Path(tmp) / run d.mkdir() (d / f"{stem}.jsonl").write_bytes(_zstd_bytes(RECORDS / run / f"{stem}.jsonl.zst")) if with_readouts: src = RECORDS / run / f"readout_subset_{stem}" / "scored" dst = d / f"readout_subset_{stem}" / "scored" dst.mkdir(parents=True) for name in ("traces.scored.jsonl", "readouts.scored.jsonl"): shutil.copyfile(src / name, dst / name) subprocess.run([sys.executable, str(FROZEN), tmp, tokenizer, str(out)], check=True) print("wrote", out.relative_to(ROOT)) if __name__ == "__main__": main()