TL;DR
Training AI agents to tackle 100-step tasks like fixing codebases is painfully slow because the model has to wait for live, unpredictable environments (compilers, web searches) at every training step. This paper introduces CARE-OPD, a method that decouples training from live environments by intelligently collecting and replaying stored interaction histories. It cuts training time nearly in half while actually beating the performance of traditional live-environment distillation.
What Problem Does This Paper Address?
Suppose you want to shrink a massive, capable "teacher" LLM into a smaller, faster "student" LLM for agentic tasks. Simply having the student mimic the teacher's transcripts fails over long horizons because the moment the student makes a tiny mistake in the real world, it enters an unfamiliar state and spirals.
On-policy distillation (OPD) fixes this by letting the student drive in a live environment while the teacher grades its token choices on the fly. The catch? Live environments are a massive bottleneck. Waiting for code tests or web queries across 80+ turns leaves expensive GPUs sitting idle.
An existing shortcut called prefix replay records multi-turn trajectories offline, then trains the student by dropping it mid-story (at a stored "prefix"), having it generate just one response without executing it, and letting the teacher grade that single turn. While much faster, standard prefix replay hits two walls on long tasks:
- The Coverage-Reliability Trap: If you only record the teacher, the student never learns how to recover from its own messy mistakes. Conversely, if the student acts, it might wander somewhere so bizarre that even the teacher gets confused and gives bad advice.
- Blind Turn Selection: In a 100-turn coding session, most turns are mundane file reads. Existing replay methods either sample turns uniformly or blindly favor early turns, missing critical "aha!" moments—like a bug diagnosis or fix verification—that happen deep in a trajectory.
Methods
The authors propose CARE-OPD (Collect for coverAge, Replay with Evidence), upgrading both how offline trajectories are gathered and how turns are chosen for training.
- Reliability-Controlled History Coverage (What is collected): Instead of teacher-only recordings, a frozen snapshot of the student takes the wheel for the first few turns ("roll-in") before handing control over to the teacher to finish the job. Because student mistakes can put the teacher into unfamiliar territory, CARE-OPD adds a confidence gate during training: when the student generates a response from a stored prefix, the system checks the teacher's average top-token probability. If the teacher is unusually uncertain (falling in the bottom quantile of the batch), that update is thrown out.
- Hindsight Replay Allocation (What is replayed): Rather than guessing which turns matter based on position, CARE-OPD waits until a rollout finishes. It then prompts the teacher—cleverly reusing its existing KV cache from the rollout so it costs almost zero extra compute—to act as a "hindsight judge." Looking at the whole story and final outcome, the judge picks the top 40% of teacher turns where consequential diagnoses, corrections, or verifications actually happened.
Datasets
The authors evaluate on two long-horizon agentic domains (up to 150 turns and 128K context):
- Software Engineering: Trained on a partition of SWE-Gym and evaluated on SWE-bench Verified (resolving real GitHub issues).
- Deep Research: Trained on a quality-controlled dataset curated by the authors from public sources, and evaluated for answer accuracy on BrowseComp-Plus.
No new evaluation benchmarks are introduced.
Key Insights and Ideas
- More supervision isn't always better: In live online OPD, distilling just one random turn per trajectory performs just as well as (and sometimes beats) distilling the entire trajectory. Over 80+ turns of accumulated student errors, teacher targets become noisy.
- Teacher confusion spikes right after taking the wheel: Analyzing the handoff point where the teacher takes over from a student roll-in, the authors found teacher confidence drops and entropy jumps for the first three turns before stabilizing. Confidence gating directly neutralizes this localized shock, creating a strong synergy where roll-ins + gating outperform the sum of their individual parts.
- Critical decisions have a "long tail": Visualizing which turns the hindsight judge picks reveals that valuable learning moments don't just cluster at turn 1 or 2—they spread across several dozen turns where late-stage debugging and verification occur. Furthermore, reusing the rollout teacher's KV cache matches the selection quality of a 4x larger independent critic model (Qwen3.5-122B).
Key Results
Tested on Qwen3.5 (27B teacher $\rightarrow$ 9B student) and Qwen3 (30B-A3B teacher $\rightarrow$ 8B student), CARE-OPD consistently outperforms offline imitation (SFT), prior prefix replay, and live online OPD.
- Higher Task Success: On SWE-bench Verified (Qwen3.5), CARE-OPD hits 59.5%, beating vanilla prefix replay (53.7%) and asynchronous online OPD (57.1%). On Qwen3 SWE-bench, it reaches 23.0% vs. 20.3% for online OPD. On BrowseComp-Plus, it reaches 49.6% vs. 47.2% for online OPD.
- Massive Speedups: Compared to asynchronous online OPD, CARE-OPD cuts end-to-end training wall-clock time by 45% (from 5.5 hours down to 3.0 hours) and reduces live environment actions by 44% (308.1k down to 171.2k), adding only 6 minutes of overhead over vanilla prefix replay.
Limitations and Future Work
- Stale Student Histories: Trajectory collection uses a frozen initial student snapshot. As the student improves during training, the stored replay pool may drift from the student's new behavior. Periodically refreshing the pool could fix this, at the cost of more environment rollouts.
- Unobserved Consequences: Because replayed student responses are never executed in the live environment, the system cannot verify if an unconventional student action actually works.
- Confidence $\neq$ Correctness: The confidence gate measures the teacher's distributional certainty, not objective correctness. Future work could selectively execute high-uncertainty turns in the environment or build execution-aware correctness estimators.
Summary updated