Quasi Linear Kernel Attention with Infinite Capacity
Abstract
The evaluation cost of transformers with softmax attention scales quadratically with sequence length. Kernel attention addresses this by replacing softmax with a more general kernel function. In this paper, we aim to identify kernels that retain the expressivity of attention while enabling quasi linear computation. To quantify expressivity, we introduce a capacity for each kernel, measuring the maximum sequence length for which the attention matrix can approximate the identity. A higher capacity thus indicates greater expressivity. We show that expressive kernels like softmax, Gauss, and Laplace have infinite capacity. In contrast, common quasi linear kernels, such as those derived from finite dimensional feature maps, exhibit finite capacity. As a solution, we propose additive kernels constructed from univariate spline and polynomial exponential kernels. We prove that these maintain infinite capacity while allowing quasi linear computation via sorting. Finally, we implement additive sorting kernels efficiently and benchmark them against modern softmax backends, demonstrating advantages for long sequences.
Create a lesson
Metadata
- Categories
- cs.LG, cs.NA, math.NA
Related papers
Linear Attention Has Superlinear Capacity
Shared title terminologycs.LGHao Guo, Sudhaunshu Hardikar, Simon Dennis et al.
Triadic Linear Attention: Three-Dimensional Recurrent States for Long-Context Sequence Modeling
Shared title terminologycs.LGOliver Sieberling, Bharat Runwal, David Jin et al.
Grokking Is a High-Overlap, High-Capacity Regime of Ordinary Training
Shared title terminologycs.LGMian Wang
Interpretable generative graph attention for representation learning and reconstruction of multimodal neuroimaging data
Shared title terminologycs.LGMeenu Ajith, Ishaan Batta, Vince Calhoun
Efficient Algorithms for Lifelong Representation Learning in Linear Bandits Beyond Task Diversity
Shared title terminologycs.LGThang Duong, Zhi Wang, Chicheng Zhang
Tabular Selective Attention
Shared title terminologycs.LGRohith Saai Pemmasani Prabakaran, Daniel De Dios Allegue, Nour Shaheen et al.