callensxavier commited on
Commit
dd4ef8d
·
verified ·
1 Parent(s): 6c45a9c

Upload PHASE6_HETERO_POS.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. PHASE6_HETERO_POS.md +87 -0
PHASE6_HETERO_POS.md ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Phase 6 — heterogeneous positional bias: content–position balance ties, the temperature knob hurts
2
+
3
+ A final orthogonal probe (2026-06-23) closes the applied attention arc by testing
4
+ the *only* axis the earlier bake-offs had not: per-head **content↔position
5
+ balance**. The verdict re-confirms the Phase-5 selection — **learnable-ALiBi (one
6
+ learnable linear slope per head, nothing else) is the hypothesis to ship.**
7
+
8
+ ## Why this experiment
9
+
10
+ The GPU bake-off winner, learnable-ALiBi, learned per-head slopes spanning ~125×
11
+ (0.68 → 0.005), with the flattest heads going essentially NoPE-like. So its +8%
12
+ was never "a better distance curve" — it was the model **self-organizing into
13
+ sharp-local heads plus near-global content-only heads**. Every variant that added
14
+ more *distance shape* (Calabi–Yau curve, log-curvature, Fourier features) overfit
15
+ and lost at scale. The untried, orthogonal axis is to make that local↔global
16
+ mixture **explicit**: give each head a learnable content scale `c_h` so it can
17
+ choose how much weight the content score `q·k` carries relative to the positional
18
+ penalty `−a_h·d`:
19
+
20
+ ```
21
+ score_h(i,j) = c_h · (q_i · k_j)/√D − a_h · (i − j) [content_balance]
22
+ ```
23
+
24
+ **Hypothesis:** making the local↔NoPE mixture explicit (learnable slope `a_h`
25
+ *and* learnable content scale `c_h`) should modestly improve perplexity and — the
26
+ real prize — improve **length extrapolation**, without the overfit that killed
27
+ "more shape". A per-head softmax temperature `τ_h` was added as an extra-knob
28
+ ablation. **Pre-committed KILL:** if `content_balance` gives no extrapolation gain
29
+ over `alibi_learn`.
30
+
31
+ Schemes: `alibi_fixed` (baseline), `alibi_learn` (the bake-off winner / control),
32
+ `nope` (content-only sanity), `content_balance` (the hypothesis), `cb_softmax_temp`
33
+ (content_balance + per-head temperature).
34
+
35
+ ## GPU result (NVIDIA L4, 2026-06-23, full preset)
36
+
37
+ Trained from scratch on real WikiText-2 (`Salesforce/wikitext`, wikitext-2-raw-v1),
38
+ d_model 512 / 8 layers / 8 heads, ctx 512, 4000 steps, batch 24, γ-L2 1e-3, val
39
+ early-stop. **Primary metric: validation perplexity at 1×/2×/4×/8× the training
40
+ context (length extrapolation; lower is better).**
41
+
42
+ | mode | 1× (512) | 2× (1024) | 4× (2048) | 8× (4096) |
43
+ |---|---|---|---|---|
44
+ | `alibi_fixed` | 3.705 | 3.623 | 3.577 | 3.513 |
45
+ | **`alibi_learn`** (control / winner) | 3.651 | 3.559 | 3.500 | 3.429 |
46
+ | `nope` | 10.290 | 10.845 | 11.571 | 12.311 |
47
+ | **`content_balance`** (hypothesis) | 3.642 | 3.548 | **3.488** | **3.428** |
48
+ | `cb_softmax_temp` (+ temperature) | 3.732 | 3.659 | 3.599 | 3.548 |
49
+
50
+ `content_balance` vs `alibi_learn` @4×: **+0.35%** (and +0.17% @8×).
51
+
52
+ ## Verdict — KILL the extra knobs; learnable-ALiBi stands
53
+
54
+ 1. **`content_balance` ties `alibi_learn` within noise** (+0.35% @4×, +0.17% @8×).
55
+ The learnable content scales settled near 1.0 with a mild upward drift toward
56
+ the flatter/global heads (`c` ≈ 0.79 → 0.93 across the slope-ordered heads) —
57
+ the model *does* want global heads to lean a little more on content, but the
58
+ effect is marginal and does not clear a meaningful margin. **KILL per the
59
+ pre-committed criterion** (no extrapolation gain over `alibi_learn`).
60
+ 2. **The softmax-temperature knob *regresses*** — `cb_softmax_temp` is worse than
61
+ plain `alibi_learn` at every length (3.732 vs 3.651 @1×). This is the recurring
62
+ Phase-4/5 pattern once more: **extra parameters hurt at scale.** Notably the
63
+ *local* screen (d128/L3, 800 steps) had crowned `cb_softmax_temp` the best
64
+ scheme — another instance of a short, small screen rewarding the highest-capacity
65
+ variant that then loses when properly trained.
66
+ 3. **`nope` collapses and gets *worse* with length** (10.3 → 12.3), the expected
67
+ sanity check that the positional penalty is doing real work.
68
+
69
+ ## What this adds to the arc
70
+
71
+ Phase 6 was the last orthogonal axis left to try — not *more distance shape*
72
+ (Phases 4–5 closed that), but *content/position mixing*. It lands in the same
73
+ place: **adaptability beats added structure, but only up to the single learnable
74
+ slope.** Once each head can pick its own slope, an explicit content-balance knob is
75
+ redundant (the model already realizes the local↔global split through the slope
76
+ alone) and a temperature knob is actively harmful.
77
+
78
+ > **Selected hypothesis (final):** a **learnable per-head linear positional bias**
79
+ > (learnable-ALiBi) — one slope per head, no log-curvature, no Calabi–Yau sequence,
80
+ > no content scale, no temperature. It is the robust GPU-scale winner across every
81
+ > bake-off (Phases 4, 5, 6), passes the §5 gate at +8.1% over the best baseline,
82
+ > and extrapolates flat where learned-absolute positions collapse.
83
+
84
+ Artifacts: `4_ai_hardware_attention/cy_sieve_hetero_pos.py` (experiment),
85
+ `gpu_phase_runs/hetero_pos_gpu_20260623.json` + `.log` (GPU run),
86
+ `gpu_phase_runs/hetero_pos_local_20260623.json` (local screen). See also
87
+ `PHASE5_FINAL_BAKEOFF.md` and `CYSIEVE_JOURNEY.md`.