arXiv:2610.29544cs.DCOct 2026

Manuscript Offprint

arXiv:2610.29544

RISK-KV: Quality-Aware Selective KV Cache Reconstruction for Distributed LLM Inference

Wang Yuekai

Wang Yuekai 1^{1}

1^{1}Harbin Institute of Technology

Email: york.wang.ict@gmail.com

Abstract—Request migration and interruption recovery in distributed large language model (LLM) inference rely on historical key-value (KV) caches. Retaining or transferring a complete cache incurs substantial state overhead, whereas replaying historical tokens requires additional computation. This paper proposes RISK-KV, a quality-aware method for selective historical KV reconstruction in pretrained models. RISK-KV uses exact KV states on both sides of a target layer and cross-layer ridge regression to predict the missing layer's attention-projection input; it then folds in the original model's KV projection matrices to reduce predictor storage. Reconstruction risk is measured by the change in negative log-likelihood (NLL) caused by actual reconstruction, and low-overhead topology search with quality gating selects the layer groups to reconstruct. Independent tests on three language models show that representative recovery configurations omit 18.2%–33.3% of historical KV, with perplexity changes below 0.5%. In a local request-recovery experiment with a 512-token history, RISK-KV achieves a 1.51–3.31× speedup over full Token Replay. These results indicate that selective KV reconstruction can reduce historical-cache overhead with small changes in predictive quality and improve request-recovery efficiency under the evaluated deployment conditions.

Keywords—KV cache, LLM inference, cache reconstruction, grouped-query attention, state migration, Transformer

I. INTRODUCTION

Large language models (LLMs) are increasingly deployed in distributed and edge-computing environments to support interactive and context-intensive applications. Autoregressive inference relies on a key-value (KV) cache to store the attention states of historical tokens and avoid redundant computation during subsequent decoding. However, KV-cache size grows with context length, model depth, and the number of concurrent requests, resulting in substantial memory and data-movement costs. vLLM demonstrates the importance of efficient KV management for LLM serving, while grouped-query attention (GQA) reduces cache size by sharing key/value heads [1, 2]. In distributed inference, request migration and interruption recovery also involve transferring and reloading historical states. DistServe and Splitwise illustrate the potential of organizing inference computation across devices and highlight the effect of state management on system efficiency [3, 4]. In bandwidth-constrained edge environments, transferring the complete historical KV cache can be costly; discarding it instead requires recomputing the historical prefix, which also increases recovery latency.

Existing research reduces KV-cache overhead from several directions. H2OH_{2}O and SnapKV use attention features to select historical tokens for retention, while KVQuant reduces cache storage through low-precision representations [5–7]. Another line of work exploits redundancy across Transformer layers: MiniCache compresses the cache by merging states across layers, whereas YOCO reuses KV states through its architectural design [8, 9]. For state transfer and recovery, CacheGen studies KV compression and streaming, while HCache uses intermediate activations to restore state and balance computation against I/O costs [10, 11]. Krul dynamically selects cross-layer KV-sharing strategies based on attention similarity between layers; EdgeFlow studies KV migration and recovery in geographically distributed edge environments [12, 13]. These works show that exploiting cache redundancy and balancing storage, communication, and computation are important ways to improve inference efficiency.

A key question remains for reconstructing omitted historical KV without modifying a pretrained model: which layers are suitable for reconstruction, and which must retain exact KV to reduce cache overhead while controlling degradation in predictive quality? Existing methods typically make selection decisions using signals such as attention importance, tensor similarity, numerical reconstruction error, or recovery cost, but these signals do not necessarily reflect how reconstructed KV affects language-model predictions [5, 6, 8, 10, 11, 14]. Large numerical errors in KV may cause only a small increase in predictive loss; conversely, reconstruction errors in sensitive layers may propagate through subsequent Transformer layers and substantially change model outputs. Moreover, the effect of reconstructing several layer groups together need not equal the sum of their individual reconstruction losses. Therefore, maximizing the number of omitted layers alone may lead to an unfavorable trade-off between cache savings and model quality.

A key observation is that actual KV-reconstruction risk varies substantially across models and layers. With the remaining layers' KV kept exact, historical KV is replaced one layer at a time, and model degradation is measured by the change in negative log-likelihood (NLL) under teacher-forced inference. For example, on TinyLlama-1.1B, reconstructing L2 alone increases mean NLL by only about 0.00010, whereas reconstructing the adjacent layer L3 increases it by about 0.09336. Qwen2.5-0.5B also exhibits a marked risk difference between adjacent

