mlsanityData to 7 Oct 2026

Lean Attention: Hardware-Aware Scalable Attention Mechanism for the Decode-Phase of Transformers

arXiv 2405.10480 ↗First posted 17 May 2024cs.AR cs.LGcited by 16

Not on the map. Why?

Abstract (arXiv)

Transformer-based models have emerged as one of the most widely used architectures for natural language processing, natural language generation, and image generation. The size of the state-of-the-art models has increased steadily reaching billions of parameters. These huge models are memory hungry and incur significant inference latency even on cutting edge AI-accelerators, such as GPUs. Specifically, the time and memory complexity of the attention operation is quadratic in terms of the total context length, i.e., prompt and output tokens. Thus, several optimizations such as key-value tensor caching and FlashAttention computation have been proposed to deliver the low latency demands of applications relying on such large models. However, these techniques do not cater to the computationally distinct nature of different phases during inference. To that end, we propose LeanAttention, a scalable technique of computing self-attention for the token-generation phase (decode-phase) of decoder-only transformer models. LeanAttention enables scaling the attention mechanism implementation for the challenging case of long context lengths by re-designing the execution flow for the decode-phase. We identify that the associative property of online softmax can be treated as a reduction operation thus allowing us to parallelize the attention computation over these large context lengths. We extend the "stream-K" style reduction of tiled calculation to self-attention to enable parallel computation resulting in an average of 2.6x attention execution speedup over FlashAttention-2 and up to 8.33x speedup for 512k context lengths.

Key facts. Cited by 16 papers in the map (data through 7 Oct 2026). Builds on 22 of its 34 references that are in the map. First posted on arXiv 17 May 2024.

Builds on

22 of 34 references.

References · 22

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2020Language Models are Few-Shot Learnerscited by 32,199
  4. 2023GPT-4 Technical Reportcited by 18,132
  5. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  6. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
  7. 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
  8. 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,464
  9. 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
  10. 2019HuggingFace's Transformers: State-of-the-art Natural Language Processingcited by 2,201
  11. 2023Textbooks Are All You Need II: phi-1.5 technical reportcited by 559
  12. 2022Efficiently Scaling Transformer Inferencecited by 529
10 more
  1. 2023Ring Attention with Blockwise Transformers for Near-Infinite Contextcited by 448
  2. 2024Long-context LLMs Struggle with Long In-context Learningcited by 285
  3. 2024Data Engineering for Scaling Language Models to 128K Contextcited by 183
  4. 2018Online normalizer calculation for softmaxcited by 154
  5. 2020Data Movement Is All You Need: A Case Study on Optimizing Transformerscited by 108
  6. 2024Long Context Compression with Activation Beaconcited by 101
  7. 2023Full Stack Optimization of Transformer Inference: a Surveycited by 79
  8. 2023FlashDecoding++: Faster Large Language Model Inference on GPUscited by 70
  9. 2023Striped Attention: Faster Ring Attention for Causal Transformerscited by 52
  10. 2023Stream-K: Work-centric Parallel Decomposition for Dense Matrix-Matrix Multiplication on the GPUcited by 22

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 2; 2025: 6; 2026: 8.

16 papers.

Sort:

By area: