Abstract: We propose novel attention architectures, Multi-matrix Factorization Attention (MFA) and MFA-Key-Reuse (MFA-KR). Existing variants for standard Multi-Head Attention (MHA), including SOTA methods like MLA, fail to maintain as strong performance under stringent Key-Value cache (KV cache) constraints. MFA enhances model capacity by efficiently scaling up both the number and dimension of attention heads through low-rank matrix factorization in the Query-Key (QK) circuit. Extending MFA, MFA-KR further reduces memory requirements by repurposing the key cache as value through value projection re-parameterization. MFA’s design enables strong model capacity when working under tight KV cache budget, while MFA-KR is suitable for even harsher KV cache limits with minor performance trade-off. Notably, in our extensive and large-scale experiments, the proposed architecture outperforms MLA and performs comparably to MHA, while reducing KV cache usage by up to 56% and 93.7%, respectively.
Introduction: The KV Cache Bottleneck
In Large Language Models (LLMs), the "KV cache" is a significant operational bottleneck. During autoregressive generation, models store the Keys and Values of all previous tokens to avoid redundant computation. As sequence lengths and batch sizes scale, this cache consumes massive amounts of memory, limiting inference throughput and increasing the cost of serving models.
Existing approaches like Multi-Query Attention (MQA) and Grouped-Query Attention (GQA) mitigate this by sharing keys and values across heads, but often at the cost of model expressivity. Even state-of-the-art methods like Multi-head Latent Attention (MLA) struggle under extremely tight memory constraints because they do not scale the number of attention heads efficiently relative to the cache size.
Methods: MFA and MFA-KR Architectures
To address these limitations, we introduce Multi-matrix Factorization Attention (MFA) and its variant, MFA-Key-Reuse (MFA-KR).
- MFA (Multi-matrix Factorization Attention): MFA factorizes weight matrices into low-rank components. By decomposing the Query-Key circuit into shared latent projections ($S_q, S_k$) and head-specific projections ($Q_c$), the model can increase the number of attention heads without expanding the KV cache. The cache size remains tied to the shared latent dimension ($C$), allowing for high head counts with minimal memory overhead.
- MFA-KR (MFA-Key-Reuse): This variant further optimizes efficiency by repurposing the Key cache to serve as the Value cache. Using a gated re-parameterization trick, the Value is derived from the Key, effectively halving the KV cache footprint compared to standard MFA with negligible performance loss.
Unlike some previous low-rank methods, MFA is fully compatible with Rotary Positional Embeddings (RoPE), facilitating its integration into standard Transformer pipelines.
Experimental Setup
The architecture was evaluated using:
- Pre-training: A 1-trillion token corpus comprising high-quality web text, mathematics, and code.
- Benchmarks: Standard LLM evaluations including MMLU (general knowledge), Hellaswag (commonsense), BBH (reasoning), GSM8K/Math (mathematics), and HumanEval/DS-1000 (coding).
- Ablation Studies: Conducted on 1B-scale models to isolate the impact of specific architectural choices.
Key Insights
- Total Effective Rank (TER): Model capacity is viewed as a function of TER—the product of the number of heads and the rank per head. MFA scales both factors efficiently, whereas prior methods typically sacrificed one for the other.
- Efficient Head Scaling: In MFA, adding an attention head only incurs a small parameter cost ($\approx CH$) and zero additional KV cache, enabling a high degree of multi-head parallelism.
- Unified Bilinear Perspective: The paper frames attention variants as low-rank approximations of "Fully Parameterized Bilinear Attention" (FPBA). MFA is mathematically closer to this theoretical upper bound than MQA or MLA.
Key Results
Experiments on a 7B-parameter Mixture-of-Experts (MoE) model demonstrated that MFA can outperform standard Multi-Head Attention (MHA) while drastically reducing memory usage.
- Performance & Memory: MFA achieved an average benchmark accuracy of 49.9% (vs. 49.0% for MHA) while reducing the KV cache per token by 87.5% (from 196.6KB to 24.6KB).
- Extreme Efficiency: MFA-KR reduced the cache by 93.7% (to 12.3KB) while maintaining a respectable 48.0% accuracy.
- Pareto Dominance: As shown in Figure 1, MFA consistently defines the Pareto frontier for the accuracy-memory trade-off, providing superior performance for any given KV cache budget compared to GQA, MQA, and MLA.
Limitations and Future Work
While MFA shows significant promise in memory capacity reduction, several areas remain for future exploration:
- Throughput Benchmarking: Detailed hardware-specific latency and throughput benchmarks are needed to quantify real-world speedups.
- Hybrid Techniques: Combining MFA with other methods like Cross-Layer Attention (CLA) could yield further gains.
- Frontier Scaling: Validation on models exceeding 70B parameters is necessary to confirm the architecture's benefits at the largest scales.
- Initialization: The sensitivity of low-rank architectures to weight initialization warrants further study to ensure robust training across all scales.
Summary updated