NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Continuous Context Management

William Hoy, Jingxuan Fan, Nurcin Celik, Xu PanarXiv 2026

TL;DR

Continuous Context Management (CCM) is a new paradigm for long-horizon LLM agents that replaces the ever-growing interaction history with a compact, self-managed memory updated at every turn. By combining this approach with a novel training recipe—GRPO paired with privileged full-history distillation—the authors demonstrate that agents can maintain high task success while reducing cumulative input token usage by over 80%.

What Problem Does This Paper Address?

As LLM agents tackle increasingly complex, multi-step tasks (like shopping online or managing a Linux terminal), their "active prompt" grows longer with every interaction. This leads to several critical issues:

  1. Performance Degradation: LLMs often struggle to find relevant information in massive contexts (the "lost in the middle" effect).
  2. Resource Constraints: Long contexts consume significant GPU memory (KV cache), making it difficult to run large models on consumer-grade hardware.
  3. Cost: More tokens generally mean higher API bills.

While "periodic compaction" (summarizing history every few turns) exists, the context still balloons between compaction events. This paper explores the logical extreme: Continuous Context Management, where memory management becomes a core part of every single action step.

Methods

The authors propose a two-part solution involving a new inference flow and a specialized training objective.

1. CCM Inference Flow

In a standard agent, the prompt includes the entire transcript of previous turns. In CCM, the agent receives only the original task, a compact memory string from the previous turn, and the newest observation. The agent then outputs two things: an updated memory and the next environment action.

Figure 1: Continuous Context Management. At each turn, the agent receives the original task, its memory from the preceding turn, and the current observation. It emits an updated memory followed by an environment action. The next prompt is constructed from the updated memory and newest observation rather than the complete interaction transcript.

2. Training with Privileged Distillation

Training an agent to manage its own memory is hard because "success" is only measured at the end of a long episode. To provide better guidance, the authors use:

  • GRPO (Group Relative Policy Optimization): An RL algorithm that uses episode-level rewards.
  • Privileged Full-History Distillation: This is the "secret sauce." During training, a frozen "teacher" model is given the complete interaction history (privileged information). It scores the student's proposed actions. If the teacher—who sees everything—is more confident in a token than the student—who only sees the compact memory—the student is pushed to mimic that behavior.
Figure 2: Training CCM agents with GRPO and full-history self-distillation. Top: the student πθ rolls out under CCM. GRPO with episode task reward optimizes all response tokens, both memory and action. Bottom: the teacher πθ0 is a copy of the student’s initial model, with weights held fixed throughout training. It receives the pre-action environment history reconstructed from the student’s rollout and scores the student-sampled action autoregressively. For each action token, the teacher log-probability ℓT and the student log-probability ℓS give the confidence gap ∆. The gap sets the gate g, which weights the distillation loss Ldistill = −mean(g ℓS) over valid action tokens only. The total training loss is composed of the GRPO loss and distillation loss.

Datasets

The researchers evaluated CCM across three diverse benchmarks:

  • TerminalBench-2: 89 human-curated tasks involving realistic Linux terminal workflows.
  • WebShop: A simulated e-commerce environment requiring navigation, product selection, and purchase.
  • Endless Terminals: A large-scale benchmark (over 2,000 training tasks) for terminal agents managing files, logs, and databases.

Key Insights and Ideas

  • Out-of-the-Box Capability: High-end frontier models like Kimi K3 can actually perform CCM reasonably well without any specialized training, though most models (like Claude 3.5 Sonnet) see a performance dip when forced to use compact memory.
  • The "Aha" of Distillation: RL alone (GRPO) often fails to teach agents how to use memory effectively. The privileged teacher acts as a bridge, showing the student what information should have been in its memory to make the right choice.
  • Memory vs. API Caching: Interestingly, while CCM uses far fewer tokens, it isn't always cheaper on platforms like Amazon Bedrock or Anthropic. This is because "prefix caching" rewards keeping a long, static history. CCM, by changing the memory string every turn, breaks this cache.
  • Generalist Preservation: The distillation objective doesn't just help with the task; it also helps the model retain its general reasoning capabilities (like MMLU scores), which often degrade during narrow RL tuning.

Key Results

  • Massive Token Savings: On TerminalBench-2, CCM reduced cumulative input tokens by 75% to 84% across different models.
  • Performance Boost: On WebShop, the Qwen3-4B model using CCM + Distillation achieved an 86.72% success rate, actually outperforming a version of the same model trained on the full history (81.25%).
  • Efficiency: For Qwen3-8B on WebShop, distillation improved success from ~12% (GRPO only) to over 77%.
Figure 3: WebShop checkpoint evaluation for Qwen3-4B-Instruct (top) and Qwen3-8B (bottom) on a fixed 128-task pass@1 evaluation with temperature 0.4, seed 42, and a 15-turn limit. Columns report exact task success, partial WebShop score, and mean episode length. Solid curves show CCM + GRPO and CCM + GRPO + distillation across checkpoints 10–100. Dashed lines indicate the corresponding untrained CCM and full-history performance.

Limitations and Future Work

  • Observation Bottleneck: CCM manages history, but it doesn't currently compress the current observation. If a single terminal output is 50,000 characters, the prompt will still be huge.
  • Economic Trade-offs: As noted, current API pricing models for "caching" can penalize the very memory efficiency CCM provides.
  • Future Directions: The authors suggest exploring ways to compress the current observation and investigating how these agents behave over even longer horizons (thousands of turns) where full-history methods would be impossible.

For more details, you can find the full paper titled "Continuous Context Management" on arXiv (2609.35540v1).

Summary updated

BibTeX
@misc{hoy2026continuous,
  author = {William Hoy and Jingxuan Fan and Nurcin Celik and Xu Pan},
  title = {{Continuous Context Management}},
  year = {2026},
  eprint = {2609.35540},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.35540},
}
Figure