Letting language models decide when to compact their context windows

SelfCompact scaffold pairs a compaction tool with a lightweight rubric, enabling adaptive context summarization without fine-tuning.

PaperBig Techcs.CLarXiv:2606.23525v2
Tianjian Li · Jingyu Zhang · William Jurayj · Xi Wang · Chuanyang Jin · Mehrdad Farajtabar · +2 more

Johns Hopkins University · Apple

Research Digest··2 min read
The authors introduce SelfCompact, a scaffold that allows language model agents to dynamically decide when and how to compact their accumulated context. By combining a tool for summarization with a rubric that specifies when to invoke it, SelfCompact matches or exceeds fixed-interval baselines on math and agentic search benchmarks, using 30-70% fewer tokens.

What they did

The authors developed SelfCompact, a scaffold that equips language model agents with a compaction tool they can call to summarize the context, and a lightweight rubric that guides when to use it. The rubric recommends compaction when a sub-task resolves or the trajectory is converging, and suppresses it mid-derivation or when stuck. They tested SelfCompact on six benchmarks covering competitive math (e.g., GSM8K, MATH) and agentic search (e.g., WebArena, AssistantBench) using seven open-weight models, comparing against no-compaction and fixed-interval summarization baselines.

Key findings

  • SelfCompact improved accuracy over no summarization by up to 18.1 points on math benchmarks and 5-9 points on agentic search tasks.
  • It matched or exceeded fixed-interval summarization while reducing per-question token cost by 30-70%.
  • The rubric was critical: models used the compaction tool effectively with the rubric but almost never at appropriate times without it, revealing a "meta-cognitive gap" in unprompted models.
  • The approach required no fine-tuning or external supervision, working across multiple model families and sizes.

Why it matters

This work challenges the assumption that context compaction must be triggered by a fixed token budget. By letting models self-regulate, SelfCompact reduces waste and improves performance, suggesting that scaffolds can supply effective meta-cognitive capabilities without modifying model weights. It opens the door to more efficient long-horizon agentic tasks.

Caveats

SelfCompact was evaluated on math and search tasks; its generalizability to dialogue, code generation, or multi-modal agents is untested. The rubric is manually designed and may need task-specific adjustments. The compaction tool's summarization quality depends on the underlying model, and the approach may not scale to very long contexts where summary errors compound.

§

Analysis

This work fits into a growing line of research on improving agent efficiency through better context management, such as retrospective compression and self-driven planning. It distinguishes itself by not requiring training or external oversight, making it broadly applicable. The identified meta-cognitive gap — that models cannot self-diagnose context decay without guidance — raises questions about how to naturally teach such skills.

newspaper

Research Digest

Articles published under the Zotpaper byline are synthesized from multiple source publications by our AI editor and reviewed by our editorial process. Each story combines reporting from credible outlets to give readers a balanced, comprehensive view.