thefinalboss commited on
Commit
2bd6293
·
verified ·
1 Parent(s): 486bcf7

Upload docs/KURAMOTO_BOTTLENECK_AND_FIX.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. docs/KURAMOTO_BOTTLENECK_AND_FIX.md +82 -0
docs/KURAMOTO_BOTTLENECK_AND_FIX.md ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Kuramoto bottleneck and fix (next training)
2
+
3
+ **Updated:** 2026-08-20 04:47 UTC
4
+ **Status:** DIAGNOSED + PREP READY (apply on pod before resume)
5
+
6
+ ## What was measured
7
+
8
+ Agent probe (2026-08-19) on Kuramoto tensors (mmap, low RAM):
9
+
10
+ 1. **Degenerate circular mean** of the phase fan — atan2(0,0)-style collapse on a fresh model path.
11
+ 2. **Post-RK4 routing arc ~25° / 360°** — with 128 experts spaced ~2.8°, only a thin slice of the expert ring is reachable → structurally dead experts.
12
+ 3. **Order parameter r ≈ 0.0101** on fresh dynamics — same order as prod logs (0.01–0.03).
13
+ 4. **Not only probe no_grad** — soft dynamics / narrow omega band are in the oscillator setup itself.
14
+
15
+ Matches earlier mid-train observations: phases stuck, omega std ~0.02–0.03, high dead-expert rate on probe windows.
16
+
17
+ ## Will more tokens alone fix it?
18
+
19
+ **Unlikely as the sole plan.**
20
+
21
+ Finishing phase2 without opening the routing mostly trains the already-open expert subset. Dead experts stay dark.
22
+
23
+ Training helps **after** the route can move: wider omega, softer gates, real load-balance in the loss, Kuramoto not under no_grad in tick_chunk_train.
24
+
25
+ ## Fix recipe (next pod)
26
+
27
+ ### A. On checkpoint load (existing freeze weights)
28
+
29
+ ```bash
30
+ export GATE_TEMP=2.5
31
+ export OMEGA_SCALE=4.0
32
+ export OMEGA_NOISE=0.01
33
+ export OMEGA_CLAMP=0.5
34
+ export LB_COEF=0.05
35
+
36
+ python scripts/prep_kuramoto_fix_resume.py
37
+ # backups: checkpoints/fractus_1b_gpu{i}_pre_kuramoto_fix.pt
38
+ # writes: checkpoints/fractus_1b_gpu{i}.pt + KURAMOTO_FIX_APPLIED.json
39
+ ```
40
+
41
+ `fractus/kuramoto_fix.py` → `apply_kuramoto_routing_fix(engine)`:
42
+ - sets MoE temperature
43
+ - omega ← clamp(omega * scale + noise)
44
+
45
+ ### B. During train (must stay true)
46
+
47
+ | Requirement | Why |
48
+ |-------------|-----|
49
+ | loss = ce + LB_COEF * lb | LB not detached |
50
+ | Kuramoto in autograd path | omega can keep adapting |
51
+ | GATE_TEMP applied each load | runtime attr, not always in ckpt |
52
+ | START_TOKEN from FROZEN_RESUME_MANIFEST.json | do not restart phase2 at 0 |
53
+
54
+ ### C. New models only
55
+
56
+ KuramotoLayer default omega init widened: uniform(-0.35, 0.35) was (-0.05, 0.05).
57
+
58
+ ## Success checks (after fix + short smoke)
59
+
60
+ 1. omega.std() per block clearly above pre-fix (logged in KURAMOTO_FIX_APPLIED.json).
61
+ 2. Offline probe without resetting live phases: higher expert-usage entropy, fewer zero-load experts.
62
+ 3. Routing arc / phase diversity up vs ~25° regime.
63
+ 4. TF loss still trends down (fix must not destroy the freeze).
64
+
65
+ ## Relation to freeze
66
+
67
+ Freeze remains valid: ~15–17M tokens/GPU on phase2, weights on HF.
68
+ Fix = open-heart on load, then continue digestion. Not a full reinit.
69
+
70
+ ## Files
71
+
72
+ | Path | Role |
73
+ |------|------|
74
+ | docs/KURAMOTO_BOTTLENECK_AND_FIX.md | this note |
75
+ | fractus/kuramoto_fix.py | apply helper |
76
+ | scripts/prep_kuramoto_fix_resume.py | offline prep all GPU ckpts |
77
+ | fractus/nn/phase_ode.py | wider omega init for new builds |
78
+ | scripts/fast4gpu_surgery.py | historical mid-train surgery (same family) |
79
+
80
+ ## One line
81
+
82
+ Dead experts are a routing-arc problem; scale omega + soften gates + real LB, then finish the pass — do not wait for tokens alone.