[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-85630-en":3,"doc-seo-85630-105":29,"detail-sidebar-cat-0-en-105":91},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":20,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":13,"seo_description":14,"update_tm":27,"read_time":28},85630,4810365810221,"Aurora","https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d",8,"Research & Report","KVEraser: Learning to Steer KV Cache for Efficient Localized Context Erasing","Post-hoc context erasing on KV cache is difficult because editing a short span has global effects: once processed, its influence propagates through cached states of all later tokens, so exact deletion requires recomputation across the entire impacted suffix. KVEraser introduces a learned KV-cache editing approach that replaces only the KV states within the erased interval using steering states, reusing the remaining cache unchanged. A two-stage training pipeline enables transferable erasing, improving latency while nearly matching full recomputation and generalizing to long QA with harmful distractors.","arXiv :2606 . 17034v2 [ cs .CL] 12 Jul 2026  \nKVEraser: Learning to Steer KV Cache for Efficient Localized Context Erasing  \nMufei Li 1 , Shikun Liu 1 , Dongqi Fu2 , Haoyu Wang 1 , Yinglong Xia2 , Hong Li2 , Hong Yan2 , Pan Li 1  \n1 Georgia Institute of Technology, 2 Meta  \nPost-hoc context erasing over the KV cache is challenging because a local edit has a global consequence: once a span has been processed, its influence propagates into the cached states of all subsequent tokens. This issue arises naturally in long-context LLM applications, where stale retrieved facts, incorrect tool observations, retracted user preferences, or harmful prompt injections may be identified only after prefill. Exact erasing must then recompute all tokens after the deleted span, making its computational cost depend on suffix length rather than erased-span length. We introduce KVEraser, a learned KV-cache editing method for efficient localized context erasing. Given a processed context anda span to remove, KVEraser replaces only the KV states of the erased interval with learned steering states while reusing the remaining cache unchanged. To learn a transferable erasing mechanism, we build a two-stage training pipeline: generic span-neighbor pre-training teaches the eraser to suppress the influence of the erased span, while task-specific fine-tuning adapts this capability to downstream scenarios. Experiments show that KVEraser nearly matches full recomputation in post-erasure performance on in-domain tasks across 1K–32K context lengths, while its latency increases by only 24% compared with a 17 .6 × increase for full recomputation. KVEraser also generalizes to unseen long-document QA tasks with harmful factual distractors, achieving the best performance among approximate baselines with a 3–4 × speedup over full recomputation. Our implementation is available at [https://github.com/Graph-COM/KVEraser](https://github.com/Graph-COM/KVEraser).  \nDate: July 14, 2026  \n[Correspondence:](Correspondence: mufei.li@gatech.edu)[ mufei.li@gatech.edu](Correspondence: mufei.li@gatech.edu), [panli@gatech.edu](panli@gatech.edu)  \n1 Introduction  \nKey-Value (KV) caching is a central optimization for efficient inference in large language models (LLMs) . After context processing, the cached keys and values allow each subsequent token to attend to the previous context without recomputing its internal states. Modern serving systems therefore rely heavily on KV-cache management to reduce latency and improve throughput (Kwon et al. , 2023 ; Zheng et al. , 2024) .  \nIn many long-context applications, the context processed by an LLM is not a static prompt, but a working context assembled online from retrieved documents, tool observations, code snippets, execution logs, and conversational memory (Lewis et al. , 2020 ; Schick et al. , 2023 ; Yao et al. , 2023) . A RAG system may prefill retrieved passages before discovering an out-of-date fact; a tool-augmented assistant may cache an observation before realizing that it contains an incorrect result from a stale tool call; a long-running agent may continue from a cached context before detecting adversarial instructions in an imported skill file (Shi et al. , 2023 ; Xie et al. , 2024 ; Sun et al. , 2024 ; Greshake et al. , 2023 ; Schmotz et al. , 2025) . As illustrated in Fig. 1 , a user may also retract an earlier preference after the dialogue context has already been processed. In all these cases, a short problematic span is identified only after prefill, when the long context has already been written into the KV cache and can influence future decoding. Such stale, incorrect, or harmful context can lead to incorrect answers, failed actions, or unsafe behavior. The desired inference-time operation is therefore context erasing: given a processed context and a span to delete, make future decoding behave as if that span had never appeared.  \nThe difficulty of context erasing is rooted in a strict validity condition of KV reuse. E","cbCaikYBQIF6rZ7Z","https://ap.wps.com/l/cbCaikYBQIF6rZ7Z","pdf",1414358,1,16,"English","en",105,"# Introduction\n## Problem: post-hoc context erasing over KV cache\n## Proposed method: KVEraser\n## Training pipeline\n## Experimental results and generalization","[{\"question\":\"Why is post-hoc context erasing over KV cache computationally hard?\",\"answer\":\"Because once a span has been processed, its influence propagates into cached states of all subsequent tokens. Exact erasing therefore requires recomputing the entire impacted suffix rather than only the erased span.\"},{\"question\":\"How does KVEraser achieve efficient localized context erasing?\",\"answer\":\"Given a processed context and a span to remove, KVEraser replaces only the KV states of the erased interval with learned steering states while keeping the remaining cached states unchanged.\"},{\"question\":\"What performance and efficiency results does KVEraser report?\",\"answer\":\"On in-domain tasks across 1K–32K context lengths, KVEraser nearly matches full recomputation after erasure while increasing latency by only 24% versus a 17.6× increase for full recomputation, and it achieves a 3–4× speedup on long-document QA with harmful distractors.\"}]",1784205093,40,{"code":4,"msg":30,"data":31},"ok",{"site_id":24,"language":23,"slug":32,"title":13,"keywords":33,"description":14,"schema_data":34,"social_meta":86,"head_meta":88,"extra_data":90,"updated_unix":27},"kveraser-learning-to-steer-kv-cache-for-efficient-localized-context-erasing","",{"@graph":35,"@context":85},[36,53,68],{"@type":37,"itemListElement":38},"BreadcrumbList",[39,43,47,50],{"item":40,"name":41,"@type":42,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":44,"name":45,"@type":42,"position":46},"https://docshare.wps.com/document/","Document",2,{"item":48,"name":12,"@type":42,"position":49},"https://docshare.wps.com/document/research-report/",3,{"item":51,"name":13,"@type":42,"position":52},"https://docshare.wps.com/document/kveraser-learning-to-steer-kv-cache-for-efficient-localized-context-erasing/85630/",4,{"url":51,"name":13,"@type":54,"author":55,"headline":13,"publisher":57,"fileFormat":60,"inLanguage":23,"description":14,"dateModified":61,"datePublished":62,"encodingFormat":60,"isAccessibleForFree":63,"interactionStatistic":64},"DigitalDocument",{"name":9,"@type":56},"Person",{"url":40,"name":58,"@type":59},"DocShare","Organization","application/pdf","2026-07-17","2026-07-16",true,{"@type":65,"interactionType":66,"userInteractionCount":20},"InteractionCounter",{"@type":67},"ViewAction",{"@type":69,"mainEntity":70},"FAQPage",[71,77,81],{"name":72,"@type":73,"acceptedAnswer":74},"Why is post-hoc context erasing over KV cache computationally hard?","Question",{"text":75,"@type":76},"Because once a span has been processed, its influence propagates into cached states of all subsequent tokens. Exact erasing therefore requires recomputing the entire impacted suffix rather than only the erased span.","Answer",{"name":78,"@type":73,"acceptedAnswer":79},"How does KVEraser achieve efficient localized context erasing?",{"text":80,"@type":76},"Given a processed context and a span to remove, KVEraser replaces only the KV states of the erased interval with learned steering states while keeping the remaining cached states unchanged.",{"name":82,"@type":73,"acceptedAnswer":83},"What performance and efficiency results does KVEraser report?",{"text":84,"@type":76},"On in-domain tasks across 1K–32K context lengths, KVEraser nearly matches full recomputation after erasure while increasing latency by only 24% versus a 17.6× increase for full recomputation, and it achieves a 3–4× speedup on long-document QA with harmful distractors.","https://schema.org",{"og:url":51,"og:type":87,"og:title":13,"og:site_name":58,"og:description":14},"article",{"robots":89,"canonical":51},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":92},[93,97,101,105,110,115,119,122,127,130,134],{"id":20,"doc_module":4,"doc_module_name":45,"category_name":94,"show_sort_weight":95,"slug":96},"Story & Novel",90,"story-novel",{"id":46,"doc_module":4,"doc_module_name":45,"category_name":98,"show_sort_weight":99,"slug":100},"Literature",80,"literature",{"id":52,"doc_module":4,"doc_module_name":45,"category_name":102,"show_sort_weight":103,"slug":104},"Exam",70,"exam",{"id":106,"doc_module":4,"doc_module_name":45,"category_name":107,"show_sort_weight":108,"slug":109},5,"Comic",60,"comic",{"id":111,"doc_module":4,"doc_module_name":45,"category_name":112,"show_sort_weight":113,"slug":114},6,"Technology",50,"technology",{"id":116,"doc_module":4,"doc_module_name":45,"category_name":117,"show_sort_weight":28,"slug":118},7,"Healthcare","healthcare",{"id":11,"doc_module":4,"doc_module_name":45,"category_name":12,"show_sort_weight":120,"slug":121},30,"research-report",{"id":123,"doc_module":4,"doc_module_name":45,"category_name":124,"show_sort_weight":125,"slug":126},9,"Religion & Spirituality",20,"religion-spirituality",{"id":125,"doc_module":4,"doc_module_name":45,"category_name":128,"show_sort_weight":125,"slug":129},"World Cup","world-cup",{"id":131,"doc_module":4,"doc_module_name":45,"category_name":132,"show_sort_weight":131,"slug":133},10,"Lifestyle","lifestyle",{"id":135,"doc_module":4,"doc_module_name":45,"category_name":136,"show_sort_weight":106,"slug":137},19,"General","general"]