ACC: Compiling Agent Trajectories for Long-Context Training

Qisheng Su, Zhen Fang, Shiting Huang, Yu Zeng, Yiming Zhao, Kou Shi, Ziao Zhang, Lin Chen, Zehui Chen, Lijun Wu, Feng Zhao

arXiv:2605.21850 · 2026-05-22 공개 · arXiv · PDF

long-context qwen3 software-engineering supervised-finetuning agent-trajectories tool-responses qa-pairs mrcr

Abstract

Recent development of agents has renewed demand for long-context reasoning capacity of LLMs. However, training LLMs for this capacity requires costly long-document curation or heuristic context synthesis. We observe that agents produce massive trajectories when solving problems, invoking tools and receiving environment observations across many turns. The evidence needed to answer the original question is thus scattered throughout these turns, requiring integration of distant context segments. Nevertheless, standard agent SFT masks tool responses and only trains turn-level tool selection, creating a supervision blind spot where these scattered signals go unused. We propose Agent Context Compilation (ACC), which converts trajectories from search, software engineering, and database querying agents into long-context QA pairs that combine the original question with tool responses and environment observations gathered across multiple turns, training the model to answer directly without tool use. This makes the dependencies between the question and the evidence explicit, enabling direct supervision of long-context reasoning over distant segments without additional annotation. ACC is a simple but effective approach that can be combined with any existing long-context extension or training method, providing scalable supervised fine-tuning data. We validate ACC on long-range dependency modeling tasks through MRCR and GraphWalks, challenging benchmarks requiring cross-turn coreference resolution and graph traversal over extended contexts. Training Qwen3-30B-A3B with ACC achieves 68.3 on MRCR (+18.1) and 77.5 on GraphWalks (+7.6), results comparable to Qwen3-235B-A22B, while preserving general capabilities on GPQA, MMLU-Pro, AIME, and IFEval. Further mechanism analysis reveals that the ACC-trained model exhibits task-adaptive attention restructuring and expert specialization.

한국어 요약

한 줄 요약

**[Long-Context Training / Agent Trajectory]** ACC가 search·SWE·DB query agent의 trajectory를 long-context QA로 변환해 SFT, Qwen3-30B-A3B를 MRCR 68.3(+18.1)·GraphWalks 77.5(+7.6)로 235B급에 근접·일반능력 보존.

핵심 기여도

핵심 아이디어

Agent trajectory에는 long-context reasoning supervision이 이미 풍부하게 내재하지만 표준 SFT는 이를 masking으로 폐기한다 — trajectory를 long-context QA로 재구성해 question-evidence dependency를 명시화하면 추가 annotation 없이 scalable한 distant-segment reasoning supervision을 얻는다.

기술적 접근법

주요 결과

의의 및 한계

**의의**: long-context 학습의 데이터 수급 문제를 agent trajectory로 해결, supervision blind spot 노출·해소, 30B로 235B급 성능에 도달하는 효율, 다른 long-context 방법과 결합 가능한 plug-and-play. **한계**: agent trajectory 수집 의존(원 task 환경 구축 비용), QA 변환 품질이 학습 효과 결정, 매우 긴 context(>>1M token)으로의 확장은 추가 검증.

실용적 활용