cs.LGJan 30, 2026

Sparse Attention as Compact Kernel Regression

Authors: Saul Santos, Nuno Gonçalves, Daniel C. McNamee, Marcos Treviso, André F. T Martins

Organizations: Instituto Superior Técnico & Instituto de Telecomunicações, Universidade de Lisboa, Portugal · Carnegie Mellon University, Pittsburgh, USA · Champalimaud Research, Lisbon, Portugal · TransPerfect, Lisbon, Portugal

Abstract

Recent work has revealed a link between self-attention mechanisms in transformers and test-time kernel regression via the Nadaraya-Watson estimator, with standard softmax attention corresponding to a Gaussian kernel. However, a kernel-theoretic understanding of sparse attention mechanisms is currently missing. In this paper, we establish a formal correspondence between sparse attention and compact (bounded support) kernels. We show that normalized ReLU and sparsemax attention arise from Epanechnikov kernel regression under fixed and adaptive normalizations, respectively. More generally, we demonstrate that widely used kernels in nonparametric density estimation -- including Epanechnikov, biweight, and triweight -- correspond to αα-entmax attention with α=1+1nα= 1 + \frac{1}{n} for n∈Nn \in \mathbb{N}, while the softmax/Gaussian relationship emerges in the limit n→∞n \to \infty. This unified perspective explains how sparsity naturally emerges from kernel design and provides principled alternatives to heuristic top-kk attention and other associative memory mechanisms. Experiments with a kernel-regression-based variant of transformers -- Memory Mosaics -- show that kernel-based sparse attention achieves competitive performance on language modeling, in-context learning, and length generalization tasks, offering a principled framework for designing attention mechanisms.

Figures & tables

Appendix figures & tables9 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Quasi Linear Kernel Attention with Infinite Capacity

    Sep 28, 2026Nicolaj Rux, Johannes Hertrich, Sebastian NeumayerTransformer ExpressivityAttention Mechanisms

  2. Projection-Free Transformers via Gaussian Kernel Attention

    May 4, 2026Debarshi Kundu, Archisman Ghosh, Swaroop Ghosh +1TransformerSelf-Attention

  3. Sparse Attention Is Matrix Approximation, Not Choosing from a Bag of Values

    Oct 7, 2026Fang Wan, Xufeng Liu, Fan Li +1Sparse AttentionEfficient Attention