Abstract
Multi-Head Latent Attention (MLA), introduced in DeepSeek-V2, compresses key-value states into a low-rank latent vector, caching only this vector to reduce memory. In tensor parallelism (TP), however, attention heads are computed across multiple devices, and each device must load the full cache, eroding the advantage of MLA over Grouped Query Attention (GQA). We propose Tensor-Parallel Latent Attention (TPLA): a scheme that partitions both the latent representation and each head's input dimension across devices, performs attention independently per shard, and then combines results with an all-reduce. TPLA preserves the benefits of a compressed KV cache while unlocking TP efficiency. Unlike Grouped Latent Attention (GLA), every head in TPLA still leverages the full latent representation, maintaining stronger representational capacity. TPLA is drop-in compatible with models pre-trained using MLA: it supports MLA-style prefilling and enables efficient tensor-parallel decoding without retraining. Applying simple orthogonal transforms—e.g., the Hadamard transform or PCA—before TP slicing further mitigates cross-shard interference, yielding minimal accuracy degradation. By reducing the per-device KV cache for DeepSeek-V3 and Kimi-K2, we achieve 1.79x and 1.93x speedups, respectively, at a 32K-token context length while maintaining performance on commonsense and LongBench benchmarks. TPLA can be implemented with FlashAttention-3, enabling practical end-to-end acceleration.
Introduction
Large Language Models (LLMs) are increasingly memory-bound during inference. The primary bottleneck is often the Key-Value (KV) cache, which grows with context length and limits throughput. DeepSeek's Multi-Head Latent Attention (MLA) addressed this by compressing the KV cache into a low-rank latent vector. However, a critical efficiency gap emerges when scaling MLA with Tensor Parallelism (TP).
In standard TP implementations of MLA, every device must load the entire latent vector to compute its assigned attention heads. This replication erodes the memory savings of MLA, particularly at high degrees of parallelism, making it less efficient than Grouped Query Attention (GQA). Existing solutions like Grouped Latent Attention (GLA) attempt to shard the cache but sacrifice representational power by restricting heads to specific shards. TPLA (Tensor Parallel Latent Attention) is proposed as a "best-of-both-worlds" solution: it shards the latent representation for memory efficiency while using communication primitives to ensure every head retains access to the full latent information.
Methods
TPLA introduces a novel sharding strategy designed for the decoding stage of inference, where memory bandwidth is the primary constraint.
Latent Sharding and All-Reduce
Instead of replicating the latent vector $\hat{c}^{KV}$ across all GPUs, TPLA partitions the vector and the attention head dimensions across devices. Each device performs attention locally on its shard. To ensure the model's representational capacity is preserved, the partial results are combined using an All-Reduce operation. This allows every attention head to conceptually benefit from the full latent representation without requiring the full cache to be stored on every device.
Mathematical Reparameterization
Slicing non-linear operations like RMSNorm and Softmax across shards typically introduces approximation errors. TPLA mitigates this through orthogonal transformations applied to the weights. Specifically, the authors utilize Principal Component Analysis (PCA) or Hadamard transforms to balance information density across shards. PCA, for instance, concentrates the most critical features into specific dimensions, ensuring that even when the data is split, the most vital information is preserved, minimizing the degradation of the Softmax approximation.
Prefill-Decode Separation
TPLA recognizes the distinct computational profiles of inference stages. The prefill stage (processing the prompt) is compute-bound, while the decode stage (generating tokens) is memory-bound. TPLA is employed exclusively during decoding to maximize throughput, while standard MLA is used during prefill to maintain maximum accuracy and minimize Time to First Token (TTFT).
Evaluation and Results
The effectiveness of TPLA was evaluated using state-of-the-art models including DeepSeek-V3 and Kimi-K2-Base across a variety of benchmarks:
- Performance Benchmarks: Commonsense reasoning (MMLU, ARC, PIQA) and long-context understanding (LongBench).
- Efficiency Metrics: Throughput and speedup at context lengths up to 32K tokens.
Key Results
- Throughput Gains: TPLA achieved significant end-to-end speedups. At a 32K token context length, it delivered a 1.79x speedup for DeepSeek-V3 and a 1.93x speedup for Kimi-K2 compared to standard MLA implementations.
- Accuracy Preservation: Despite the sharding of non-linear operations, the accuracy loss was minimal. On DeepSeek-V3, the average LongBench score only shifted from 58.19 to 56.04, demonstrating the robustness of the PCA-based reparameterization.
- Drop-in Compatibility: A major advantage of TPLA is that it requires no retraining. It can be applied to existing MLA-based models as a post-training inference optimization.
Conclusion
TPLA provides a scalable path for Multi-Head Latent Attention in multi-GPU environments. By combining latent sharding with clever mathematical transforms and disaggregated prefill-decode logic, it resolves the memory bottleneck inherent in standard TP-MLA. Future work will explore scaling TPLA to higher shard counts ($g > 2$) and investigating the potential of pre-training models specifically optimized for TPLA's architecture to further close the accuracy gap.
Summary updated