summaryrefslogtreecommitdiff
path: root/ep_run/eig_traj.py
diff options
context:
space:
mode:
authorYuren Hao <yurenh2@illinois.edu>2026-07-04 22:35:16 -0500
committerYuren Hao <yurenh2@illinois.edu>2026-07-04 22:35:16 -0500
commitb11d9c6da6ce32471e1c25a6f1b5e7a0a568774d (patch)
treeec296d92ba99d51434c3ec716c21da41e96083d6 /ep_run/eig_traj.py
parent6e78420da6e613964d93da06156b556e1a91caef (diff)
magic-s2000 study: reg_delay/noadaptc flags, 4-arm queue v2, redx trajectory audit
- lt_ep_train: --reg_delay N (reg-free early phase: resreg/jr/floss/adaptc off for first N steps) + --noadaptc (kill hidden jacreg==0 damping feedback that would pollute single-reg ablation arms) - queue v2: 4 arms delay-first (abl_delay = reg-free 2k -> proven pair) - eig_traj/2/3: ARPACK audit of redx_traj — the run crossed the edge EARLY and oscillated (s1000 rotating-unstable, s1400 excursion mu=+2.1 self-recovered, s2000 the ONLY stable snapshot mu=-0.02, s2100/s2200 already back out) => s2000 is a post-excursion STABILITY-DIP capture, dip width <100 steps; learning survives mild instability (val fell through unstable stretches). lead_rho cold-40 under-reads clusters — NOT a classifier; ARPACK for audits. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FAPDWQ49M5Ye3NpTndTpn
Diffstat (limited to 'ep_run/eig_traj.py')
-rw-r--r--ep_run/eig_traj.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/ep_run/eig_traj.py b/ep_run/eig_traj.py
new file mode 100644
index 0000000..4cf14a3
--- /dev/null
+++ b/ep_run/eig_traj.py
@@ -0,0 +1,44 @@
+"""E1 of the magic-s2000 study: trajectory fingerprint over the redx every-100-step checkpoints.
+redx recipe = frozen jr 0.1, NO resreg (predates it) — it rode free, made the golden s2000 (val 3.13),
+and blew at step 3300 (CE 2.74 -> 41). Question: does rho(step) show a monotone approach to the edge,
+with s2000 sitting in a stable-but-critical sweet window before the ~s3200 crossing? That would make
+'edge operator' the mechanism of the magic warm start — and abl_delay the way to manufacture it.
+Per ckpt: rho/Re_mu of the forward map at the DEEP state (400-step relax; z_T1=150 readings are
+state-contaminated per eig_v2_depth), res at 150 (training protocol) and 400, val CE (nb=4).
+"""
+import torch
+from pathlib import Path
+import lt_ep_train as L
+from eig_control import lead_rho
+
+T1, DEEP, EPS, B, C = 150, 400, 0.1, 6, 1.0
+STEPS = list(range(600, 3700, 200))
+
+
+def load(path):
+ torch.manual_seed(0)
+ blk = L.EQBlock(512, 16, 256, 256, c=C, attn_mode='thick'); blk.qknorm = True
+ ck = torch.load(path, map_location=L.dev)
+ with torch.no_grad():
+ for p, w in zip(blk.allp, ck['allp']):
+ p.copy_(w.to(L.dev))
+ return blk
+
+
+print(f"{'ckpt':>6} {'rho@400':>9} {'Re_mu':>8} {'res@150':>9} {'res@400':>9} {'val':>8}", flush=True)
+for s in STEPS:
+ p = Path(f'runs/redx_traj/s{s}.pt')
+ if not p.exists():
+ print(f"s{s:<5} MISSING", flush=True); continue
+ blk = load(p)
+ torch.manual_seed(42) # SAME batch for every ckpt
+ idx, _ = L.get_batch('train', B, 256)
+ xin = blk.embed(idx).detach()
+ z150 = L.relax(blk, xin.clone(), xin, T1, EPS)
+ r150 = (L.relax(blk, z150, xin, 1, EPS) - z150).norm().item()
+ z400 = L.relax(blk, z150, xin, DEEP - T1, EPS)
+ r400 = (L.relax(blk, z400, xin, 1, EPS) - z400).norm().item()
+ _, rho, mu = lead_rho(blk, z400, EPS, C, {}, iters=40)
+ val = L.evaluate(blk, T1, EPS, nb=4)
+ print(f"s{s:<5} {rho:>9.5f} {mu:>+8.4f} {r150:>9.2e} {r400:>9.2e} {val:>8.4f}", flush=True)
+print("EIG_TRAJ_DONE", flush=True)