Skip to content

Letting Models Manage Their Own Context: Where We Stand

We gave models control over their own context: on OfficeQA Pro v2, GPT nearly triples its score at tight budgets, and Kimi gains with up to 41% fewer input tokens. This opens a new co-design frontier: models trained to manage their own context, served by inference engines that support KV cache editing.

When we released NOOA, NVIDIA's open source agent harness, we built it around six core ideas. One was to give the model direct control over the harness through APIs, including context compaction. The motivation was simple: an agent should be able to decide which parts of its history to keep in context, which to summarize, and which to retrieve when needed.

Interest in model-driven context management has grown since. Research such as SideQuest and Context Language Models explores the idea directly, and agent harnesses are starting to let models manage their own context too. Codex, for example, has introduced an experimental context-management mode that combines history and notes with a new_context tool for starting a fresh context window.

This raises practical questions: Can current models manage their own context effectively? Does it improve task performance? And can inference engines turn model-managed context into cheaper inference?

We compared two context management strategies on document research and machine learning engineering tasks. In harness-driven context management, the default in today's harnesses, the harness triggers compaction when the window context fills. In model-driven context management, the model decides when and what to compact. Four takeaways stand out:

  • Model-driven context management can push the accuracy-efficiency frontier. Models that use NOOA's context API effectively reach higher accuracy, often with fewer input tokens, especially at tight context budgets: GPT nearly triples its score at a 32K context budget on OfficeQA Pro v2 (21% → 56%).
  • Models differ in how they use the API and when they compact. Some barely use it, some compact in large, aggressive steps, and some compact earlier than they need to. Prompt changes shift when they compact.
  • Inference engines can make model-driven edits cheaper. Today's engines reuse the KV cache only up to the first change in the prompt, so every context edit forces the engine to recompute everything after it, including text that hasn't changed. By also reusing the KV cache of that unchanged suffix, we cut prefill compute by up to 15% per request with no measurable change in accuracy.
  • This is a new frontier for co-design. Realizing the full promise of model-driven context management will require models trained to manage their own context and inference engines built to serve it efficiently at scale.

From harness-driven to model-driven context management

Animation comparing harness-driven and model-driven context management. Top: the harness compacts at a fixed threshold, flattening a key finding into a generic summary. Bottom: the model keeps the finding, drops an event, and collapses the rest into a short summary.
Figure 1. In harness-driven context management (top), the harness triggers compaction when context usage reaches a threshold. In model-driven context management (bottom), the model edits its own context along the way.

As an agent works on a task, its history of tool calls, outputs, and model turns keeps growing, making it harder for the model to find and use relevant information (context rot) and eventually exceeding the context window.

Most harnesses handle this automatically: when context usage crosses a threshold, the harness summarizes the history (Figure 1, top), a process commonly referred to as compaction. We call this harness-driven context management. The harness' heuristic policy decides when compaction happens and which parts of the history it covers, while the model only generates the summary. While simple, this approach can be lossy and lead to loss of key task-relevant information in the model's context.

Model-driven context management takes a different approach and lets the model decide when and what to compact[1, 16] (Figure 1, bottom). In NOOA, the model can inspect its history and replace a range of events with a summary through its context API (the collapse call). Compacted events are archived, so the model can retrieve the originals by tag.

The snippet below shows the two operations it needs: collapsing a range of events into a summary, and retrieving an archived event by its original tag.

# Replace events 3..17 with a summary; returns the summary tag "3..17"
summary_tag = self.events.collapse("3", "17", summary_text="Explored the repo.")

# The originals are archived, not deleted: retrieve any event by its original tag
original = self.events["9"]

Collapsing events and retrieving an archived event by its original tag through NOOA's context API. To try it yourself, see the events API tutorial notebook.

Experimental setup

To test model-driven context management across different kinds of work, we use two benchmarks.

OfficeQA Pro v2 contains 90 questions about U.S. federal receipts and expenditures. The agent answers them by searching and reading a large pre-parsed document corpus. Reading documents fills the context quickly, which makes this a good setting for studying how agents retain evidence across a research task.

MLE-bench Lite contains 22 Kaggle competitions, where the agent has to inspect datasets, write and debug code, evaluate results, and submit predictions. The agent has to track experiments, implementation choices, and execution feedback as it iterates.

