cs.DCAug 18, 2026

PatchKV: Efficient KV Cache Recovery for Dynamically Edited LLM Contexts

Authors: Guotao Yang, Rui Guo, Siwei He, Sheng Chen, Yitao Hu, Keqiu Li

Organizations: Tianjin University, China

Abstract

Long-running LLM agent workflows often revise interior context spans while retaining long suffixes. Although suffix tokens remain unchanged, altered causal histories and rotary positions prevent exact reuse of their offloaded key-value (KV) states. Full suffix recomputation wastes prefill work, while indiscriminate reuse propagates stale states and full-precision restoration adds data movement. We present PatchKV, a profile-guided recovery system for suffix-preserving revisions. PatchKV decomposes adjacent context versions into an exact prefix, an updated span, and an aligned suffix. It predicts an edit-local dirty region using an offline length-conditioned drift model, augments this region with sparse nonlocal blocks selected from stored attention, and block-rounds their union into a fixed repair set. The remaining suffix blocks are restored from CPU memory using frozen per-block precision tags and a fused path for dequantization, RoPE correction, and KV-page placement. Across three models and three long-context question-answering workloads, PatchKV achieves a 2.512.51-3.85×3.85\times speedup in mean resume time-to-first-token over full suffix recomputation and a 1.261.26-2.06×2.06\times speedup over CacheBlend, while matching or exceeding CacheBlend's F1 score in six of nine settings and remaining within 1.36 points in the others.

Figures & tables

Explore similar work

CardsList
  1. Budgeted KV-Cache Repair for Evolving Contexts

    Oct 12, 2026Han Yu, Wenhui Zhu, Jincheng Cao +15KV-Cache ManagementLLM Inference Acceleration

  2. KV Packet: Recomputation-Free Context-Independent KV Caching for LLMs

    Apr 14, 2026Chuangtao Chen, Grace Li Zhang, Xunzhao Yin +3KV CachingKV-Cache Reuse

  3. RelaxKV: Recomputation Guided by the Query with Sparse Context Attention for Efficient KV Cache Reuse

    Sep 27, 2026Ruoling Qi, Yirui Liu, Xuaner Wu +5Retrieval-Augmented GenerationKV-Cache Management