Upload PHASE5_FINAL_BAKEOFF.md with huggingface_hub
Browse files- PHASE5_FINAL_BAKEOFF.md +85 -0
PHASE5_FINAL_BAKEOFF.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Phase 5 — final bake-off: learnable-ALiBi wins; exact QK needs an exact softmax
|
| 2 |
+
|
| 3 |
+
Two autoresearch experiments (2026-06-23) close the applied attention arc with
|
| 4 |
+
clear, partly humbling, answers.
|
| 5 |
+
|
| 6 |
+
## A. Positional-bias family bake-off — GPU head-to-head is decisive
|
| 7 |
+
|
| 8 |
+
We tested learnable bias families and, critically, re-ran the leading candidates
|
| 9 |
+
**at GPU scale** (4000 steps, 16M-char WikiText-2, d512/L8, val early-stop). The
|
| 10 |
+
GPU result **overturns the small-scale local screen**:
|
| 11 |
+
|
| 12 |
+
| scheme (GPU, ppl@512) | result | vs winner |
|
| 13 |
+
|---|---|---|
|
| 14 |
+
| **alibi\_learn** (learnable slope, *no* log term) | **3.617** | — winner |
|
| 15 |
+
| holo\_fixed (fixed CY shape) | 3.647 | −0.8% |
|
| 16 |
+
| nested\_free (slope + free log-curvature) | 3.662 | −1.3% |
|
| 17 |
+
| alibi (fixed slopes) | 3.697 | −2.2% |
|
| 18 |
+
| nested\_curv0 (slope + learnable log) | 3.718 | −2.8% |
|
| 19 |
+
| learned\_pos (learned absolute) | 4.859 | −34% |
|
| 20 |
+
|
| 21 |
+
Local 800-step screen (for contrast): fourier +7.1%, linlog/nested\_curv0 +6.9%,
|
| 22 |
+
alibi\_learn +3.8%, hybrid −29%. **The small-scale leads came from extra
|
| 23 |
+
parameters and do not survive scale** — at GPU scale the plainest scheme wins and
|
| 24 |
+
the log/curvature term *hurts*.
|
| 25 |
+
|
| 26 |
+
**Conclusions (now firmly established):**
|
| 27 |
+
1. **The winner is learnable-ALiBi: one learnable linear slope per head, no log
|
| 28 |
+
term, no sequence.** It matches the +8% PASS we reported and is the honest
|
| 29 |
+
final form.
|
| 30 |
+
2. **Extra expressiveness does not help at scale.** The log-curvature, the
|
| 31 |
+
Calabi–Yau shape, and Fourier features all either fail to beat, or lose to, a
|
| 32 |
+
single learnable slope once the model is properly trained. `nested_free`'s
|
| 33 |
+
learned curvature goes **strongly negative** (b ≈ −0.5…−0.85), i.e. the optimizer
|
| 34 |
+
actively pushes *away* from the positive CY curvature.
|
| 35 |
+
3. **`exp_decay` ≡ `alibi_learn` exactly** — confirming "exponential decay
|
| 36 |
+
$e^{-\lambda d}$" is just a learnable linear slope in additive log-space.
|
| 37 |
+
4. **`hybrid` (local window + tail) failed** as implemented (soft-gate degenerate);
|
| 38 |
+
not pursued.
|
| 39 |
+
|
| 40 |
+
> Net: *adaptability beats elegance* — exactly the S20 lesson, now quantified. The
|
| 41 |
+
> shippable scheme is learnable per-head ALiBi; everything fancier is removed.
|
| 42 |
+
|
| 43 |
+
## B. Exact-attention kernel — Rescaled-Integer wins; the softmax is the bottleneck
|
| 44 |
+
|
| 45 |
+
Numerical fidelity vs an FP64 reference (CPU proxy of a Triton kernel), max
|
| 46 |
+
relative error:
|
| 47 |
+
|
| 48 |
+
| scheme | L=128 | L=512 | L=2048 |
|
| 49 |
+
|---|---|---|---|
|
| 50 |
+
| fp32 | 1.8e-07 | 2.0e-07 | 3.1e-07 |
|
| 51 |
+
| **rescaled\_int** (exact INT64 $QK^\top$ + FP softmax) | 1.4e-05 | 1.5e-05 | **1.6e-05** |
|
| 52 |
+
| mixed (INT $QK$ + FP16 softmax) | 3.2e-04 | 2.4e-04 | 3.1e-04 |
|
| 53 |
+
| fp16 (baseline) | 2.9e-04 | 2.4e-04 | 5.3e-04 |
|
| 54 |
+
|
| 55 |
+
**Conclusions:**
|
| 56 |
+
1. **Rescaled-Integer is the accuracy winner — ~34× more exact than FP16** at
|
| 57 |
+
L=2048 (1.6e-05 vs 5.3e-04), and its error stays **flat in $L$** (integer
|
| 58 |
+
accumulation carries no rounding; only input quantization remains). FP16's error
|
| 59 |
+
grows with context — exactly where exactness matters.
|
| 60 |
+
2. **Mixed precision (★★★★★ on paper) under-delivers (~1.7× over FP16):** the
|
| 61 |
+
exact integer $QK^\top$ is wasted because the **FP16 softmax + FP16 $V$ matmul
|
| 62 |
+
re-introduce the error**. The bottleneck is the softmax, not the dot-product.
|
| 63 |
+
3. **Therefore the real near-term target is "exact $QK^\top$ + a higher-precision
|
| 64 |
+
(FP32) softmax,"** not INT-QK-plus-FP16-softmax. Pure INT64/INT128 end-to-end is
|
| 65 |
+
feasible for research but the softmax/exp is the hard part.
|
| 66 |
+
|
| 67 |
+
## Recommended retry — leverage both findings (and pivot off S20)
|
| 68 |
+
|
| 69 |
+
A single combined experiment that benchmarks the *winners*, with the same
|
| 70 |
+
train-from-scratch §5 protocol used for S20:
|
| 71 |
+
|
| 72 |
+
- **Bias:** ship and benchmark **learnable-ALiBi** (the winner) as the default;
|
| 73 |
+
keep `nested_free` only as an attribution control. Drop CY/log/Fourier/hybrid.
|
| 74 |
+
- **Kernel:** implement **rescaled-INT $QK^\top$ + FP32 softmax** in Triton and
|
| 75 |
+
measure quality (does exactness change perplexity?) and latency vs FP16 SDPA.
|
| 76 |
+
- **Sequence pivot:** the holonomic sequence is no longer in the bias at all, so
|
| 77 |
+
S20's role here is finished. If a future variant wants a *fixed* shape, prefer a
|
| 78 |
+
**slower-growing, lower-order member** (e.g. the (3,1)/(2,1) Apéry-like siblings
|
| 79 |
+
with proven modularity) — but the evidence says a learnable slope makes the
|
| 80 |
+
choice moot.
|
| 81 |
+
|
| 82 |
+
> The headline of the whole applied arc: a learnable per-head linear positional
|
| 83 |
+
> bias (a known-good idea) is the robust winner; exact integer $QK^\top$ is a real
|
| 84 |
+
> accuracy lever bottlenecked by the softmax. Neither result needs the Calabi–Yau
|
| 85 |
+
> sequence — its value was as the inspiration that led us to run the experiments.
|