Upload PHASE3_CYSIEVE_GPU_FINDINGS.md with huggingface_hub
Browse files- PHASE3_CYSIEVE_GPU_FINDINGS.md +128 -0
PHASE3_CYSIEVE_GPU_FINDINGS.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CY-Sieve GPU-Phase Findings (2026-06-22, COMPLETE)
|
| 2 |
+
|
| 3 |
+
**Status: complete. The quality gate returned a NEGATIVE result (KILL).** On real
|
| 4 |
+
WikiText-2, trained from scratch, CY-Sieve's positional bias is **+10.15% worse**
|
| 5 |
+
than the best baseline at the training context — past the >5% kill threshold. The
|
| 6 |
+
kernel is *correct* (§4 PASS) and its memory claim is *confirmed* (§6, 8192× less
|
| 7 |
+
bias HBM), but the **positional scheme fails its quality gate and is reported as a
|
| 8 |
+
negative result, not shipped** — exactly as `tests.md` requires. Raw artifacts:
|
| 9 |
+
`4_ai_hardware_attention/gpu_phase_runs/run3_20260622_*`.
|
| 10 |
+
|
| 11 |
+
Hardware: NVIDIA L4 (24 GB), PyTorch 2.9.1+cu129, Triton 3.5.1, project SocrateAI.
|
| 12 |
+
Driver: `run_gpu_phase.py` → `tests.md` §4 (parity) / §5 (quality) / §6 (perf).
|
| 13 |
+
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
## §4 — Kernel correctness: **PASS** (final)
|
| 17 |
+
|
| 18 |
+
The Triton CY-Sieve kernel (`cy_sieve_triton.py`) reproduces the CPU reference
|
| 19 |
+
(`cy_sieve_attention.flash_sdpa_with_bias`, itself ~3e-16 from dense softmax) to
|
| 20 |
+
within FP16 tolerance (rel-err < 2⁻⁸): **4/4 tests passed** across
|
| 21 |
+
(L, D, τ) ∈ {(128,64,20), (256,64,128), (256,128,480)} + a smoke test.
|
| 22 |
+
|
| 23 |
+
**Reading.** The fused GPU path — online-softmax with the per-distance bias
|
| 24 |
+
(Tier-1 exact INT64 table + Tier-3 log penalty) generated *inside* the kernel —
|
| 25 |
+
computes the same attention as the dense reference. The on-the-fly bias is
|
| 26 |
+
implemented correctly; downstream measurements test the design, not a bug.
|
| 27 |
+
(`block_n=32`, `num_stages=1` keep SMEM under the L4's ~100 KB.)
|
| 28 |
+
|
| 29 |
+
## §6 — Performance: **core memory claim holds; latency claim does not** (final)
|
| 30 |
+
|
| 31 |
+
L4, D=64, fp16, τ=128, causal (run 1 measured 1K–16K before an OOM at 32768²,
|
| 32 |
+
now guarded):
|
| 33 |
+
|
| 34 |
+
| L | CY-Sieve (ms) | dense SDPA (ms) | table-bias SDPA (ms) | bias-HBM reduction |
|
| 35 |
+
|---|---|---|---|---|
|
| 36 |
+
| 1024 | 0.055 | 0.054 | 0.060 | 512× |
|
| 37 |
+
| 2048 | 0.105 | 0.053 | 0.116 | 1024× |
|
| 38 |
+
| 4096 | 0.260 | 0.060 | 0.268 | 2048× |
|
| 39 |
+
| 8192 | 1.084 | 0.288 | 0.805 | 4096× |
|
| 40 |
+
| 16384 | 4.156 | 1.016 | 3.938 | **8192×** |
|
| 41 |
+
| 32768 | 15.28 | 2.51 | (skipped: >VRAM) | 16384× |
|
| 42 |
+
|
| 43 |
+
(run-3 numbers; the materialized-table baseline is skipped at 32768 because its
|
| 44 |
+
[L,L] tensor exceeds the VRAM budget — itself a demonstration of the O(L²) wall
|
| 45 |
+
that CY-Sieve's O(L) bias avoids.)
|
| 46 |
+
|
| 47 |
+
- ✅ **Bias-path HBM — the central thesis — confirmed and measured.** CY-Sieve's
|
| 48 |
+
positional bias reads **O(L)** bytes (a length-L vector from the recurrence) vs
|
| 49 |
+
**O(L²)** for a materialized bias table: **8192× less at L=16384** (64 KB vs
|
| 50 |
+
512 MB), and the gap *widens* with context length.
|
| 51 |
+
- ❌ **Not yet a wall-clock win.** The current (unfused) Triton kernel is ~4× *slower*
|
| 52 |
+
than fused dense SDPA at 16K (4.16 vs 1.02 ms) and ~6× at 32K (15.3 vs 2.5 ms),
|
| 53 |
+
only matching the table-bias SDPA. The HBM saving is real but not yet *converted*
|
| 54 |
+
into latency — cuDNN's SDPA is far more tuned. Reported as-is per the `tests.md`
|
| 55 |
+
T6.3 honesty guard; speed is never presented without this caveat.
|
| 56 |
+
- **Moot given §5:** with §5 = KILL, T6.3 forbids presenting these speed/HBM numbers
|
| 57 |
+
as a contribution at all. They are recorded as engineering measurements only.
|
| 58 |
+
|
| 59 |
+
**Net:** the win is **memory traffic at long context**, not raw speed. The case is
|
| 60 |
+
for bandwidth-bound / very-long-context regimes; turning the HBM saving into time
|
| 61 |
+
requires fusing the bias deeper into the FlashAttention loop.
|
| 62 |
+
|
| 63 |
+
## §5 — Quality gate: **KILL (negative result)** (final, real WikiText-2)
|
| 64 |
+
|
| 65 |
+
The decisive test, done the only honest way — **train small GPTs from scratch**,
|
| 66 |
+
identical arch/data/compute, one per scheme — on real WikiText-2
|
| 67 |
+
(`Salesforce/wikitext`), byte-level. Validation perplexity at the training context
|
| 68 |
+
(512) and at 2×/4× extrapolation:
|
| 69 |
+
|
| 70 |
+
| scheme | @512 (train) | @1024 (2×) | @2048 (4×) |
|
| 71 |
+
|---|---|---|---|
|
| 72 |
+
| **learned-absolute** | **4.22** | 12.10 | 20.82 |
|
| 73 |
+
| ALiBi | 10.74 | 11.73 | 11.35 |
|
| 74 |
+
| **sliding-window** | **4.99** | **5.07** | **5.03** |
|
| 75 |
+
| CY-Sieve τ-ladder | 11.33 | 12.31 | 12.05 |
|
| 76 |
+
| CY-Sieve τ=20 | 16.02 | 16.81 | 16.49 |
|
| 77 |
+
| CY-Sieve τ=128 | 6.80 | 7.12 | 7.00 |
|
| 78 |
+
| CY-Sieve τ=512 | 4.65 | 6.08 | 10.62 |
|
| 79 |
+
|
| 80 |
+
**Verdict: KILL.** Best baseline (learned-absolute) = 4.22; best CY-Sieve (τ=512) =
|
| 81 |
+
4.65 → **+10.15%**, well past the >5% kill threshold. CY-Sieve as designed does not
|
| 82 |
+
meet the quality bar.
|
| 83 |
+
|
| 84 |
+
**Honest reading:**
|
| 85 |
+
- **The "great extrapolation" seen earlier was an artifact** of the
|
| 86 |
+
trivially-memorized synthetic corpus (ppl≈1.0 everywhere — a bug, since fixed).
|
| 87 |
+
On real text the picture inverts.
|
| 88 |
+
- **Sliding-window is the clear winner here** — 4.99 essentially flat across
|
| 89 |
+
512→2048 (best extrapolation *and* near-best train ppl). A plain local window
|
| 90 |
+
beats every CY-Sieve variant.
|
| 91 |
+
- **CY-Sieve exposes a real tension:** the geometry-fixed steep decay
|
| 92 |
+
(log λ=3.762) is too aggressive — no single τ gives *both* good absolute quality
|
| 93 |
+
and stable extrapolation. τ=512 is best at the train context but degrades
|
| 94 |
+
4.65→10.62 at 4×; τ=128 is stable but +61% worse than the baseline; the τ-ladder
|
| 95 |
+
meant to resolve this lands at ~11–12 (poor on both axes).
|
| 96 |
+
- This is a **genuine negative result for the positional scheme**, reported per the
|
| 97 |
+
project's own rules. The HBM advantage (§6) is real but irrelevant if quality
|
| 98 |
+
fails — a fast kernel that hurts the model is a failed kernel.
|
| 99 |
+
|
| 100 |
+
**What this does NOT kill:** §4 correctness and the §6 O(L)-vs-O(L²) HBM property
|
| 101 |
+
stand on their own. The negative is specifically about *this bias function* as a
|
| 102 |
+
drop-in positional scheme. See "Improvement directions" below.
|
| 103 |
+
|
| 104 |
+
## Improvement directions (post-KILL)
|
| 105 |
+
|
| 106 |
+
The kill is informative, not terminal — it points at specific, testable fixes:
|
| 107 |
+
1. **Decouple the slope from the geometry.** logλ=3.762 is the *growth rate of
|
| 108 |
+
S₂₀*, but there's no law that the best *attention* slope equals it. Treat the
|
| 109 |
+
per-head slope as a learnable/tunable parameter initialized from the geometry,
|
| 110 |
+
à la learnable-ALiBi — the geometry sets the prior, not the value.
|
| 111 |
+
2. **Hybrid with a local window.** Sliding-window won; combine an exact local
|
| 112 |
+
window (Tier 1, which CY-Sieve already has) with a *much gentler* long-range
|
| 113 |
+
tail, instead of one steep curve everywhere.
|
| 114 |
+
3. **Re-examine the β=2 log-curvature** contribution separately from the linear
|
| 115 |
+
slope — ablate whether the log term helps or hurts at these lengths.
|
| 116 |
+
4. **Only then** is the O(L) HBM advantage worth re-claiming — and only if a
|
| 117 |
+
redesigned bias clears the +5% gate.
|
| 118 |
+
|
| 119 |
+
---
|
| 120 |
+
|
| 121 |
+
## Reproducibility
|
| 122 |
+
|
| 123 |
+
```bash
|
| 124 |
+
pip install -r 4_ai_hardware_attention/requirements-gpu.txt
|
| 125 |
+
python 4_ai_hardware_attention/run_gpu_phase.py # §4 + §5 + §6 → one JSON
|
| 126 |
+
```
|
| 127 |
+
On GCP the same is driven unattended by `4_ai_hardware_attention/gcp_startup.sh`
|
| 128 |
+
(an L4 that clones, runs, uploads to GCS, and self-terminates).
|