Reproduce “Lean Attention: Hardware-Aware Scalable Attention Mechanism for the Decode-Phase of Transformers” on OpenResearch

Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

Rya Sanovar, Srikant Bharadwaj, Renee St. Amant, Victor Rühle, Saravan Rajmohan

LeanAttention introduces a hardware-aware attention mechanism designed for the decode-phase of Transformers, improving efficiency by addressing low hardware utilization and imbalanced workloads in existing methods. The approach achieved an average speedup of 1.73x over FlashDecoding on A100 GPUs and 1.52x on H100 GPUs while maintaining near 100% Streaming Multiprocessor occupancy.

Key insights

  • The softmax re-scaling operator possesses an associative property, which allows attention computation to be efficiently partitioned into smaller, independently computable blocks and then accurately reduced.
  • Optimizing the decode-phase requires a dynamic and hardware-aware partitioning strategy that can adapt to varying problem sizes and ensure balanced workload distribution, unlike fixed-split approaches.
  • Achieving near 100% GPU Streaming Multiprocessor (SM) occupancy is crucial for maximizing the performance and energy efficiency of attention mechanisms, especially for long context lengths.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.