We compare two context management strategies:

  • Harness-driven: at 80% of the context budget, the harness summarizes the earlier history, preserving the initial instructions and the 10 most recent events.
  • Model-driven: the model receives NOOA's context API, a live context-usage indicator, an instruction to consider compacting only once usage reaches 85%, and a context-pressure warning added to the request when the context approaches its limit.

We sweep context budgets from 8K to 512K tokens. Shrinking the budget raises context pressure, the ratio of what the task needs to what the window holds, and simulates the effect of much longer tasks. Each budget is a hard limit on request size. If a request exceeds it, a fallback removes the oldest events and retries; after three failures, the run counts as a wrong answer.

The promise of model-driven context management

In our experiments, we found that models that understand and use NOOA's context API effectively can reach substantially higher accuracy at the same context budget compared to harness-driven compaction, without extra training. GPT-6.1 Sol shows the clearest benefit, improving accuracy by nearly 3x over harness-driven context management at a 32K context budget on OfficeQA Pro v2 (Figure 2). However, we found that gains are not consistent across all models: DeepSeek-V4-Pro shows less improvement, and Opus 5.5 rarely uses the context API.

Score vs. context budget

OfficeQA Pro v2, harness-driven vs. model-driven, by model

harness-drivenmodel-driven
Figure 2. Score is passed tasks over all 90 trials, including errors. Points are equal-weight replicate means; bars span replicate min–max.

Score vs. context budget

MLE-bench Lite, mean over 22 tasks, harness-driven vs. model-driven

harness-drivenmodel-driven
Figure 2. Scores are leaderboard percentile (missing scores count as zero) and the number of tasks earning any medal (bronze, silver or gold) out of 22. Each point averages the verified runs at that budget. Values are read from the source plots.

The strongest gains are at tight budgets, where the agent has to manage its history repeatedly to make progress, and they shrink as the budget grows. GPT and Kimi are ahead of the harness baseline at small budgets, while Opus trails it until the budget is large enough that the strategies converge. On MLE-bench Lite the effect is much smaller and limited to the tightest budgets, probably because its tasks need far less context.

This corroborates recent work [5, 6, 8], which finds that context management helps most when the window is tight relative to the task length.

The differences between models raise a further question: are they making different context-management decisions, or failing to use the capability at all? To find out, we looked at how each model used the API.

Some models get it more than others

All models receive the same context API and instructions, yet they use them very differently. GPT, Kimi, and DeepSeek call it in 42–53% of tasks. Opus rarely reaches for it: it edits its context in only 4% of tasks, and often finishes before compaction is needed.

Figure 3. Models differ in how often they use the context API. Share of tasks with at least one compaction call, model-driven runs, all budgets.

The effect of each compaction varies as well. When GPT compacts its context, the request shrinks by a median of 3.7× (Figure 4, left). The other models shrink it less: the median is 2.1× for Kimi, 1.8× for DeepSeek, and 1.5× for Opus. Compacting harder is not free, though. Compacted events are archived, and models sometimes go back for them: GPT retrieves the archived content again after 19% of its compaction calls, against 7% for Kimi and 3% for DeepSeek (Figure 4, right). Opus is at 14%, but it compacts so rarely that this estimate is noisy. Taken together, GPT looks like the model most comfortable with the context API: it knows when to call it, compacts the most per call, and retrieves archived content when it needs it.

Compression factor per compaction

how many times smaller the request gets, log scale

Compactions later reopened

% of compaction calls, content retrieved again

Figure 4. Left: compression factor per compaction call, the input tokens of the request in which the model decided to compact divided by the input tokens of the next request, which also carries the executed cell's output. A factor of 2× means the context was halved; below 1× means it grew. Boxes span the middle half of calls with the median inside, whiskers span the 5th to 95th percentile, and the axis is logarithmic. All confirmed compaction calls are pooled across context budgets. Right: share of compaction calls whose archived events were later retrieved again (self.events[...] or .get). This is a lower bound.

Models also differ in what they do when the context fills up. At a 64K budget, we followed each model from the first context-pressure warning until the episode ended, either with an accepted final answer or with a compaction call. Opus mostly acknowledges the warning and wraps up: it returns an answer in most of its episodes instead of continuing. The other models mostly compact, and many consult something first: GPT reads the API docs before compacting in 69% of episodes and DeepSeek inspects the event history first in 46%, while Kimi compacts straight away in 49% (Figure 5). This is consistent with Opus calling the API so rarely (Figure 3) and often finishing its tasks instead of compacting.