Figure

Fig. 1. GQA attention module and cross-layer KV reconstruction in RISK-KV. The left side shows normalization, Q/K/V projections, RoPE, and the attention residual connection. The right side illustrates reconstruction of a target layer's historical keys and values from exact KV anchors on both sides. In the online implementation, hidden-representation prediction and KV projection are folded into an equivalent mapping.

layers. Further experiments show that even when artificial Gaussian perturbations are matched in magnitude to actual reconstruction errors, the resulting rankings of layer sensitivity can differ. This indicates that recovery strategies should be calibrated to the target model and the specific reconstruction mechanism, rather than determined solely by layer position, reconstruction error, or generic perturbation sensitivity.

Based on these observations, this paper introduces RISK-KV, a quality-aware framework for selective historical KV reconstruction in distributed LLM inference. As illustrated in Fig. 1, in a Transformer with grouped-query attention (GQA), historical KV is obtained by applying the key and value projections to attention-normalized hidden representations, with rotary positional embedding (RoPE) additionally applied to keys. RISK-KV uses exact historical KV retained on both sides of a target layer as cross-layer anchors. A lightweight ridge regressor predicts the target layer's normalized attention input, and the frozen key and value projection matrices of the original model generate the missing cache. Because both the predicted mapping and KV projections are affine transformations, they can be algebraically folded so that the online stage generates reconstructed KV directly from the anchor states, reducing additional parameter storage and intermediate-representation computation. This process neither modifies pretrained-model parameters nor requires storing complete historical hidden states.

To identify layer groups suitable for reconstruction, RISK-KV defines functional risk as the mean NLL change caused by replacing actual KV. The system first measures the independent recovery risk of each candidate group and ranks the groups accordingly. It then progressively forms joint recovery configurations along this ranking and remeasures the actual predictive loss for each configuration, rather than simply summing the individual group risks. For G candidate groups, the method evaluates only 2G distinct recovery configurations, compared with 2G2^{G} for exhaustive search. RISK-KV also uses a conservative quality gate based on bootstrap confidence bounds to select a configuration that satisfies the empirical quality budget while saving substantial historical KV, falling back to exact KV when necessary. Because the search is restricted to a single ordered path, it does not guarantee a global optimum, but it reduces offline configuration-evaluation cost.

RISK-KV is evaluated on three pretrained models: Qwen2.5-0.5B-Instruct, Qwen2.5-1.5B-Instruct, and TinyLlama-1.1B-Chat-v1.0. On independent test data, representative recovery configurations omit 18.2%–33.3% of historical KV, with changes in perplexity relative to the full exact-KV baseline below 0.5%. The quality-gating experiments further show that more conservative selection can reduce observed budget violations in independent evaluations, typically at the cost of some cache savings. In local request-recovery experiments with a 512-token history, RISK-KV achieves a 1.51–3.31× speedup over full historical Token Replay. The current latency experiments do not cover real wireless cross-node migration, and the complete KV cache is still materialized during subsequent decoding.

Contributions.: This paper makes the following contributions:

  1. A method is proposed for reconstructing historical KV caches from cross-layer information. To address the loss or unavailability of some historical KV states during request recovery in distributed LLM inference, the method uses real KV retained in other layers to reconstruct missing keys and values in target layers. It requires neither changes to pretrained-model parameters nor storage of complete historical hidden states or recomputation of the entire historical prefix. By folding the model's KV projection matrices into the predictor, it reduces additional reconstruction storage and provides an implementation path for reducing persistent storage and transfer of historical KV.

  2. A functional-risk assessment and adaptive selection method is proposed for KV reconstruction across models and layers. The results show substantial variation in the tolerance of different models and Transformer layers to historical KV-reconstruction errors; KV numerical error or random-perturbation sensitivity alone cannot reliably identify suitable layers. Accordingly, the increase in language-model NLL caused by actual KV reconstruction is used as a measure of model-degradation risk. A small number of singleton recovery experiments assess candidate-layer risks, and low-overhead topology search under a quality constraint, together with conservative quality gating, automatically determines which historical KV states require exact preservation and which can be reconstructed, enabling a controlled trade-off between predictive quality and cache savings.