summaryrefslogtreecommitdiff
path: root/experiments/kp_innovation_full_development.py
diff options
context:
space:
mode:
authorYurenHao0426 <Blackhao0426@gmail.com>2026-07-22 14:48:02 -0500
committerYurenHao0426 <Blackhao0426@gmail.com>2026-07-22 14:48:02 -0500
commit0033594dab156894849a15d053e4a1aacf9da68f (patch)
tree6e8ac2dcce3e907268389a15627cd5e213b3b65d /experiments/kp_innovation_full_development.py
parenta4858a04acc5adca65a437295b63b426b6358831 (diff)
protocol: implement mixed-traffic full validation gate
Diffstat (limited to 'experiments/kp_innovation_full_development.py')
-rw-r--r--experiments/kp_innovation_full_development.py61
1 files changed, 61 insertions, 0 deletions
diff --git a/experiments/kp_innovation_full_development.py b/experiments/kp_innovation_full_development.py
new file mode 100644
index 0000000..882b759
--- /dev/null
+++ b/experiments/kp_innovation_full_development.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python3
+"""Run the three frozen MT-2 full mixed-traffic validation records."""
+import argparse
+import json
+import os
+import subprocess
+import sys
+
+
+RULES = ("raw", "matched", "innovation")
+
+
+def require_pass(path, protocol):
+ with open(path) as handle:
+ record = json.load(handle)
+ if record.get("protocol") != protocol or record.get("status") != "passed":
+ raise ValueError(f"{protocol} did not pass")
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ "--short_gate", default="results/kp_innovation_short_gate.json")
+ parser.add_argument("--kp_full_gate", default="results/kp_full_gate.json")
+ parser.add_argument("--rule", choices=("all",) + RULES, default="all")
+ parser.add_argument("--device", default="cuda")
+ parser.add_argument("--dry_run", action="store_true")
+ args = parser.parse_args()
+ require_pass(args.short_gate, "kp_mixed_traffic_short_v1")
+ require_pass(args.kp_full_gate, "kolen_pollack_full_v1")
+
+ rules = RULES if args.rule == "all" else (args.rule,)
+ os.makedirs("results/kp_innovation_full", exist_ok=True)
+ for rule in rules:
+ command = [
+ sys.executable, "experiments/conv_run.py",
+ "--mode", "kp_traffic", "--traffic_rule", rule,
+ "--device", args.device, "--depth", "20", "--width", "16",
+ "--seed", "0", "--loader_seed", "0", "--batch_size", "128",
+ "--epochs", "200", "--train_limit", "0",
+ "--val_examples", "5000", "--split_seed", "2027",
+ "--eval_split", "validation", "--eval_every", "0",
+ "--augment_train", "1", "--lr", "0.1", "--output_lr", "0.1",
+ "--lr_schedule", "step", "--lr_milestones", "100,150",
+ "--lr_gamma", "0.1", "--warmup_epochs", "0",
+ "--momentum", "0.9", "--weight_decay", "1e-4",
+ "--normalization", "batchnorm", "--a_scale", "1",
+ "--traffic_seed", "4000", "--traffic_ratio", "4",
+ "--traffic_calibration_examples", "64",
+ "--learn_P", "1", "--eta_P", "0.1",
+ "--predictor_warmup_steps", "20", "--predictor_every", "16",
+ "--alignment_probe", "32",
+ "--out", f"results/kp_innovation_full/{rule}.json",
+ ]
+ print(" ".join(command), flush=True)
+ if not args.dry_run:
+ subprocess.run(command, check=True)
+
+
+if __name__ == "__main__":
+ main()