Abstract
Secure Multi-Party Computation (MPC) enables private Large Language Model (LLM) inference by protecting both user prompts and model weights. However, the high communication overhead of MPC protocols makes private inference significantly slower than plaintext execution. While KV cache eviction is a standard technique to accelerate long-context LLMs, conventional eviction methods involve non-linear operations (e.g., top-k selection) that are prohibitively expensive in MPC. This leads to an "MPC Paradox" where standard efficiency optimizations actually increase latency. This paper introduces MPCache, a framework featuring MPC-friendly KV cache eviction. By combining look-once static eviction with query-aware dynamic selection using linearized similarity and cross-layer index sharing, MPCache reduces communication by up to 8x and latency by 2x without requiring model retraining.
Introduction: The MPC Paradox
As LLMs become ubiquitous, privacy has become a critical frontier. Secure Multi-Party Computation (MPC) offers a solution by allowing parties to compute results without seeing each other's private data. However, MPC is notoriously "chatty"; complex operations like calculating attention or ranking tokens require massive exchanges of encrypted data.
In standard "plaintext" models, KV cache eviction (discarding unimportant past tokens) is a common speedup. However, the operations required to choose which tokens to discard—such as top-k sorting and gathering—are more expensive in MPC than simply keeping all tokens. As illustrated in the figure above, the "Extra Cost" of these operations can outweigh the benefits, creating a paradox where efficiency tricks for standard models actually slow down private ones.
Methods: Designing for MPC Efficiency
MPCache is a hybrid eviction framework designed specifically to minimize this "MPC tax." It operates in two main stages:
1. Look-Once Static Eviction
During the initial "prefill" stage, the model identifies "Unimportant to All" (UIA) tokens—those that rarely receive attention across various contexts. These are pruned once, reducing the workload for every subsequent decoding step without the need for repeated expensive checks.
2. Query-Aware Dynamic Selection
For the remaining tokens, MPCache decides which are relevant to the current generation step using three optimizations:
- Hierarchical Clustering: Tokens are grouped into clusters, and the model evaluates the importance of the cluster rather than every individual token.
- Linearized Similarity Approximation: Standard similarity checks like Cosine Similarity are replaced with a mathematical upper bound of the dot product that is linearized, removing the need for costly non-linear operations on encrypted data.
- Cross-Layer Index Sharing: Observing that adjacent transformer layers often attend to the same tokens, MPCache calculates important indices for one layer and reuses them for the next, cutting selection overhead in half.
Key Results and Insights
MPCache demonstrates that privacy does not have to come at the cost of extreme latency. The researchers evaluated the framework across demanding long-context benchmarks including LongBench, XSUM, and Needle-in-a-Haystack using models like LLaMA-2 and LLaMA-3.1.
- Latency & Communication: MPCache achieved a 1.8x to 2.01x speedup in decoding latency and reduced data transfer by 3.39x to 8.37x compared to standard MPC baselines.
- Accuracy Preservation: Unlike many pruning methods, MPCache maintained performance comparable to a "Full Cache" model, even when retaining only 5-10% of the KV cache.
- Robust Sparsity: The study found that nearly 60% of tokens can be evicted statically during prefill, and less than 20% of remaining tokens typically contribute to the final result during decoding.
Conclusion
MPCache provides a "plug-and-play" solution for private LLM inference that requires no expensive retraining. By recognizing that algorithmic complexity in plaintext differs from complexity in MPC, the framework successfully navigates the MPC Paradox to deliver efficient, private, and high-quality model outputs. Future work may explore further dimensionality reduction and hardware-specific optimizations to push these gains even further.
Summary updated