TL;DR
Grouped-Head LatenT Attention (GTA) is a novel attention mechanism designed to alleviate the memory and computational bottlenecks of the KV cache in Large Language Models (LLMs). By combining shared attention maps across head groups with a nonlinear value decoder that compresses values into a compact latent space, GTA reduces attention FLOPs by up to 62.5% and shrinks the KV cache by up to 70% compared to Grouped-Query Attention (GQA) without sacrificing model expressivity.
What Problem Does This Paper Address?
As LLMs are deployed for long-context applications, the Key-Value (KV) cache stored during autoregressive generation grows linearly with sequence length. This creates massive memory and I/O bottlenecks, making deployment on resource-constrained hardware difficult.
Existing solutions present stark trade-offs. Multi-Query Attention (MQA) and Grouped-Query Attention (GQA) reduce memory by sharing keys and values across heads, but they compromise attention granularity and expressivity. On the other hand, Multi-head Latent Attention (MLA) compresses the KV cache effectively but introduces significant computational overhead during the prefill phase. GTA aims to break this conventional efficiency-expressivity trade-off, optimizing both the prefill (compute-bound) and decode (I/O-bound) stages simultaneously.
Methods
GTA introduces two primary architectural innovations:
- Shared Attention Map Mechanism: It groups query and key projections to reuse attention scores across multiple heads within a group. This minimizes redundant attention matrix calculations and significantly shrinks the key cache size.
- Nonlinear Value Decoder: Instead of storing full-dimensional value vectors in the cache, GTA compresses the value cache into a lower-dimensional latent space ($C$). During inference, it utilizes a context-adaptive Sigmoid gate combined with learned head-specific projections to dynamically reconstruct full-rank, expressive value representations on the fly.
The evolution of these attention mechanisms—from standard Multi-Head Attention (MHA) through intermediate variants to GTA—is illustrated below:
The detailed architecture of GTA, highlighting how the compressed latent value representation interacts with the nonlinear gating mechanism, is shown here:
Datasets
- Pretraining: The authors trained and validated smaller models (160M and 500M parameters) on the C4 dataset using sequence lengths of 2048 and 4096 tokens. For the larger 1B parameter scale, models were pretrained on 220 billion tokens from the smollm-corpus.
- Fine-tuning: Supervised Fine-Tuning (SFT) was performed using the tulu3 dataset.
- Evaluation: Models were evaluated across a diverse suite of downstream benchmarks via
lm-evaluation-harness, including PIQA, HellaSwag, ARC-e, ARC-c, Winogrande, BoolQ, MathQA, TruthfulQA (TQA), BBH, IFEval, MBPP, and LogiQA.
Key Insights and Ideas
- Exploiting Attention Map Redundancy: The core motivation relies on the observation that attention maps across different heads often display high similarity, meaning separate key-query computations per head are largely redundant.
- Nonlinearity Restores Expressivity: Compressing values linearly usually hurts model capacity. GTA's "aha moment" is using a context-adaptive Sigmoid gate (element-wise multiplication) during decoding, which acts like a gated linear unit (GLU) to maximize information density and restore full-rank expressivity from a compact latent space.
- Sparsity vs. Rank: Sparser activation functions like ReLU or SiLU actually degrade performance in this architecture because they introduce more zeros and reduce the effective rank of the value representation. A smooth, bounded function like Sigmoid is crucial for effective attention computation.
Key Results
- Cache and Computation Reduction: GTA reduces self-attention FLOPs by up to 62.5% compared to GQA and shrinks the KV cache footprint by up to 70%. At the 160M scale, GTA uses just 12.5% of MHA's KV cache size per layer while achieving better evaluation loss and Wikitext perplexity.
- Throughput and Latency: Real-world deployment benchmarks across various hardware platforms (NVIDIA H100, A800, RTX 3060, Apple M2, and Raspberry Pi's BCM2712) demonstrate a 2× increase in end-to-end inference speed compared to GQA.
- Downstream Performance: At the 1B parameter scale, the fine-tuned GTA model (GTA-1B-SFT) achieved an average score of 42.17 across downstream tasks, outperforming GQA-1B-SFT (40.64) despite using only 30% of GQA's cache size.
Limitations and Future Work
The primary limitation acknowledged by the authors is the lack of low-level engineering optimization. Currently, the model relies on standard library implementations rather than hardware-specific custom CUDA kernels or Triton implementations. This prevents GTA from reaching its theoretical upper bound of efficiency gains in practice.
Future work will focus on developing dedicated kernel-level optimizations to fully exploit the theoretical computational savings during both the prefill and decoding stages.
Summary updated