--- pipeline_tag: text-generation library_name: transformers tags: - context-management - tool-use - agent - gemma4 --- # ContextPilot-E4B **ContextPilot: Teaching Agents for Proactive Context Management via Fine-grained RL** ContextPilot-E4B is the Gemma4-E4B 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]() and [code repository](https://github.com/pzs19/ContextPilot). ![ContextPilot overview](assets/contextpilot_overview.png) ## Overview ContextPilot combines three main components: - an extended context-management toolset with planning, structured memory, retrieval, and soft context offloading; - context-aware partial rollout that focuses exploration on sensitive context-editing decisions; and - fine-grained credit assignment that trains intermediate snapshots using the outcomes of their downstream branches. The resulting agents are evaluated on long-context question answering and deep-search tasks; see the [evaluation instructions](https://github.com/pzs19/ContextPilot/tree/main/infer#evaluation) for details. ## Loading ```python from transformers import AutoModelForCausalLM, AutoTokenizer model_id = "panzs19/ContextPilot-E4B" tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained( model_id, torch_dtype="auto", device_map="auto", ) ``` Note 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. ## Intended Use This checkpoint is intended for research on proactive context management, long-horizon agents, long-context QA, and deep search.