summaryrefslogtreecommitdiff
path: root/ep_run/probe_stepdisp.py
diff options
context:
space:
mode:
authorYuren Hao <yurenh2@illinois.edu>2026-07-28 13:20:34 -0500
committerYuren Hao <yurenh2@illinois.edu>2026-07-28 13:20:34 -0500
commit98d5ea09d1498f802f2ad06f5f67b385e228f063 (patch)
tree173821434b3d6707d319ae649e34d1f5bf83df5d /ep_run/probe_stepdisp.py
parent752e113d67e510c4152bb1f33301b1dc509322af (diff)
RESULT 66: head被节流到60%(位移微探针:全族1.00-1.02唯W_out 0.60) — 用户等价LR假说命中并定位到单矩阵; Adam岛m/√v节流,对centered/fp32/K8全不敏感=EP头读共享结构; --head_lr_mult实装; 电池2(headmix诊断+hlr1.67/2.5补偿)在飞
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FAPDWQ49M5Ye3NpTndTpn
Diffstat (limited to 'ep_run/probe_stepdisp.py')
-rw-r--r--ep_run/probe_stepdisp.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/ep_run/probe_stepdisp.py b/ep_run/probe_stepdisp.py
new file mode 100644
index 0000000..2d86867
--- /dev/null
+++ b/ep_run/probe_stepdisp.py
@@ -0,0 +1,24 @@
+"""Direct effective-step-size measurement (user hypothesis: high cos but shrunken equivalent
+LR -> slow learning masquerading as plateau). Load two ckpts of the same tag 600 steps apart
+(saved by the micro-runs), report per-family ||dW||/||W|| — the actual distance moved in
+weight space. Compare EP vs BP micro-runs from the same start."""
+import sys, torch
+a, b, label = sys.argv[1], sys.argv[2], sys.argv[3]
+ca, cb = (torch.load(p, map_location='cpu', weights_only=False) for p in (a, b))
+fams = {'tok': None, 'wout': None}
+out = {}
+ta, tb = ca['tok']['weight'].float(), cb['tok']['weight'].float()
+out['tok'] = float((tb-ta).norm()/ta.norm())
+wa, wb = ca['wout'].float(), cb['wout'].float()
+out['wout'] = float((wb-wa).norm()/wa.norm())
+Ba, Bb = ca['blocks'], cb['blocks']
+import re
+groups = {'attn_bot': [], 'attn_top': [], 'ffn_bot': [], 'ffn_top': []}
+for k in Ba:
+ m = re.match(r'(\d+)\.(attn|ff)\.', k)
+ if not m or Ba[k].dim() < 2: continue
+ l = int(m.group(1)); fam = ('attn' if m.group(2)=='attn' else 'ffn') + ('_bot' if l < 6 else '_top')
+ d = float((Bb[k].float()-Ba[k].float()).norm()/Ba[k].float().norm())
+ groups[fam].append(d)
+for k, v in groups.items(): out[k] = sum(v)/len(v)
+print(label + ': ' + ' '.join(f'{k} {v:.5f}' for k, v in out.items()))