mlsanityData to 14 Oct 2026

FlashBias: Fast Computation of Attention with Bias

arXiv 2505.12044 ↗First posted 17 May 2025cs.LGcited by 11

Not on the map. Why?

Abstract (arXiv)

Attention with bias, which extends standard attention by introducing prior knowledge as an additive bias matrix to the query-key scores, has been widely deployed in vision, language, protein-folding and other advanced scientific models, underscoring its status as a key evolution of this foundational module. However, introducing bias terms creates a severe efficiency bottleneck in attention computation. It disrupts the tightly fused memory-compute pipeline that underlies the speed of accelerators like FlashAttention, thereby stripping away most of their performance gains and leaving biased attention computationally expensive. Surprisingly, despite its common usage, targeted efficiency optimization for attention with bias remains absent, which seriously hinders its application in complex tasks. Diving into the computation of FlashAttention, we prove that its optimal efficiency is determined by the rank of the attention weight matrix. Inspired by this theoretical result, this paper presents FlashBias based on the low-rank compressed sensing theory, which can provide fast-exact computation for many widely used attention biases and a fast-accurate approximation for biases in general formalizations. FlashBias can fully take advantage of the extremely optimized matrix multiplication operation in modern GPUs, achieving 1.5× speedup for Pairformer in AlphaFold 3, and over 2× speedup for attention with bias in vision and language models without loss of accuracy. Code is available at this repository: https://github.com/thuml/FlashBias.

Key facts. Cited by 11 papers in the map (data through 14 Oct 2026). Builds on 22 of its 45 references that are in the map. First posted on arXiv 17 May 2025.

Builds on

22 of 45 references.

References · 22

  1. 2017Attention Is All You Needcited by 60,361
  2. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
  3. 2023GPT-4 Technical Reportcited by 18,396
  4. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
  5. 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,139
  6. 2022Scalable Diffusion Models with Transformerscited by 6,054
  7. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
  8. 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
  9. 2020Longformer: The Long-Document Transformercited by 3,413
  10. 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
  11. 2020Point Transformercited by 1,470
  12. 2021Swin Transformer V2: Scaling Up Capacity and Resolutioncited by 1,228
10 more
  1. 2024ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Toolscited by 1,121
  2. 2021Perceiver: General Perception with Iterative Attentioncited by 1,104
  3. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,103
  4. 2024Transolver: A Fast Transformer Solver for PDEs on General Geometriescited by 326
  5. 2023Spherical Fourier Neural Operators: Learning Stable Dynamics on the Spherecited by 233
  6. 2024Flex Attention: A Programming Model for Generating Optimized Attention Kernelscited by 185
  7. 2018Online normalizer calculation for softmaxcited by 162
  8. 2021Self-attention Does Not Need O(n2) Memorycited by 154
  9. 2024FlashMask: Efficient and Rich Mask Extension of FlashAttentioncited by 20
  10. 2024Efficiently Dispatching Flash Attention For Partially Filled Attention Maskscited by 2

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 11.

11 papers.