diff options
| author | YurenHao0426 <Blackhao0426@gmail.com> | 2026-08-06 12:12:41 -0500 |
|---|---|---|
| committer | YurenHao0426 <Blackhao0426@gmail.com> | 2026-08-06 12:12:41 -0500 |
| commit | d91cfe4d806f4c1e09c6cb75829a8625ff6506ec (patch) | |
| tree | a5cf10dddfbdd904877872e38c03b8e81dff0107 /experiments/contrastive_bias_smoke.py | |
| parent | 051414af6f3b7016ce8ee4125a41dfacf0a01a3e (diff) | |
experiment: add contrastive state-bias screen
Diffstat (limited to 'experiments/contrastive_bias_smoke.py')
| -rw-r--r-- | experiments/contrastive_bias_smoke.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/experiments/contrastive_bias_smoke.py b/experiments/contrastive_bias_smoke.py new file mode 100644 index 0000000..026eb01 --- /dev/null +++ b/experiments/contrastive_bias_smoke.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +"""Static smoke checks for the frozen B1 registry and author patch.""" +import json +from pathlib import Path +import sys + + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / "experiments")) +from contrastive_bias_b1 import BIAS_PATCH, bias_cells, jobs, registry_sha256 + + +def main(): + rows = jobs("/frozen/author/python") + cells = bias_cells() + assert len(rows) == len(cells) == 17 + assert sum(row["kind"] == "common" for row in rows) == 1 + assert sum(row["kind"] == "fixed" for row in rows) == 6 + assert sum(row["kind"] == "activity" for row in rows) == 9 + assert sum(row["rule"] == "innovation" for row in rows) == 5 + for row in rows: + command = row["command"] + assert command[0] == "/frozen/author/python" + assert command[command.index("--seeds") + 1] == "1988" + assert command[command.index("--test-policy") + 1] == "none" + assert command[command.index("--num-epochs") + 1] == "20" + assert command[command.index("--model") + 1] == "miniCNN" + if row["rule"] == "none": + assert "--dp-bias-rule" not in command + else: + assert command[command.index("--dp-bias-rule") + 1] == row["rule"] + patch = BIAS_PATCH.read_text(encoding="utf-8") + for token in ( + "create_dp_bias_auxiliary", "dp_bias_differences", + "train_dp_bias_epoch", "instruction_observations_for_predictor", + ): + assert token in patch + print(json.dumps({ + "status": "passed", "num_cells": len(rows), + "registry_sha256": registry_sha256(rows), + }, indent=2, sort_keys=True)) + + +if __name__ == "__main__": + main() |
