Long agent traces accumulate stale content that hurts performance and eventually exceeds context limits. Current methods compact at fixed token intervals, which often discard partial results mid-derivation. SelfCompact gives the model a tool to compact its own context plus a rubric that tells it when to do so—after resolving a subtask or when converging, but not mid-derivation or when stuck. Tested on six benchmarks and seven models, it matches or beats fixed-interval summarization while using 30-70% fewer tokens. On math it improves over no compaction by up to 18.1 points; on agentic search, by 5-9 points. The approach requires no fine-tuning, exposing a meta-cognitive gap that scaffolds can fill.
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.
Big Tech
Tianjian Li · Jingyu Zhang · William Jurayj · Xi Wang · Chuanyang Jin · Mehrdad Farajtabar · +2 more
Johns Hopkins University · Apple
Research Digest··2 min read
Thread:Memory Management for Agents
In one line
SelfCompact lets models adaptively compact their context, improving math accuracy by up to 18.1 points and search by 5-9 points.
Before you read this
Two ideas this paper builds oncontext compactionCompressing or summarizing an LLM's past context into a smaller representation to extend memory and improve reasoning within limited token budgets.71 papers →agentic inference-time scalingSpending more computation during inference, often by running multiple agent iterations or expanding context, to improve model output quality.18 papers →
Read it as
The authors introduce SelfCompact, a scaffold that allows language model agents to dynamically decide when and how to compact their accumulated context.
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 Daily Edition
The front page in your inbox each weekday morning: the lead, the picks, and why each one earned its place.
What it released
Code