CoolFace
Modelpublic

DIYIN/ContextPilot-8B

sourceHugging Faceotherupdated 24d agoView on Hugging Face
0likes492downloads
README.md101 linesDownload Raw Back to root
1---2license: other3pipeline_tag: text-generation4library_name: transformers5base_model: Qwen/Qwen3-8B6tags:7  - context-management8  - tool-use9  - agent10---11 12# ContextPilot-8B13 14**ContextPilot: Teaching Agents for Proactive Context Management via Fine-grained RL**15 16<p align="center">17  <a href="https://github.com/Tencent/ContextPilot">18    <img19      src="https://img.shields.io/badge/ContextPilot-GitHub-blue?logo=github"20      alt="GitHub Repo"21    />22  </a>23  <a href="https://tencent.github.io/ContextPilot/">24    <img25      src="https://img.shields.io/badge/ContextPilot-Live_Demo-ff725e?logo=githubpages&logoColor=white"26      alt="ContextPilot Live Demo"27    />28  </a>29  <a href="https://arxiv.org/abs/2608.28476">30    <img31      src="https://img.shields.io/badge/ContextPilot-Paper-red?logo=arxiv&logoColor=red"32      alt="Paper"33    />34  </a>35  <a href="https://huggingface.co/collections/panzs19/contextpilot">36    <img37      src="https://img.shields.io/badge/ContextPilot-Models-yellow?logo=huggingface&logoColor=yellow"38      alt="Hugging Face Models"39    />40  </a>41</p>42 43ContextPilot-8B is the Qwen3-8B checkpoint of **ContextPilot**, a proactive context-management framework for long-horizon language-model agents. It teaches agents to plan, maintain long-term memory, and offload less useful context while they continue reasoning and using tools. For more details, see our [paper](https://arxiv.org/abs/2608.28476) and [code repository](https://github.com/Tencent/ContextPilot).44 45![ContextPilot overview](assets/contextpilot_overview.png)46 47## Overview48 49ContextPilot combines three main components:50 51- an extended context-management toolset with planning, structured memory, retrieval, and soft context offloading;52- context-aware partial rollout that focuses exploration on sensitive context-editing decisions; and53- fine-grained credit assignment that trains intermediate snapshots using the outcomes of their downstream branches.54 55The resulting agents are evaluated on long-context question answering and deep-search tasks; see the [evaluation instructions](https://github.com/Tencent/ContextPilot/tree/main/infer#evaluation) for details.56 57## Loading58 59```python60from transformers import AutoModelForCausalLM, AutoTokenizer61 62model_id = "tencent/ContextPilot-8B"63tokenizer = AutoTokenizer.from_pretrained(model_id)64model = AutoModelForCausalLM.from_pretrained(65    model_id,66    torch_dtype="auto",67    device_map="auto",68)69```70 71Note that loading the checkpoint alone does not execute context-management tools; the tool definitions, agent runtime, and evaluation pipeline are provided in the [ContextPilot repository](https://github.com/Tencent/ContextPilot). See the [inference guide](https://github.com/Tencent/ContextPilot/blob/main/infer/README.md) for the full setup.72 73## Intended Use74 75This checkpoint is intended for research on proactive context management, long-horizon agents, long-context QA, and deep search.76 77## License78 79[LICENSE](https://huggingface.co/tencent/ContextPilot-8B/blob/main/LICENSE).80 81## Citation82 83```84@inproceedings{pan-etal-2026-contextpilot,85    title = "ContextPilot: Teaching Agents for Proactive Context Management via Fine-grained RL",86    author = "Pan, Zhuoshi  and87      Pei, Qizhi  and88      Lu, Junru  and89      Lin, Honglin  and90      Zhao, H. Vicky  and91      Yin, Di  and92      Sun, Xing",93    booktitle = "Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing",94    month = nov,95    year = "2026",96    address = "Budapest, Hungary",97    publisher = "Association for Computational Linguistics",98    abstract = "Long-horizon agentic tasks require large language models (LLMs) to iteratively retrieve, integrate, and maintain dispersed information across multi-turn interactions, but preserving all interaction histories leads to a continuously growing working context. Recent proactive context management methods allow models to edit their own working context with specialized tools, yet they still face three key limitations: (1) a limited toolset restricted to search, deletion, and summarization, with no support for global planning, long-term memory, and adaptive compression; (2) inefficient exploration that treats context management actions uniformly despite their heterogeneous impacts on final outcomes; and (3) coarse-grained credit assignment that assigns the final trajectory-level reward to all intermediate context editing actions during RL. To bridge these gaps, we introduce ContextPilot, a proactive context management framework for long-horizon agentic reasoning. Our approach systematically augments the toolset with planning, long-term memory, and soft context offloading tools. We further propose an RL method tailored for context management, which uses context and entropy variation to identify critical editing decisions for branch sampling and estimates action-level advantages from all branched trajectories that pass through the corresponding context editing action. Experiments on long-context QA and deep search tasks show that ContextPilot achieves stronger performance with a more compact working context, consistently outperforming existing baselines across various base models and benchmarks. Code is available at \url{https://github.com/Tencent/ContextPilot}."99}100```101