Skip to content

KVEraser: Learning to modulate KV cache for efficient local context erasureKVEraser: Learning to Steer KV Cache for Efficient Localized Context Erasing

arXiv· arXiv:2606.17034· Mufei Li, Shikun Liu, Dongqi Fu, Haoyu Wang, Yinglong Xia, Hong Li, Hong Yan, Pan LiGeorgia Institute of Technology; MetaIndexed by this site · 20 days ago· Originally publishedDefenses

Translation in progress — untranslated text is omitted.

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

AI summaryThe researchers propose KVEraser, a KV cache editing method for long-context large language models that replaces the KV states of the erased span with learned steering states while keeping the rest of the cache unchanged, so that after prefill, clearing outdated, erroneous, or harmful context requires no recomputation of all subsequent tokens. Training uses a two-stage pipeline: first general span-neighborhood pretraining, then task-specific fine-tuning. On in-domain tasks with 1K-32K context, KVEraser's post-erasure performance is close to full recomputation, with latency increasing by only 29.6%, whereas full recomputation increases latency by a factor of 17.6. The method also generalizes to unseen long-document question answering with harmful-fact interference and to tool-selection tasks with malicious skill-file injection, performing best among approximate baselines and achieving 2.9-10.7x speedup over full recomputation. In addition, the rank-16 LoRA eraser trains only about 0.6% of the generator's parameter count, with effectiveness comparable to or better than full-parameter training.

Questions
In long-context applications, a segment of context (outdated facts, erroneous tool results, maliciously injected instructions) is only discovered to need deletion after prefill is complete; exact erasure requires recomputing the entire suffix, and the cost grows with suffix length.
Methods
KVEraser uses a LoRA eraser on a frozen backbone, conditioned on the retained prefix's KV and the deleted span, to generate equal-length steering KV states that replace the deleted span, while the rest of the cache is reused as-is; training has two stages: span-neighbor retrieval pretraining and task fine-tuning.
Experiments and results
On Qwen3-8B, NIAH 1K–32K exact match is 0.99–1.00, on par with full recompute, with latency increasing by only 29.6% (full recompute increases by 17.6×); on unseen QA and BFCL tool-selection datasets it has the highest exact match among approximate methods.
Limitations and future work
The authors note: it is assumed the span to be deleted has already been located; only a single contiguous span is studied; the goal is functional rather than exact cache equivalence; experiments only go up to 32K context. Evaluation uses only 8B-class models, and some evaluation sets have 100–344 samples.

Related papers

Show 3 more papers
Read originalarxiv.org