diff options
| author | YurenHao0426 <Blackhao0426@gmail.com> | 2026-07-22 13:54:10 -0500 |
|---|---|---|
| committer | YurenHao0426 <Blackhao0426@gmail.com> | 2026-07-22 13:54:10 -0500 |
| commit | 6206483780d75ecff61c396b7f1bf7e23e5b1ca5 (patch) | |
| tree | f60019495941103fa77522d0937ee95b7eb1d858 /experiments/residual_mirror_short_screen.py | |
| parent | b2ccd3aa430ecb9c267c8797ccabb3a32838f027 (diff) | |
protocol: implement residual mirror short gate
Diffstat (limited to 'experiments/residual_mirror_short_screen.py')
| -rwxr-xr-x | experiments/residual_mirror_short_screen.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/experiments/residual_mirror_short_screen.py b/experiments/residual_mirror_short_screen.py new file mode 100755 index 0000000..99e503a --- /dev/null +++ b/experiments/residual_mirror_short_screen.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +"""Run the two frozen RRM-2 short ResNet-20 accuracy jobs.""" +import argparse +import json +import os +import subprocess +import sys + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument( + "--selection", default="results/residual_mirror_capture_gate.json") + parser.add_argument("--device", default="cuda") + parser.add_argument("--shard_index", type=int, default=0) + parser.add_argument("--num_shards", type=int, default=1) + parser.add_argument("--dry_run", action="store_true") + args = parser.parse_args() + if not 0 <= args.shard_index < args.num_shards: + raise ValueError("invalid shard index") + with open(args.selection) as handle: + selection = json.load(handle) + if selection.get("protocol") != "residual_response_mirror_capture_v1": + raise ValueError("unexpected residual-mirror capture protocol") + if selection.get("status") != "passed": + raise ValueError("RRM-1 did not pass") + mirror_eta = float(selection["selected_rrm"]["mirror_eta"]) + if mirror_eta != 0.1: + raise ValueError("RRM-1 selected an unexpected frozen rate") + + common = [ + sys.executable, "experiments/conv_run.py", "--mode", "rrm", + "--device", args.device, "--depth", "20", "--width", "16", + "--seed", "0", "--loader_seed", "0", "--batch_size", "128", + "--epochs", "20", "--train_limit", "10000", + "--val_examples", "5000", "--split_seed", "2027", + "--eval_split", "validation", "--eval_every", "0", + "--augment_train", "1", "--lr_schedule", "cosine", + "--warmup_epochs", "0", "--momentum", "0.9", + "--weight_decay", "1e-4", "--normalization", "batchnorm", + "--output_lr", "0.1", "--a_scale", "1", + "--alignment_probe", "32", "--mirror_warmup_steps", "20", + "--mirror_every", "16", "--mirror_batch_size", "1", + "--mirror_eta", str(mirror_eta), "--mirror_noise_std", "1", + "--mirror_seed", "3000", + ] + jobs = [] + for rate in (0.03, 0.1): + tag = f"rrm_lr{rate}" + jobs.append((tag, common + [ + "--lr", str(rate), + "--out", f"results/residual_mirror_short/{tag}.json", + ])) + os.makedirs("results/residual_mirror_short", exist_ok=True) + for index, (tag, command) in enumerate(jobs): + if index % args.num_shards != args.shard_index: + continue + print(tag, " ".join(command), flush=True) + if not args.dry_run: + subprocess.run(command, check=True) + + +if __name__ == "__main__": + main() |
