Leyline: KV Cache Directives for Agentic Inference
On the map: LLM agents and tool use → Software engineering coding agents
Abstract (arXiv)
Modern KV cache management assumes the chatbot workload: prompts arrive once and the cache grows append-only, so prefix caching and forward-only eviction are correct by construction. Agentic LLMs break this assumption. Their conversations evolve through policy-driven editing: failed tool calls are retried, stale outputs dropped, trajectories pivoted. Two distinct cache problems result. First, identical content moves to new positions between turns, invalidating exact-prefix caches even though the underlying KV would still be valid; recent work on position-independent caching for MLA addresses this reuse problem. Second, and this paper's focus, a policy may need to direct the serving system to actively remove or replace a span of cached content and continue without re-prefilling everything that came after. No existing primitive offers this. Production agentic harnesses fall back to re-prefill on every edit, paying full prefix-recomputation cost; kernel-level eviction methods make their own decisions and cannot accept policy directives from outside the kernel. We introduce Leyline, a serving-side primitive that closes this gap. A declarative directive 4-tuple separates what to edit from how to preserve position correctness. The policy declares the edit and its mode (in-place splice or prefix-trimmed re-prefill for semantic forgetting); an architecture-agnostic interface routes to a per-architecture kernel that restores attention math via a closed-form RoPE-rotation correction. The splice kernel lifts replay cache-hit by +11.2 pp and cuts latency by up to 241 ms. A ten-line truncation rule routed through the same interface lifts agentic solve rate by +14.3 pp on debug-gym. The mechanism is open; the policy space it enables is the agenda.
Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). Placed in Software engineering coding agents, one of 16 directions in LLM agents and tool use. Builds on 25 of its 40 references that are in the map. First posted on arXiv 31 May 2026.
Builds on
25 of 40 references.
Closest ancestors · 5
Same direction, newest first
- 2026Irminsul: MLA-Native Position-Independent Caching for Agentic LLM Serving7 May
- 2026SideQuest: Model-Driven KV Cache Management for Long-Horizon Agentic Reasoning26 Feb
- 2025Optimizing Agentic Language Model Inference via Speculative Tool Calls17 Dec
- 2025debug-gym: A Text-Based Environment for Interactive Debugging27 Mar
- 2024SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering6 May
Other references · 20
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,767
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,115
- 2023Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflectioncited by 1,800
- 2023GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpointscited by 1,311
- 2023SGLang: Efficient Execution of Structured Language Model Programscited by 1,107
- 2024ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Toolscited by 1,096
- 2024DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Modelcited by 1,093
- 2024SnapKV: LLM Knows What You are Looking for Before Generationcited by 848
- 2024KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cachecited by 604
- 2023Model Tells You What to Discard: Adaptive KV Cache Compression for LLMscited by 466
8 more
- 2023Scissorhands: Exploiting the Persistence of Importance Hypothesis for LLM KV Cache Compression at Test Timecited by 428
- 2023CacheGen: KV Cache Compression and Streaming for Fast Large Language Model Servingcited by 199
- 2025LMCache: An Efficient KV Cache Layer for Enterprise-Scale LLM Inferencecited by 119
- 2024MemServe: Context Caching for Disaggregated LLM Serving with Elastic Memory Poolcited by 67
- 2024Compute Or Load KV Cache? Why Not Both?cited by 25
- 2025Shared Disk KV Cache Management for Efficient Multi-Instance Inference in RAG-Powered LLMscited by 3
- 2026LoopGuard: Breaking Self-Reinforcing Attention Loops via Dynamic KV Cache Interventioncited by 2
- 2026JoyAI-LLM Flash: Advancing Mid-Scale LLMs with Token Efficiencycited by 1
Built on by
Citing papers per year: 2026: 5.
5 papers.
- 2026Compute Globally, Materialize Locally: The Memory Contract of Sparse Event-KVcited by 1
- 2026Aborted but Not Forgotten: KV-Cache Retention Breaks Rollback Consistency in Language Agentscited by 0
- 2026REVISE: Validity-Guided Recovery for Online Revisions in Agent Workflowscited by 0
- 2026Contiguity, Not Importance: Budgeted Repair of Stale KV Caches After Document Editscited by 0
- 2026StepKV: Step-Aware KV Cache Compression for LLM Agentscited by 0
- 2026Contiguity, Not Importance: Budgeted Repair of Stale KV Caches After Document Edits16 Sep 2026
- 2026REVISE: Validity-Guided Recovery for Online Revisions in Agent Workflows1 Sep 2026
- 2026StepKV: Step-Aware KV Cache Compression for LLM Agents26 Aug 2026
- 2026Aborted but Not Forgotten: KV-Cache Retention Breaks Rollback Consistency in Language Agents16 Aug 2026
- 2026Compute Globally, Materialize Locally: The Memory Contract of Sparse Event-KV26 Jul 2026
Similar, not cited
Close in wording, no citation either way
- 2026AgentKV: Phase-Aware KV Eviction for Agentic LLMs
- 2026MemDecay: Region-Aware KV Cache Eviction for Efficient LLM Agent Inference
- 2025Agentic Plan Caching: Test-Time Memory for Fast and Cost-Efficient LLM Agents
- 2025KVFlow: Efficient Prefix Caching for Accelerating LLM-Based Multi-Agent Workflows
- 2026ReCache: Efficient KV Cache Reuse and Compression for Tool-Augmented LLM Agents
- 2026Learning Agent Execution for KV-Cache Management in Agentic Serving
- 2026AgentKVShift: Efficient KV Cache Reuse for Agentic Memory Systems
- 2026Request Order Matters: Cache-History Sensitivity in Selective KV-Cache Reuse for Rolling Agents