用核回归理论解释稀疏注意力如何自然产生,提供更合理的注意力设计方法。
Sparse Attention as Compact Kernel Regression
- 将稀疏注意力对应到有界支撑的核函数,揭示其数学本质。
- 不同核函数对应特定α-entmax注意力,稀疏性源于核设计而非人为截断。
- 实验表明基于核回归的注意力在语言建模等任务中表现优异,适合追求可解释性的研究者。
近期研究表明,Transformer中的自注意力机制与测试时的核回归存在联系,标准softmax注意力对应高斯核。然而,稀疏注意力的核理论尚不明确。本文建立稀疏注意力与紧凑(有界支撑)核之间的正式对应关系:归一化ReLU和sparsemax注意力分别源自固定与自适应归一化下的Epanechnikov核回归。更一般地,非参数密度估计中广泛使用的Epanechnikov、biweight和triweight核,对应于α-entmax注意力(α=1+1/n,n∈ℕ),而softmax/Gaussian关系则出现在n→∞的极限情形。这一统一视角解释了稀疏性如何从核设计中自然产生,并为启发式top-k注意力及其他关联记忆机制提供了原则性替代方案。基于核回归的Transformer变体Memory Mosaics在语言建模、上下文学习和长度泛化任务上取得竞争力结果,为注意力机制设计提供了可解释的框架。
原文摘要 · Abstract (English)
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 + \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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。