Self-Compacting Language Model Agents

Tianjian Li, Jingyu Zhang, William Jurayj, Xi Wang, Chuanyang Jin, Mehrdad Farajtabar, Eric Nalisnick, Daniel Khashabi

arXiv:2606.23525 · 2026-06-23 공개 · arXiv · PDF

agentic-search token-cost context-window rubric-based math-benchmarks meta-cognition agent-traces model-scaffolding

Abstract

Long agent traces composed of chains of thought and tool calls accumulate stale content that anchor subsequent generations, and eventually outgrow the context window. Existing scaffolds mitigate it with fixed-interval compaction triggered at a token threshold. Such triggers pay no heed to trajectory structure, risking discard of partial results mid-derivation or mid-search. We propose SelfCompact, a scaffold that allows the model itself to decide when and how to compact. Specifically, it pairs two inference-time elements: (i) a compaction tool the model invokes to summarize the accumulated context, and (ii) a lightweight rubric specifying when to fire (a sub-task has resolved, or the trajectory is converging) and when to suppress (mid-derivation, or when stuck). Both are needed. The tool alone is unevenly used across open-weight models, often invoked at unhelpful moments or not at all; the rubric alone cannot act. Together, they elicit effective adaptive compaction without any fine-tuning or external supervision. We present empirical results on six benchmarks (competitive math and agentic search) and seven models. Our results show that SelfCompact matches or exceeds fixed-interval summarization at a fraction of the token cost, improving over a no-summarization baseline by up to 18.1 points on math and 5-9 points on agentic search at 30-70% lower per-question cost. Our results expose a meta-cognitive gap: although unprompted models cannot reliably tell when their own context is rotting, a lightweight rubric closes this gap, reframing when to compact as a capability that scaffolds can supply without training.

한국어 요약

한 줄 요약

SelfCompact는 모델 스스로 판단하여 맥락을 요약하는 적응형 컴팩트 기법으로, 수학 및 에이전트 탐색 성능을 향상시킨다.

핵심 기여도

핵심 아이디어

기존 에이전트 추적 방식은 고정 간격으로 맥락을 요약하지만, 이는 중간 도출 과정이나 탐색 중간에 결과를 삭제할 위험이 있다. SelfCompact는 모델이 자체적으로 요약 시점을 판단하도록 하며, 이를 위해 두 가지 요소를 결합한다. 첫째, 모델이 직접 호출하는 요약 도구(compaction tool)를 제공하고, 둘째, 특정 조건(예: 서브태스크 완료, 탐색 수렴)을 기반으로 요약을 활성화/억제하는 가벼운 기준(rubric)을 도입한다. 이 두 요소는 독립적으로는 효과적이지 못하지만, 함께 사용하면 모델이 학습 없이도 적응형 요약을 수행할 수 있다.

기술적 접근법

주요 결과

의의 및 한계

SelfCompact는 학습 없이도 모델이 자체적으로 맥락 요약을 수행하도록 유도함으로써, 메타인지적 능력을 외부 프레임워크로 보완하는 새로운 접근법을 제시한다. 기존 고정 간격 요약 방식의 단점을 해결하며, 토큰 비용을 줄이는 동시에 성능을 유지하거나 향상시킨다. 다만, rubric은 모델 독립적으로 작동하지만, 모든 상황에서 최적의 판단을 보장하지는 못하며, 모델 종류나 작업 유형에 따라 성능 변동이 있을 수 있다.

실용적 활용

SelfCompact는 대규모 언어 모델 기반의 에이전트 시스템, 특히 수학 문제 해결 및 탐색 기반 작업에서 유용하게 활용될 수 있다. 특히, 맥락 관리가 중요한 대화형 AI, 자동화된 분석 시스템 등에 적용 가능하다.