MPCache: MPC-Friendly KV Cache Eviction for Efficient Private LLM Inference

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Zeng, Wenxuan, Dong, Ye, Zhou, Jinjin, Tan, Jin, Wang, Lei, Wei, Tao, Wang, Runsheng, Li, Meng
Format: Preprint
Veröffentlicht: 2025
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866915560708636672
author Zeng, Wenxuan
Dong, Ye
Zhou, Jinjin
Tan, Jin
Wang, Lei
Wei, Tao
Wang, Runsheng
Li, Meng
author_facet Zeng, Wenxuan
Dong, Ye
Zhou, Jinjin
Tan, Jin
Wang, Lei
Wei, Tao
Wang, Runsheng
Li, Meng
contents Private large language model (LLM) inference based on secure multi-party computation (MPC) achieves formal data privacy protection but suffers from significant latency overhead, especially for long input sequences. While key-value (KV) cache eviction and sparse attention algorithms have been proposed for efficient LLM inference in plaintext, they are not designed for MPC and cannot benefit private LLM inference directly. In this paper, we propose an accurate and MPC-friendly KV cache eviction framework, dubbed MPCache, building on the observation that historical tokens in a long sequence may have different effects on the downstream decoding. Hence, MPCache combines a look-once static eviction algorithm to discard unimportant KV cache and a query-aware dynamic selection algorithm to activate only a small subset of KV cache for attention computation. MPCache further incorporates a series of optimizations for efficient dynamic KV cache selection, including MPC-friendly similarity approximation, hierarchical KV cache clustering, and cross-layer index-sharing strategy. Extensive experiments demonstrate that MPCache consistently outperforms prior-art KV cache eviction baselines across different generation tasks and achieves 1.8 ~ 2.01x and 3.39 ~ 8.37x decoding latency and communication reduction on different sequence lengths, respectively.
format Preprint
id arxiv_https___arxiv_org_abs_2501_06807
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle MPCache: MPC-Friendly KV Cache Eviction for Efficient Private LLM Inference
Zeng, Wenxuan
Dong, Ye
Zhou, Jinjin
Tan, Jin
Wang, Lei
Wei, Tao
Wang, Runsheng
Li, Meng
Cryptography and Security
Private large language model (LLM) inference based on secure multi-party computation (MPC) achieves formal data privacy protection but suffers from significant latency overhead, especially for long input sequences. While key-value (KV) cache eviction and sparse attention algorithms have been proposed for efficient LLM inference in plaintext, they are not designed for MPC and cannot benefit private LLM inference directly. In this paper, we propose an accurate and MPC-friendly KV cache eviction framework, dubbed MPCache, building on the observation that historical tokens in a long sequence may have different effects on the downstream decoding. Hence, MPCache combines a look-once static eviction algorithm to discard unimportant KV cache and a query-aware dynamic selection algorithm to activate only a small subset of KV cache for attention computation. MPCache further incorporates a series of optimizations for efficient dynamic KV cache selection, including MPC-friendly similarity approximation, hierarchical KV cache clustering, and cross-layer index-sharing strategy. Extensive experiments demonstrate that MPCache consistently outperforms prior-art KV cache eviction baselines across different generation tasks and achieves 1.8 ~ 2.01x and 3.39 ~ 8.37x decoding latency and communication reduction on different sequence lengths, respectively.
title MPCache: MPC-Friendly KV Cache Eviction for Efficient Private LLM Inference
topic Cryptography and Security
url https://arxiv.org/abs/2501.06807