ContextPilot: Teaching Agents for Proactive Context Management via Fine-grained RL

AuthorsZhuoshi Pan, Qizhi Pei, Junru Lu et al.

arXiv 20262026

TL;DR

ContextPilot uses context-aware partial rollout plus fine-grained snapshot-level RL credit assignment to reach 72.20 average score on long-context QA vs 70.11 for StateLM-14B-RL (+2.09 points) with a 32K window.

SharePost on XLinkedIn

Read our summary here, or open the publisher PDF on the next tab.

THE PROBLEM

Long-horizon agents drown in ever-growing context histories

Long-horizon agentic tasks require LLMs to iteratively retrieve and maintain dispersed information, but preserving all interaction histories leads to a continuously growing working context.

When ReAct-style agents keep appending thoughts and tool calls, they hit context limits, forcing truncation that drops crucial evidence and hurts final task success.

HOW IT WORKS

ContextPilot — extended tools plus partial rollout RL

ContextPilot combines Perception & Planning tools like plan, Information Retrieval tools like searchContext, Memory Management tools like memorize, and Context Offloading tools like foldHistory under a unified RL-trained agent.

You can think of ContextPilot as an operating system that manages RAM and disk: hot facts stay in working context, while structured memories and compressed history live in external storage.

By using context-aware partial rollout and fine-grained snapshot-level credit assignment, ContextPilot learns context edits that a plain context window or rule-based truncation cannot discover.

DIAGRAM

Context-aware partial rollout and snapshot credit assignment

This diagram shows how ContextPilot selects high-impact context management actions for branching and then assigns fine-grained rewards to trajectory snapshots.

DIAGRAM

Evaluation pipeline across long-context QA and deep search

This diagram shows how ContextPilot is trained and evaluated on long-context QA and deep search benchmarks with different backbones.

PROCESS

How ContextPilot Handles a Long-horizon Agentic Reasoning Task

  1. 01

    Perception and planning

    ContextPilot uses Perception & Planning tools like analyzeText, checkBudget, and plan to estimate context length and sketch a concise multi-step plan.

  2. 02

    Information retrieval

    ContextPilot invokes Information Retrieval tools such as buildIndex, searchContext, readChunk, and readMultiChunks to locate and load relevant evidence chunks.

  3. 03

    Memory management and offloading

    ContextPilot calls Memory Management tools like note, updateNote, memorize, and readMemory plus Context Offloading tools like summarizeContext and foldHistory to structure and compress history.

  4. 04

    RL-guided tool refinement

    ContextPilot applies context-aware partial rollout and fine-grained credit assignment so that impactful context editing actions receive more exploration and sharper rewards.

KEY CONTRIBUTIONS

Key Contributions

  • 01

    Extended context management toolset

    ContextPilot augments StateLM’s tools with planning, long-term memory tools like memorize and readMemory, and soft context offloading tools like compressContext and foldHistory, boosting BrowseComp+ from 63.49% to 80.96% with Qwen3.5-397B-A17B.

  • 02

    Context-aware partial rollout

    ContextPilot introduces context-aware partial rollout that ranks context management actions using context variation and entropy variation, allocating extra rollouts to high-sensitivity tool calls.

  • 03

    Fine-grained snapshot credit assignment

    ContextPilot aggregates rewards from all branched trajectories sharing a snapshot prefix, computing normalized advantages per snapshot to reduce variance and better train context editing behavior.

RESULTS

By the Numbers

Avg. long-context QA

72.20

+2.09 over StateLM-14B-RL

BrowseComp plus

55.50

+2.83 over StateLM-14B-RL

BrowseComp pass@3

32.17

+1.17 over SUPO on WebExplorer-8B

BrowseComp ZH pass@3

53.63

+3.23 over SUPO on WebExplorer-8B