What models do under context pressure

Share of first-warning episodes by how they resolved, 64K context budget

Return an answerCompact straight awayRead docs, then compactInspect history, then compactOther
Figure 5. What models do under context pressure. When the context approaches its limit, we send the model a warning and observe how it responds.

This makes training a natural question. Working in a harness that compacts history automatically does not necessarily teach a model when to compact, what to remove, or how to keep useful information.

Harnesses such as Mainplane[14] now offer context management similar to NOOA's, and Codex's experimental mode with history, notes, and a new-context tool[15] makes it plausible that related capabilities receive attention during GPT development. We conjecture that training for model-driven context management may contribute to GPT's stronger results. The feature's existence does not tell us how the evaluated model was trained, however, or whether any such training transfers to NOOA's interface.

Our results motivate investigating how training can make context management more reliable and effective.

Context anxiety

Even models that use the API can compact more aggressively than they need to, keeping their context small while space remains. We call this context anxiety, following prior work [3] on models that misjudge their remaining token budget.

We measure compaction timing as the fraction of the context budget in use when the model makes its first compaction call in a task. With the instruction to consider compacting only at 85% usage, most models wait until they are close to that point. Removing the instruction changes the behavior substantially for some of them (Figure 6).

Context in use at the first compaction

Median % of the context budget, with and without the timing instruction

model-driven (85% instruction)no timing instruction
Figure 6. Each point is the median over tasks of the first compaction decision in that task. It measures when a model starts compacting. A budget with no point means the model never compacted at that budget.

Kimi and DeepSeek compact much earlier without the instruction. Kimi's median first compaction drops from about 84% of the budget to 29% at 128K, and DeepSeek's from 83% to 40% at 256K. GPT is less sensitive, which may reflect how it was trained. Opus almost never compacts with the instruction, but without it, it compacts regularly and early, at a median of 16% of the budget at 128K.

Kimi K3 shows the effect in token usage too (Figure 7). At a 32K budget, both strategies have the same maximum context size, yet the model-driven agent processes 41% fewer cumulative input tokens (36M vs. 62M) and scores slightly higher (43% vs. 41%). The same budget does not mean the same use of it.

Kimi K3: score vs. cumulative input tokens

OfficeQA Pro v2, each point labelled with its context budget

harness-drivenmodel-driven
Figure 7. Cumulative input counts all input tokens, cached or not, at every turn.

Keeping less context can come at a cost. At budgets of 128K and above, the variants without the timing instruction score about 8 points below the harness baseline for Kimi and DeepSeek. GPT and Opus show no comparable change in accuracy.

Why do some models compact early? Many models are trained to keep their context short. Kimi K3, for example, is trained with RL penalties for overly long rollouts[2], which may teach it to economize on tokens even when space remains.

From fewer tokens to cheaper inference

Context management pays off most when a model reaches equal or better accuracy with fewer input tokens. Model-driven context management can do exactly that: at a 64K budget, Kimi uses about 11% fewer cumulative input tokens than its harness baseline while scoring higher (57% vs. 52%). The effect varies by model: GPT shows no comparable saving, and the other models fall in between (Figure 8).

Score vs. token usage

OfficeQA Pro v2, cumulative input tokens, points at 8K–64K labelled with their context budget

harness-drivenmodel-driven
Figure 8. Cumulative input counts all input tokens, cached or not, at every turn. Points are ordered by tokens, so labels may not ascend. Runs below 95% trace coverage are excluded.

Score vs. token usage

MLE-bench Lite, total input + output tokens, points labelled with their context budget

harness-drivenmodel-driven
Figure 8. Token usage is the total recorded input and output tokens per run, including repeated prompts. Lines join increasing budgets and may turn back in token usage. Kimi K3 points combine several context budgets using equal-weight averages. Values are read from the source plots.

However, input-token counts tell only part of the story. Inference engines avoid reprocessing the prompt on every turn by reusing cached computation (the KV cache) for the prefix of the prompt that hasn't changed. Editing the context, for example replacing part of the history with a summary, keeps that cache valid up to the edit but invalidates everything after it, even text that didn't change (Figure 9) - so a shorter context isn't automatically cheaper. It also depends on how much the engine has to recompute after each edit.

Diagram: before an edit, prompt segments A, B, and C are all cached. After compacting B, A is still cached, but the summary and C must be recomputed.

Figure 9. Compacting B shortens the prompt, but the summary and everything after it must be computed again.

