Sparse Attention as Compact Kernel Regression

Saul Santos, Nuno Gonçalves, Daniel C. McNamee, Marcos Treviso, André F. T Martins
1/30/2026
cs.LG
transformer-attention

No confident code implementation found for this paper.

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.

Show full abstract

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 + \frac{1}{n}$ for $n \in \mathbb{N}$, while the softmax/Gaussian relationship emerges in the limit $n \to \infty$. This unified perspective explains how sparsity naturally emerges from kernel design and provides principled alternatives to heuristic top-$k$ 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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{santos2026sparse,
  title  = {Sparse Attention as Compact Kernel Regression},
  author = {Saul Santos and Nuno Gonçalves and Daniel C. McNamee and Marcos Treviso and André F. T Martins},
  year   = {2026},
  eprint = {2601.22766},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2601.22766v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2601.22766.svg)](https://codeofpaper.com/paper/2601.22766)

Discussion