Positional LSH: Binary Block Matrix Approximation for Attention with Linear Biases
Not on the map. Why?
Abstract (arXiv)
Positional encoding in transformers is commonly implemented through positional embeddings, attention masks, or bias terms, but formal connections between these mechanisms remain limited. We study attention with positional bias through the lens of locality-sensitive hashing (LSH), focusing on Attention with Linear Biases (ALiBi). We show that the ALiBi bias matrix is the expectation of contiguous block-diagonal binary masks induced by a ``positional LSH'' scheme. The empirical mean of masks sampled from this scheme yields spectral norm and max-norm approximation guarantees with bounded block sizes with high probability. This structural theorem implies a uniform approximation theorem for ALiBi-biased attention: with high probability over the sampled masks, the approximate attention output is accurate simultaneously for all query-key-value inputs and can be computed in near-linear time in the context length, reducing long-context ALiBi to a collection of randomized short-context regular (positionally unbiased) attention operations. Conceptually, this connects positional bias, masks, and positional embeddings in a single formal framework and suggests an approach to efficient ALiBi-biased attention. Experiments on large language models validate our theoretical findings.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 21 of its 36 references that are in the map. First posted on arXiv 10 May 2026.
Builds on
21 of 36 references.
References · 21
- 2017Attention Is All You Needcited by 59,932
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2020Longformer: The Long-Document Transformercited by 3,362
- 2016Pointer Sentinel Mixture Modelscited by 2,992
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
- 2020Reformer: The Efficient Transformercited by 1,658
- 2018Self-Attention with Relative Position Representationscited by 1,112
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 319
- 2024Repeat After Me: Transformers are Better than State Space Models at Copyingcited by 208
- 2024MagicPIG: LSH Sampling for Efficient LLM Generationcited by 112
9 more
- 2015Practical and Optimal LSH for Angular Distancecited by 105
- 2023HyperAttention: Long-context Attention in Near-Linear Timecited by 85
- 2022KERPLE: Kernelized Relative Positional Embedding for Length Extrapolationcited by 84
- 2018Hashing-Based-Estimators for Kernel Density in High Dimensionscited by 31
- 2020Kernel Density Estimation through Density Constrained Near Neighbor Searchcited by 26
- 2024HashAttention: Semantic Sparsity for Faster Inferencecited by 23
- 2019Sub-linear RACE Sketches for Approximate Kernel Density Estimation on Streaming Datacited by 13
- 2025FlashBias: Fast Computation of Attention with Biascited by 9
- 2025Improved Algorithms for Kernel Matrix-Vector Multiplication Under Sparsity Assumptionscited by 4
Built on by
Not cited yet.