To address this, recent papers such as SideQuest from NVIDIA, Context Language Models, and Cache Engineering for Agents propose to reuse the KV cache of unchanged suffix text after an edit instead of recomputing it, which is an approximation aimed at preserving useful model state while reducing serving compute work. We paired NOOA's context API with a suffix KV reuse prototype implemented in the SGLang serving engine, using an open model (Qwen3.6-27B). On MLE-bench Lite, OfficeQA Pro and the agentic coding benchmark DeepSWE, it cut prefill compute by 4–15% per request compared with standard prefix caching, with no measurable impact on task accuracy (Figure 10). Savings are largest in particular on OfficeQA Pro because the suffix text that survives an edit is large, about 10K tokens or roughly 60% of the prompt on average, because the agent's tool calls retrieve long documents that remain in context.

Model-driven (NOOA's context API)Harness-driven (summarize, keep last 10 events)

Reduction in prefill tokens per request

% vs. standard prefix caching, higher is better

Task reward delta

suffix KV reuse minus no KV reuse, with ± error

Figure 10. Suffix KV reuse versus standard prefix caching, Qwen3.6-27B at 32K context, under model-driven (NOOA's context API) and harness-driven (summarize, keep the last 10 events) context management. Left: reduction in prefilled input tokens per request. Right: change in reward, measured in each benchmark's own metric (DeepSWE: fail-to-pass rate; MLE-bench Lite: mean leaderboard percentile; OfficeQA Pro: task score).

These results suggest that model-driven context management opens up a new design space for agentic systems. When models actively shape their own context, the harness and the inference engine no longer just carry out their own roles. They become partners in deciding what to keep and how to serve it efficiently. We are actively exploring this co-design of model, harness and inference engine to push the accuracy-efficiency frontier for agentic workloads.

Where we go next

We expect model-driven context management to become a standard capability of frontier models. Getting there takes two things: training that teaches models when and what to compact, and inference engines that make context edits cheap. This points to two directions:

  • Improve the underlying capability. Some models already use context APIs they were never trained on, and GPT gains substantially from it at tight budgets. We believe training models to use these APIs correctly and effectively will make the capability reliable across models.
  • Connect the harness to the inference engine. Design serving so that context edits preserve reusable computation and release KV cache entries that are no longer needed.

References

  1. NOOA: NVIDIA Object Oriented Agents. NVIDIA, GitHub.
  2. Kimi Team. Kimi K3: Open Frontier Intelligence. arXiv:2607.24653, 2026. (See “Reasoning Effort RL”: trajectories exceeding a per-problem token budget receive a reward of −1.)
  3. Igbinedion et al. Lost in Context: Addressing Context Anxiety in Large Language Models. arXiv:2607.21616, 2026.
  4. Kariyappa and Suh. SideQuest: Model-Driven KV Cache Management for Long-Horizon Agentic Reasoning. arXiv:2602.22603, 2026.
  5. Shao et al. Context Language Models. arXiv:2609.37725, 2026.
  6. Fan et al. An Empirical Study of Harness Design for Coding Agents. arXiv:2609.20804, 2026.
  7. Fu et al. Cache Engineering for Agents. arXiv:2610.28577, 2026.
  8. Kontonis et al. MEMENTO: Teaching LLMs to Manage Their Own Context. arXiv:2604.09852, 2026.
  9. Context Rot. Chroma Research.
  10. Six agent harness capabilities for higher model performance. NVIDIA.
  11. Introducing OfficeQA Pro v2. Databricks.
  12. MLE-bench Lite. OpenAI.
  13. DeepSWE. Datacurve.
  14. Mainplane. GitHub.
  15. Experimental context-management mode with history, notes, and a new-context tool. OpenAI Codex, pull request #42385.
  16. Zhang, Kraska and Khattab. Recursive Language Models. arXiv:2512.24601, 2025.

Citation

If you find this work useful, please cite it as:

@misc{devoto2026modeldriven,
  title        = {Letting Models Manage Their Own Context: Where We Stand},
  author       = {Devoto, Alessio and Vem, Avinash and Safavi, Tara and
                  Kariyappa, Sanjay and Tseng, Yu-Hsuan and Furgale, Paul and
                  Silveira Cabral, Ricardo},
  url          = {https://nvidia-nemo.github.io/Applied-Research/dev-notes/posts/2026-11-23-model-driven-context-management/}
}