On long-context QA, ContextPilot-14B-RL reaches 72.20 average across NovelQA, ∞Bench, LongMemEval-S, and BrowseComp+ versus 70.11 for StateLM-14B-RL. On deep search, ContextPilot with WebExplorer-8B scores 32.17 pass@3 on BrowseComp and 53.63 pass@3 on BrowseComp-ZH, exceeding SUPO and OpenSeeker trained on the same OpenSeeker subset.

BENCHMARK

By the Numbers

On long-context QA, ContextPilot-14B-RL reaches 72.20 average across NovelQA, ∞Bench, LongMemEval-S, and BrowseComp+ versus 70.11 for StateLM-14B-RL. On deep search, ContextPilot with WebExplorer-8B scores 32.17 pass@3 on BrowseComp and 53.63 pass@3 on BrowseComp-ZH, exceeding SUPO and OpenSeeker trained on the same OpenSeeker subset.

BENCHMARK

Performance comparison on long-context QA with 14B backbones

Average score across NovelQA, ∞Bench, LongMemEval-S, and BrowseComp+ for 32K-context agents.

BENCHMARK

Deep search performance with WebExplorer-8B backbone

Average pass rate across BrowseComp, BrowseComp-ZH, GAIA, and xBench-DeepSearch.

KEY INSIGHT

The Counterintuitive Finding

ContextPilot with a 32K context window and tools scores 72.20 average on long-context QA, surpassing the 128K-context Qwen3-14B backbone at 53.26.

This is surprising because larger raw context windows are expected to help, yet ContextPilot’s proactive context management beats simply scaling context length.

WHY IT MATTERS

What this unlocks for the field

ContextPilot shows that carefully trained context management with planning, long-term memory, and soft offloading can beat much larger context windows on long-horizon tasks.

Builders can now design agents that stay within modest context limits while still solving 552K-token BrowseComp+ style tasks using structured memories and RL-optimized context edits.

~13 min read← Back to papers

Related papers

Agent MemoryLong-Term Memory

Adaptive Memory Admission Control for LLM Agents

Guilin Zhang, Wei Jiang et al.

· 2026

A-MAC scores candidate memories using Utility, Confidence, Novelty, Recency, and Type Prior combined by a learned linear admission policy with Algorithm 1 A-MAC Memory Admission. On the LoCoMo benchmark, A-MAC achieves F1 0.583 and 2644 ms latency, improving F1 by 0.042 and reducing latency by 1187 ms compared to A-mem.

Long-Term Memory

Advancing Open-source World Models

Robbyant Team, Zelin Gao et al.

arXiv 2026 · 2026

LingBot-World combines a Data Engine, Fundamental World Model, Action-Conditioned World Model, and Post-Training causal adaptation to turn a 28B-parameter video generator into a real-time interactive world simulator. On the VBench benchmark, LingBot-World achieves a dynamic degree of 0.8857 versus 0.7612 for Yume-1.5, while also improving imaging quality to 0.6683.

BenchmarkBenchmarkLong-Term Memory

AgenticAI-DialogGen: Topic-Guided Conversation Generation for Fine-Tuning and Evaluating Short- and Long-Term Memories of LLMs

Manoj Madushanka Perera, Adnan Mahmood et al.

· 2026

AgenticAI-DialogGen chains ChatPreprocessor, KnowledgeExtractor, TopicAnalyzer, KnowledgeGraphBuilder, PersonaGenerator, DuelingChat Agent, ConversationValidator, ConversationRefiner, QAGeneration, and PostProcessing to turn raw multi-session chats into topic-guided, persona-grounded conversations with explicit short- and long-term memories. On the TGC / KG memory QA benchmark, Mistral-7B fine-tuned within AgenticAI-DialogGen achieves 87.36 F1, compared to GPT-4’s 83.77 F1 in a zero-shot setting on the same task.

Questions about this paper?

Paper: ContextPilot: Teaching Agents for Proactive Context Management via Fine-grained RL

Answers use this explainer on Memory Papers.

Checking…