Critical power-law sparse attention
Implementation & benchmark of arXiv:2607.11662 — Emergent quantum chaos from correlations on a random graph
Source paper: Emergent quantum chaos from correlations on a random graph arXiv:2607.11662 ⓘ · analyzed Aug 30, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Replace dense self-attention by a sparse mask on a one-dimensional or ordered token geometry, retaining local neighbors and adding long-range edges with probability proportional to distance raised to \(-(1+\sigma)\). Use \(\sigma\approx0.8\text{--}0.85\) as the initial regime because the paper finds that this range supports delocalized, GOE-like connectivity despite sparse bonds. The resulting layer has linear or near-linear attention cost while maintaining long-range paths.
Formulas
Mathematical statement
The paper's graph connects sites \(i,j\) on a one-dimensional ring independently with Bernoulli probability \(p_{ij}=d_{ij}^{-(1+\sigma)}\), where \(d_{ij}=\min(|i-j|,n-|i-j|)\) is ring distance, \(n\) is sequence length, and \(\sigma>0\) controls decay. For distances \(d\ge1\), the expected number of long-range neighbors is approximately \(2\sum_{d=1}^{n/2}d^{-(1+\sigma)}\), which is finite as \(n\to\infty\) for \(\sigma>0\). The extracted result reports GOE-like spectral correlations for \(\sigma\lesssim0.80\text{--}0.85\) and localized/Poisson behavior for larger \(\sigma\), with the transition far from the naive mean-hopping summability threshold \(\sigma=0\). In the neural adaptation, \(A_{ij}\sim\mathrm{Bernoulli}(p_{ij})\) defines the attention mask and the masked attention operator is \(Y_i=\sum_{j:A_{ij}=1}\mathrm{softmax}_{j\in N(i)}(Q_iK_j^\top/\sqrt{d_k})V_j\).
Implementation notes
1. Integration point: replace the dense \(QK^\top\) attention matrix in one or more Transformer blocks by a precomputed sparse edge list. Assume tokens have an order, such as text positions, image patches in raster order, or time steps. Always include a local window of radius \(r\), then add long-range edges using the power-law rule. For large sequences, do not enumerate all Bernoulli trials: draw \(m\) distances from the discrete distribution \(q(d)=d^{-(1+\sigma)}/\sum_{u=1}^{\lfloor n/2\rfloor}u^{-(1+\sigma)}\), choose a random direction, and deduplicate edges; this is a fixed-degree approximation to the paper's mask. 2. Pseudocode: inputs \(X\in\mathbb{R}^{n\times d}\), local radius \(r\), long-range budget \(m\), exponent \(\sigma\). Build \(N(i)\leftarrow\{i-r,\ldots,i+r\}\); repeat \(m\) times: sample \(d\sim q\), sample sign \(s\in\{-1,+1\}\), set \(j=(i+sd)\bmod n\), and add \(j\) to \(N(i)\). Compute only logits \(Q_iK_j^\top/\sqrt{d_k}\) for \(j\in N(i)\), apply the masked softmax and weighted value sum shown above. 3. Compute from the paper: the distance law, finite expected-degree scaling, and recommended transition range \(\sigma\approx0.8\text{--}0.85\); estimate empirically: validation loss, gradient propagation across positions, graph diameter, and the spectrum of the normalized mask Laplacian or adjacency. 4. First experiment: train a 6-layer small Transformer on WikiText-103 or enwik8 with sequence length 1024, comparing dense attention, local-window attention, and this mask at matched heads and hidden size. Sweep \(\sigma\in\{0.5,0.7,0.8,0.85,1.0,1.2\}\) and long-range budgets giving 32, 64, and 128 total neighbors. Measure training loss versus attended edges/FLOPs, validation perplexity, throughput, and attention-gradient influence between tokens separated by at least 256 positions. Success is lower perplexity than local attention at the same edge budget, with at least 2x lower attention memory than dense attention and no degradation relative to dense attention at fixed training compute.
Verification
Stage 1 · Toy mechanism gate: Failed ✗
Stage 2 · Mechanism transferred to benchmark: Not tested
Stage 2 · Practical benchmark result: Not run
Methodology: Toy-system gate first; the benchmark stage runs only after a pass. How verification works
Stage 1 — Mechanism check agent confidence 9/10
Built experiment.py implementing Bernoulli power-law ring masks, finite-degree and distance-tail checks, spectral spacing/diameter sweeps, and a sparse-attention cost benchmark. The finite expected degree and long-range tail predictions were qualitatively observed, and the sparse mask reduced computed logit edges by about 24.4x versus dense attention with about 15.1x lower estimated logit memory, but the predicted GOE-to-Poisson spectral transition was not observed at this toy size: spacing ratios remained 0.464–0.529 rather than approaching the Poisson reference 0.386 above sigma=0.85. Therefore the mechanism was not sufficiently confirmed and worked=false.
- Agent confidence
- 9/10
- Additional scaling
- Expected degree limits from the formula were 5.216, 3.764, and 2.981 for sigma 0.5, 0.8, and 1.2; sampled degrees at n=512 were 5.002, 3.734, and 2.980 respectively.
- Baseline
- Dense attention: 65,536 edges/head total and 0.0525 s; estimated sparse-logit memory ratio 15.06x versus the tested sparse layout.
- Idea
- Power-law sigma=0.8: 2,690 edges/head total and 0.0735 s in unoptimized Python, about 24.4x fewer edges; observed tail exponent -0.873 versus predicted -0.8; mean spectral spacing ratio 0.506 at n=192; diameter 13.7.
Limitations: No language-model training or validation perplexity experiment was run; the attention benchmark is an unoptimized NumPy loop and measures forward computation rather than end-to-end GPU speed. Spectral tests used n=192 and 12 graph samples per sigma, so the paper's finite-size transition may require substantially larger graphs and careful spectral unfolding.
How to run: python3 experiment.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Artifacts
- experiment.py 5.4 KB View Raw
- report.md 1.9 KB View
- results.json 3.4 KB View Raw