Contexture: Runtime Context Eviction for High-Throughput Agent Serving

Colin Hong, Bryan Shan, Wei Siong Pang, Chengzhi Lu, Xu Guo, Nitin Shivaraman, Tao Luo, Esha Choukse, Kisson Lin, Dmitrii UstiugovarXiv 2026

TL;DR

LLM agents are notorious memory hogs because they carry around massive execution histories that clog up a GPU’s limited "short-term memory" (the KV cache). Contexture is a smart, runtime-level garbage collector that identifies redundant information—like an old file read that’s been superseded by a newer edit—and evicts it only when the GPU is actually feeling the squeeze. By bridging the gap between what the agent is doing and how the GPU is feeling, it boosts serving throughput by up to 73% without making the agents any dumber.

What Problem Does This Paper Address?

When you use an LLM agent (like a coding assistant), it doesn't just send one prompt. It operates in "rounds": it thinks, calls a tool (like reading a file), gets an output, and then sends the entire history back to the model for the next step. As the task goes on, this history balloons.

In a professional serving environment, multiple agent sessions share the same GPU. The GPU stores the "Key-Value (KV) cache"—essentially the processed version of the conversation history—in its high-bandwidth memory (HBM). As shown in the agentic serving stack (Figure 1), this memory is finite.

Figure 1: The agentic serving stack.

The authors identify a "KV capacity bottleneck." Once the memory pool is full, the system starts preempting (pausing) sessions and recomputing their caches later. This leads to a death spiral where the GPU spends more time re-calculating old thoughts than generating new ones. Existing solutions either summarize history (which is slow and can lose vital details) or prune tokens based on "importance" (which ignores whether the GPU actually needs more space right now).

Methods

Contexture introduces a "harness-agnostic" architecture that lives inside the serving runtime (like vLLM). It works through three main components:

  1. Session Tracker: It watches the "tool calls" (like shell commands or file reads). It uses a concept called supersession: if an agent reads app.py in round 1, but then edits and reads it again in round 5, that first observation is now redundant. The tracker identifies these "removal candidates" automatically without needing extra LLM calls.
  2. Policy Actuator: This is the brain. It looks at the global state of the GPU memory. It won't evict context just because it's old; it waits until the memory pool is under pressure (e.g., >80% full). It also calculates a "cost-benefit" analysis: will evicting this span save enough memory to justify the "re-prefill" (the compute cost of re-processing the remaining history)?
  3. Context Filter: When a request is sent to the model, this filter snips out the committed redundant spans from the prompt. Crucially, the agent's "harness" still sees the full history, but the "model" gets a lean, mean version of it.

The system also uses a Grace Window (defaulting to 2 rounds), ensuring that very recent information isn't deleted before the agent has a chance to act on it.

Datasets

The authors evaluated Contexture using two long-horizon agent benchmarks that simulate real-world complexity:

  • Terminal-Bench 2.1: A benchmark for agents performing realistic tasks in command-line interfaces.
  • SWE-Atlas-QnA: A dataset focused on software engineering tasks.

They tested these across two different agent frameworks (Hermes and OpenClaw) and two powerful models (Qwen3.8-27B and the mixture-of-experts Qwen3.6-35B-A3B).

Key Insights and Ideas

  • The 64% Rule: By tracing tokens back to tool operations, the authors found that a staggering 64% of tokens in final session histories are actually redundant removal candidates. This is the "aha!" moment: we are wasting a massive amount of expensive GPU memory on "stale" observations.
  • Global vs. Local Visibility: You can't make a good eviction decision by looking at one session in a vacuum. Contexture succeeds because it knows both the semantic value of the tokens (from the tool calls) and the physical state of the GPU (from the runtime).
  • The Re-Prefill Trap: Deleting a middle chunk of a conversation history invalidates the cache for everything that comes after it. Contexture is smart enough to perform "cold commits"—evicting context only when the cache would have to be recomputed anyway—to minimize wasted cycles.

Key Results

  • Throughput: Contexture improved throughput under Service Level Objectives (SLO) by 20–73% compared to the best existing baselines (like standard compaction or AgentDiet).
  • Energy Efficiency: It reduced GPU energy consumption per completed session by up to 11%. Even though it occasionally forces the GPU to re-process some text, the overall efficiency gain from not having to pause and restart sessions is a net win.
  • Accuracy: Unlike "observation masking" (which aggressively hides old data and can tank accuracy by up to 28 points), Contexture maintained high task accuracy, even showing a slight mean improvement (1.4 points) because it keeps the model focused on relevant, non-redundant context.

Limitations and Future Work

  • Tool Scope: The current prototype primarily handles file-system and sandbox tools. It doesn't yet have specific "supersession" rules for external web APIs or more complex multi-agent communication protocols.
  • Structured Output Dependency: The system relies on being able to parse tool calls and outputs. If an agent uses a highly non-standard or unstructured way of calling tools, the Session Tracker might struggle to identify what has been superseded.
  • Future Directions: The authors suggest integrating this with even more advanced KV management techniques, like KV offloading to host memory, to further push the boundaries of how many agents we can pack onto a single GPU.

Summary updated

Abstract

LLM agents such as Hermes, OpenClaw, and Codex repeatedly resend growing execution histories, increasing shared GPU key-value (KV) cache demand in high-bandwidth memory (HBM). We show that shared KV capacity limits agent-serving throughput. Existing context-reduction methods lack global cache-state visibility, while runtime KV managers lack tool-execution information. Tracing tokens to their originating tool operations reveals that later operations supersede earlier outputs and associated turns, identifying 64% of recorded final-history tokens as removal candidates. We present Contexture, a harness- and model-agnostic architecture for runtime context eviction. Contexture separates the harness's full conversation history from the model's execution context, reducing subsequent requests' KV demand without modifying harness logic or model execution. It combines tool-execution information with global visibility into shared KV pressure and prefix residency: supersession identifies removal candidates, while runtime state determines when removal justifies sacrificing cached computation. This coordination reduces memory demand and decode KV traffic while limiting re-prefill interference with concurrent decoding, without additional model calls or training. Across two models, two harnesses, and two benchmarks, Contexture improves throughput under SLO by 20-73% over the best of no eviction, harness compaction, AgentDiet, and Continuum, and by 7-63% over observation masking in five of eight configurations, and reduces GPU energy per completed session by up to 11%. It also raises throughput under SLO by 23% over LMCache alone on H100. Live-agent experiments show a mean accuracy improvement of 1.4 percentage points over unloaded no eviction, with a worst-case loss of 3.7 points, while observation masking loses 3-28 points.
BibTeX
@misc{hong2026contexture,
  author = {Colin Hong and Bryan Shan and Wei Siong Pang and Chengzhi Lu and Xu Guo and Nitin Shivaraman and Tao Luo and Esha Choukse and Kisson Lin and Dmitrii Ustiugov},
  title = {{Contexture: Runtime Context Eviction for High-Throughput Agent Serving}},
  year = {2026},
  eprint = {2611.26980},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.26980},
}
Figure