Attention is a smoothed cubic spline
Not on the map. Why?
Abstract (arXiv)
We highlight a perhaps important but hitherto unobserved insight: The attention module in a transformer is a smoothed cubic spline. Viewed in this manner, this mysterious but critical component of a transformer becomes a natural development of an old notion deeply entrenched in classical approximation theory. More precisely, we show that with ReLU-activation, attention, masked attention, encoder-decoder attention are all cubic splines. As every component in a transformer is constructed out of compositions of various attention modules (= cubic splines) and feed forward neural networks (= linear splines), all its components -- encoder, decoder, and encoder-decoder blocks; multilayered encoders and decoders; the transformer itself -- are cubic or higher-order splines. If we assume the Pierce-Birkhoff conjecture, then the converse also holds, i.e., every spline is a ReLU-activated encoder. Since a spline is generally just C2, one way to obtain a smoothed C^∞-version is by replacing ReLU with a smooth activation; and if this activation is chosen to be SoftMax, we recover the original transformer as proposed by Vaswani et al. This insight sheds light on the nature of the transformer by casting it entirely in terms of splines, one of the best known and thoroughly understood objects in applied mathematics.
Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). Builds on 15 of its 46 references that are in the map. First posted on arXiv 19 Aug 2024.
Builds on
15 of 46 references.
References · 15
- 2017Attention Is All You Needcited by 59,932
- 2015Deep Residual Learning for Image Recognitioncited by 51,809
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
- 2023RT-2: Vision-Language-Action Models Transfer Web Knowledge to Robotic Controlcited by 2,993
- 2021Multi-Modal Fusion Transformer for End-to-End Autonomous Drivingcited by 372
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
- 2016Understanding Deep Neural Networks with Rectified Linear Unitscited by 253
- 2022cosFormer: Rethinking Softmax in Attentioncited by 212
- 2019Universal Approximation with Deep Narrow Networkscited by 198
- 2019Sparse Sequence-to-Sequence Modelscited by 167
- 2021SOFT: Softmax-free Transformer with Linear Complexitycited by 128
3 more
Built on by
Citing papers per year: 2025: 3; 2026: 1.
4 papers.
- 2025Transformers for Learning on Noisy and Task-Level Manifolds: Approximation and Generalization Insightscited by 3
- 2025A Mathematical Explanation of Transformerscited by 2
- 2026Algebraic Invariants of Lightning Self-Attentioncited by 1
- 2025Softplus Attention with Re-weighting Boosts Length Extrapolation in Large Language Modelscited by 0
- 2026Algebraic Invariants of Lightning Self-Attention17 Apr 2026
- 2025A Mathematical Explanation of Transformers5 Oct 2025
- 2025Transformers for Learning on Noisy and Task-Level Manifolds: Approximation and Generalization Insights6 May 2025
- 2025Softplus Attention with Re-weighting Boosts Length Extrapolation in Large Language Models23 Jan 2025