Sparse Attention as Compact Kernel Regression
Saul Santos, Nuno Gonçalves, Daniel McNamee, Marcos Treviso, André Martins
NeurIPS page · OpenReview · Open on the map
Category: Interpretability & Model Adaptation › Transformer Attention Theory · Type: new method · Keywords: sparse attention, kernel regression, attention mechanisms, transformer, theoretical analysis
Areas: Model Architectures & Sequence Modeling › Language Model Architectures › Attention Replacement and Stabilization
Summary
The paper establishes a formal correspondence between sparse attention and compact kernel regression, showing that normalized ReLU, sparsemax, and α-entmax attention map to Epanechnikov, biweight, and triweight kernels, and introduces a kernel-regression-based transformer variant (Memory Mosaics) that achieves competitive performance.
Explained to a 5-year-old
Computers that read words sometimes need to know which words are most important. They do this by giving each word a score and then focusing on the highest scores. Some of these computers use a method that spreads the focus over a small area, like a gentle hug. The researchers looked at this hugging method and found it is the same as a math trick used to smooth data. This new view helps designers make new, easier computers that can learn from fewer examples.
Explained to a 5-year-old, longer
Computers that read text sometimes need to know which words are most important. They do this by giving each word a score and then focusing on the highest scores. Some of these computers use a method that spreads the focus over a small area, like a gentle hug. The researchers looked at this hugging method and found it is the same as a math trick used to smooth data. This math trick is called kernel regression, and it helps to blend information smoothly. They discovered that a simple attention method called ReLU is actually the same as a specific smoothing kernel. Another method called sparsemax also matches a different smoothing kernel. They also found that many other attention methods correspond to other known smoothing kernels used in statistics. By linking attention to these kernels, they can design attention that is easier to understand and control. This new view explains why some attention methods become sparse, or only focus on a few words. The researchers built a new kind of computer model, called a transformer variant, that uses this idea. Tests showed that this new model works well on tasks like predicting the next word and learning from examples.
For a technical reader
The paper shows that many attention mechanisms used in large language models are mathematically equivalent to kernel regression methods. By mapping attention scores to compact kernels, they can design attention that naturally focuses on a limited set of tokens, reducing computation. The authors demonstrate this relationship for popular operators like ReLU and sparsemax, and show how α-entmax corresponds to various statistical kernels. They evaluate a transformer variant that uses this kernel-based attention and find it performs comparably on standard language tasks. This provides a principled way for engineers to choose or modify attention operators based on well-understood statistical properties.
Problem
There is currently no kernel-theoretic understanding of how sparse attention mechanisms relate to kernel regression, limiting principled design of attention.
Method
The approach establishes a formal correspondence between sparse attention and compact kernels, showing that normalized ReLU and sparsemax correspond to Epanechnikov kernel regression, and that α-entmax matches various nonparametric kernels. It also introduces a kernel-regression-based transformer variant for empirical evaluation.
Results
The approach achieves competitive performance on language modeling, in-context learning, and length generalization tasks.
Contributions
It provides a unified kernel-theoretic view linking sparse attention to compact kernels, identifies correspondences between attention operators and nonparametric kernels, and demonstrates the effectiveness of kernel-based sparse attention via experiments.
Practical relevance
It offers a principled framework for designing attention mechanisms, enabling more interpretable and theoretically grounded sparse attention.
Research questions this paper is counted under
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction