TL;DR
Why does standard softmax attention sail smoothly over long prediction horizons while unnormalized linear attention frequently explodes into NaNs? By viewing attention through the lens of dynamical systems, this paper untangles how tokens mix from how states evolve—revealing that softmax’s secret weapon isn’t positive weights or kernel tricks, but a subtle mathematical speed limit on its row sums.
What Problem Does This Paper Address?
Transformers rely on softmax attention, which scales quadratically with sequence length ($O(n^2)$). Researchers often swap it out for "linear attention" variants to speed things up. However, when you strip away the softmax denominator—leaving raw, unnormalized bilinear attention—models become notoriously unstable during long-horizon autoregressive rollouts, collapsing or diverging wildly.
Existing theories blame rank collapse or expressivity gaps, but none fully explain why unnormalized attention blows up when predicting far into the future, even on underlying systems that are inherently stable. The author tackles a fundamental question: what exact mathematical mechanism keeps softmax stable over time, and how do we isolate it without crippling the model's ability to learn complex dynamics?
Methods
The author introduces a Two-Object Framework that splits an attention layer into two distinct mathematical roles:
- Architectural stability ($n \times n$ token-mixing matrix, $A$): Governs how information blends across the sequence length $n$.
- Dynamical stability ($d \times d$ dual operator, $C$): Governs how the $d$-dimensional state features evolve step-by-step.
Under idealized, unmasked conditions, the author proves that unnormalized linear attention secretly solves Extended Dynamic Mode Decomposition (EDMD)—a classic physics technique for approximating the Koopman operator (a linear map of nonlinear dynamics). This means $C$ needs to be left completely unconstrained so it can track genuinely growing or chaotic systems.
To stabilize the network without handcuffing $C$, the author constrains only the token-mixing matrix $A$, designing two diagnostic testbeds (both $O(n^2)$ tools to test the theory, rather than new fast architectures):
- Row-Normalized Linear Attention (RN-LA): Divides each row of $A$ by the sum of its absolute values, enforcing an induced $\ell_\infty$ norm bound ($\|A\|_\infty \le 1$) while still allowing negative attention weights.
- Spectral-Normalized Linear Attention (SN-LA): Scales $A$ by its spectral radius (largest eigenvalue magnitude, $\rho(A)$) or spectral norm ($\|A\|_2$), tested via both power-iteration estimates and exact mathematical controls.
Datasets
- Synthetic Linear-Gaussian Trajectories: A controlled 8-dimensional synthetic system where the true transition matrix's spectral radius ($\rho$) is tuned across $\{0.90, 0.95, 1.00, 1.05\}$ to cleanly separate model-induced explosions from genuinely unstable data.
- Long-Horizon Time-Series Benchmarks: Standard real-world forecasting suites—ETTh1, ETTh2, ETTm1, ETTm2 (electricity transformer temperatures), and Weather—evaluated using a PatchTST backbone across prediction horizons from 96 to 720 steps, plus free-running autoregressive rollouts on ETTh1.
Key Insights and Ideas
- Why Spectral Radius Fails Over Time: You might assume keeping eigenvalues at or below 1 ($\rho(A_t) \le 1$) prevents explosions. Not for time-varying matrices! Multiplying benign lower-triangular shear matrices like $\begin{pmatrix} 1 & 0 \\ 1 & 1 \end{pmatrix}$ $T$ times yields $\begin{pmatrix} 1 & 0 \\ T & 1 \end{pmatrix}$, growing linearly to infinity. Conversely, an induced operator norm like $\|A_t\|_\infty \le 1$ is submultiplicative—meaning products of matrices stay strictly bounded forever.
- Positivity Is a Red Herring for Stability: Standard normalized linear attention uses positive feature maps so weights sum to 1 like probabilities. RN-LA proves that positivity isn't required for the stability certificate—bounding absolute row sums stops explosions even with negative weights. (Positivity is only needed if you want to factorize the math into $O(n)$ time!).
- RMSNorm Beats LayerNorm for Identifiability: In the idealized EDMD setup, standard LayerNorm centers features, creating a zero-sum direction that makes the optimal linear operator mathematically non-unique. Non-affine RMSNorm rescales without centering, preserving full matrix rank.
- No Silver Bullet: Bounding $\|A\|_\infty \le 1$ only certifies the token-mixing sub-layer. Because value projections ($W_V$), MLPs, and residual connections sit outside this bound, even softmax cannot guarantee whole-network stability.
Key Results
Across 120 synthetic training runs, methods with the $\ell_\infty$ row-sum certificate dominated:
- Synthetic Rollouts: RN-LA (18/20) and Causal Softmax (17/20) passed a strict joint test of 100-step rollout finiteness and training fit, with zero
NaN/infinite rollouts. Vanilla LA (5/20), estimated SN-LA (3/20), exact-$\rho$ SN-LA (7/20), and exact-$\|A\|_2$ SN-LA (6/20) frequently diverged—even when the ground-truth system was stable ($\rho = 0.90$).
- Real-World Free-Running Rollouts: On 100 free-running 96-step ETTh1 trajectories, Softmax and RN-LA stayed bounded in 100/100 cases, whereas Vanilla LA blew up to non-finite values in 92/100 runs.
- Patch-Based Forecasting: On the 5-dataset benchmark at horizon $H=720$, SN-LA and RN-LA closed 85% and 96% of the accuracy gap between Vanilla LA and Softmax (with counterexamples noted on ETTh2, where softmax beat both, and ETTm2, where Vanilla LA surprisingly edged out softmax at $0.350$ vs. $0.363$).
Limitations and Future Work
The author is refreshingly candid about the scope of the math:
- Partial Certificate: $\ell_\infty$ normalization prevents token-mixing products from expanding, and prevents numerical blowups in practice, but leaves $W_V$ and MLPs unconstrained—meaning models can still underfit or fail to track genuinely unstable modes ($\rho = 1.05$).
- Quadratic Cost: Signed RN-LA must materialize the $n \times n$ matrix ($O(n^2)$) because absolute values break the associative trick needed for $O(n)$ linear attention.
- Idealized Theory: The exact Koopman/EDMD equivalence only holds for single-head, unmasked, fixed-encoder setups; causal masking creates position-dependent operators that break the global identity. Extending these diagnostics to multi-head deep Transformers or recurrent state-space models like Mamba and RWKV remains an open frontier.
Summary updated