Rethinking Attention: Polynomial Alternatives to Softmax in Transformers
Hemanth Saratchandran, Jianqiao Zheng, Yiping Ji, Wenbo Zhang, Simon Lucey
TL;DR
This work questions the necessity of softmax-derived probabilistic properties in transformer attention and proposes that the success of softmax stems from implicit Frobenius-norm regularization of the self-attention matrix. By introducing polynomial activations with appropriate scaling, notably $\phi(x)=\frac{1}{\sqrt{N}}x^p$, the authors demonstrate comparable or superior performance across vision, object detection, long-range tasks, and physics-informed modeling, while violating non-negativity, normalization, and sparsity. Theoretical results bound the Frobenius norms and gradients for softmax and polynomial activations, providing a principled scaling regime, and extensive experiments validate the approach on ImageNet, COCO, Nyströmformer benchmarks, and PINNs. The findings offer a new lens on attention design, enabling alternative, potentially more stable mechanisms that preserve performance while loosening traditional probabilistic constraints. Overall, the paper broadens the design space for attention in transformers and suggests practical benefits for scalability and interpretability across diverse domains.
Abstract
This paper questions whether the strong performance of softmax attention in transformers stems from producing a probability distribution over inputs. Instead, we argue that softmax's effectiveness lies in its implicit regularization of the Frobenius norm of the attention matrix, which stabilizes training. Motivated by this, we explore alternative activations, specifically polynomials, that achieve a similar regularization effect. Our theoretical analysis shows that certain polynomials can serve as effective substitutes for softmax, achieving strong performance across transformer applications despite violating softmax's typical properties of positivity, normalization, and sparsity. Extensive experiments support these findings, offering a new perspective on attention mechanisms.
