NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Hardware-Efficient Attention for Fast Decoding

Ted Zadouri, Hubert Strauss, Tri Dao

TL;DR

This paper introduces two novel attention mechanisms, Grouped-Tied Attention (GTA) and Grouped Latent Attention (GLA), designed to significantly speed up Large Language Model (LLM) decoding. By optimizing memory access patterns and computation, these methods reduce the KV cache size and increase hardware efficiency, leading to up to 2x faster decoding and improved throughput without sacrificing model quality.

What Problem Does This Paper Address?

LLM inference, particularly the decoding phase, is a major bottleneck. This is primarily due to the large Key-Value (KV) cache, which stores intermediate states and must be frequently loaded from high-bandwidth memory (HBM). This memory-bound operation inflates per-token latency and limits parallelism, especially for large batches and long contexts. Existing attention mechanisms like Multi-Head Attention (MHA), Multi-Query Attention (MQA), and Grouped-Query Attention (GQA) have limitations in terms of KV cache size, memory bandwidth usage, or parallelization capabilities. Multi-head Latent Attention (MLA) offers a solution by compressing KV states but struggles with efficient sharding across devices. This paper aims to address this by redesigning attention mechanisms to maximize computational efficiency per byte of memory transfer, thereby accelerating decoding and improving overall inference performance.

Methods

The paper proposes two main attention variants:

  • Grouped-Tied Attention (GTA): This method builds upon Grouped-Query Attention (GQA) by further optimizing the KV cache. GTA ties the key and value projection parameters into a single shared state for a group of query heads. This reduces the KV cache size by roughly half compared to GQA while maintaining comparable model quality and parallelism. It leverages insights from the low-rank nature of key activations and the fact that positional encodings (like RoPE) might not need to be applied to the entire head dimension.
  • Grouped Latent Attention (GLA): This is a parallel-friendly latent attention mechanism. It compresses tokens into a smaller number of latent heads (e.g., two heads, each with half the dimension of MLA's latent head). Crucially, GLA is designed for efficient sharding across tensor parallel ranks. This allows for head-level parallelism without duplicating the entire latent KV cache across devices, unlike MLA. GLA is further enhanced with low-level optimizations for fast decoding.

Both GTA and GLA are complemented by system-level optimizations, including software pipelining and warp specialization for asynchronous computation and memory loading, and a distributed offset calculation for paged KV cache management.

Datasets

The paper uses the following datasets for training and evaluation:

  • FineWeb-Edu: Used for training models of various sizes (small, medium, large, XL) and for validation perplexity evaluation.
  • Wikipedia, C4, Cosmopedia, Pile: Used in conjunction with FineWeb-Edu for comprehensive validation perplexity evaluation.
  • SciQ, OpenBookQA, ARC-Easy, HellaSwag, PIQA, WinoGrande, MMLU: Standard benchmarks used for zero-shot downstream evaluation.

The paper does not introduce new benchmarks but evaluates on existing ones to demonstrate the quality of their proposed methods.

Key Insights and Ideas

  • Arithmetic Intensity is Key: The paper strongly emphasizes that maximizing arithmetic intensity (computation per byte of memory access) is crucial for efficient LLM decoding, as memory bandwidth is often the bottleneck.
  • KV Cache is the Bottleneck: The KV cache's size and access patterns are identified as the primary culprits for slow decoding. Reducing its footprint and optimizing its loading is paramount.
  • Partial RoPE is Sufficient: Insights from research suggesting that positional encodings like RoPE might not need to be applied to the full head dimension are leveraged to reduce the KV cache size.
  • Sharding Latent Representations is Efficient: Unlike MLA, which duplicates its latent KV cache across tensor parallel ranks, GLA's design allows for efficient sharding of latent heads, enabling better parallelization and reduced per-device memory usage.
  • Hardware-Aware Design: The proposed methods are not just algorithmic but also consider modern hardware capabilities, leading to optimized kernels that push towards compute-bound performance.

Key Results

  • GTA: Achieves comparable quality to GQA while using roughly half the KV cache. For example, on a 1.471B model, GTA-4 achieved a perplexity of 10.12, slightly better than GQA-4's 10.20.
  • GLA: Matches MLA's quality and is easier to shard. It achieves up to 2x faster decoding speeds than FlashMLA in speculative decoding settings (query length > 1).
  • Performance Gains: Optimized GLA kernels are 1.2-2x faster than FlashMLA. GLA reduces end-to-end latency and increases token throughput by up to 2x in online serving benchmarks.
  • Model Quality: Across various model scales (small to XL), GTA and GLA consistently match or exceed the performance of baseline methods like GQA and MLA on perplexity and downstream task evaluations. For instance, on a large model (876M), GLA-2 achieved the lowest average perplexities.
  • Parallelization: GLA's design allows for efficient scaling across multiple devices, outperforming MLA in scenarios where KV cache duplication is a concern.

Limitations and Future Work

  • Scaling to Larger Models: The paper suggests it's worth evaluating GLA on even larger-scale models with more latent heads to further validate its performance and compare it against GQA-8.
  • Partial RoPE Application: The paper mentions that applying RoPE only in partial layers could mitigate the KV cache footprint of decoupled RoPE, and this is left for future work.
  • Ablation Studies: Further detailed studies on the trade-offs between parallelization and arithmetic intensity in other architectures (like Mamba) are suggested.
  • Post-Training Adaptation: The authors note that distillation methods applied to MLA could be adopted for GLA in a post-training stage to further leverage its low KV cache footprint.
  • Workload Imbalance: While GLA shows resilience to workload imbalance, the paper acknowledges that data parallelism can still offer advantages at very high concurrency levels, suggesting a need for further exploration of hybrid approaches.

Summary updated

BibTeX
@inproceedings{zadouri2025hardware,
  author = {Ted Zadouri and Hubert Strauss and Tri Dao},
  title = {{Hardware-Efficient Attention for Fast Decoding}},
  booktitle = {COLM},
  year = {2025},
  url = {https://openreview.net/forum?id=HAjgxcHpzc},
}
Figure