- Rating
- 2
- Confidence
- 4
- Informativeness
- 2
- Presentation
- 3
- Soundness
- 2
Read review
Paper summary
This paper introduces AutoCompact, a method that trains coding agents to proactively manage long interaction histories by learning when to compact the context, what information to retain, and how to continue after compaction. The method first uses judge-corrected trajectories for supervised fine-tuning and then applies outcome-based RL to jointly optimize task solving and context management. Experiments on SWE-bench Verified and SWE-PolyBench Verified show that AutoCompact outperforms both the base model and existing length-triggered or proactive compaction baselines.
Critical strengths
-
A clear move beyond passive, threshold-based compaction.
AutoCompact allows the agent to decide when to compact based on task progress, rather than waiting until the context window is close to full. This makes context management part of the learned policy instead of a fixed heuristic. -
The method considers the full compaction process rather than only summary generation.
AutoCompact jointly learns when to compact, what information to preserve, and how to continue after compaction. In particular, explicitly modeling post-compaction behavior makes the context-management process more complete than methods that focus mainly on generating compressed summaries.
Critical weaknesses
-
Mismatch between the RL training horizon and the evaluation context length, with insufficient analysis of the learned compaction timing policy.
RL rollouts are capped at 32K tokens, while the main long-context evaluation uses a 256K context window. It is unclear how a compaction policy learned from substantially shorter trajectories generalizes to this much longer regime. More importantly, the paper does not characterize when the learned policy actually invokescompact()under the 256K setting. For example, it would be useful to know at what context length or interaction step the first and subsequent compactions typically occur, and how many compactions are performed per task. The reported 58.5% proactive-compaction rate is only a task-level binary statistic and does not sufficiently characterize the learned “when to compact” policy. -
Limited analysis of the RL training horizon and multi-segment credit assignment.
The RL setup fixes rollouts to a 32K-token cap, but the paper does not study whether different training horizons, such as 64K, would lead to different performance or compaction behavior. In addition, when a trajectory is split into multiple segments by compaction, all segments share the same trajectory-level advantage. The paper does not investigate alternative credit-assignment schemes, such as segment-dependent weighting or temporal decay. Given that compaction fundamentally changes the trajectory structure, it would be useful to understand how sensitive the method is to these design choices. -
The efficiency analysis relies heavily on dollar-based inference budgets without reporting the underlying resource usage.
The reported inference cost depends on a particular pricing scheme and prefix-caching assumption, making it difficult to understand where the efficiency gains of AutoCompact actually come from. It would be important to additionally report direct statistics such as the average total token usage per task and the average number of environment steps or interaction rounds per task, comparing AutoCompact with the corresponding no-compaction variant. These statistics would clarify whether compaction improves efficiency mainly by reducing token consumption, enabling more interaction steps under the same budget, or allowing the agent to solve tasks in fewer steps. -
The contribution of compaction at the SFT stage is not fully disentangled from the effect of SFT itself.
The paper reports the performance of the base model and AutoCompact-SFT, but AutoCompact-SFT is evaluated with the learned compaction mechanism enabled. Therefore, this comparison does not reveal how much of the improvement comes from SFT improving the underlying agent and how much comes from executing compaction during inference. A useful additional control would be to evaluate the same AutoCompact-SFT checkpoint with compaction disabled, analogous to the no-compaction ablation performed for the final RL checkpoint.
Questions for authors
Could the authors provide some end-to-end trajectory-level comparisons between AutoCompact and the corresponding no-compaction variant on the same tasks? For each case, it would be helpful to show when compact() is invoked, the context length at that point, what information is retained in the summary, how the subsequent actions differ from the no-compaction trajectory, the final task outcome, and the total token usage and number of interaction steps. In particular, cases where AutoCompact succeeds while the no-compaction variant fails, or achieves the same outcome with substantially fewer tokens or steps, would make the practical benefit of proactive compaction much clearer.
3 comments
Rebuttal by the Authors (2/2)
W4. The contribution of compaction at the SFT stage is not fully disentangled from the effect of SFT itself.
Thank you for the suggestion. We have extended the same-checkpoint ablation in Section 3.3 to AutoCompact-SFT. The table below reports SWE-bench Verified pass rates at an inference budget of $4.00 per task.
| Checkpoint | Compaction enabled | Compaction disabled |
|---|---|---|
| AutoCompact-SFT | 32.2% | 30.4% |
| AutoCompact (SFT + RL) | 39.6% | 37.7% |
Executing compaction improves the pass rate by 1.8% after SFT and 1.9 % after RL. These results support an additional contribution from compaction execution at both training stages.
Q1. Can the authors provide end-to-end trajectory comparisons with and without compaction?
Thank you for the suggestion. We have added two paired trajectory comparisons using the same checkpoint, tasks, verifier, execution limits, and decoding settings.
Case 1 (scikit-learn__scikit-learn-14053). AutoCompact first compacts after step 13, with 16,183 context tokens. The summary preserves the _tree.TREE_UNDEFINED sentinel, the target function, and the next edit. The agent then applies and verifies the fix. Without compaction, it repeatedly attempts ineffective replacements, leaves the source unchanged, and incorrectly declares completion; the target test fails.
Case 2 (psf__requests-1142). AutoCompact compacts after step 13, with 16,091 context tokens, preserving the root cause in prepare_body() and the condition excluding GET and HEAD. It finishes after four focused checks. Both variants succeed, but the no-compaction trajectory contains repeated edits and overlapping checks. AutoCompact reduces total tokens by 90.13% and environment steps by 77.03%.
| Case | Variant | Outcome | Total tokens | Steps |
|---|---|---|---|---|
| 1 | AutoCompact | Solved | 292,214 | 30 |
| 1 | No compaction | Failed | 1,981,425 | 81 |
| 2 | AutoCompact | Solved | 171,707 | 17 |
| 2 | No compaction | Solved | 1,740,207 | 74 |
Token totals include cumulative input and output tokens, including summary generation.
Thank you for the additional results. With the same checkpoint, allowing proactive compaction alongside the 16K fallback raises the pass rate from 36.0% to 38.0%. This is a modest gain. The token savings reported in the rebuttal come from the comparison against no compaction, so the actual inference cost of the two policies in the 16K comparison remains unclear.
I appreciate the direct correction of the agent’s actions after compaction. Given prior work on learned context management [1, 2] and the size of the reported gains, I see this as an incremental contribution. I stand by my original rating of 2.
References
[1] Gao, S., et al. (2026). SWE-MeM: Learning Adaptive Memory Management for Long-Horizon Coding Agents. arXiv:2606.28434.
[2] Sun, W., et al. (2025). Scaling Long-Horizon LLM Agent via Context-Folding. arXiv:2510.11967.
Rebuttal by the Authors (1/2)
Thank you for your valuable feedback and questions. Below, we respond to the comments in Weaknesses (W) and Questions (Q).
W1. Training–evaluation horizon mismatch and compaction timing.
We agree that the task-level rate does not fully characterize when the policy compacts. We have added the following statistics on the 256K evaluation trajectories:
On the 32K training–evaluation mismatch, existing results cover both larger and smaller context-window settings:
This is consistent with our design: the model can compact at task transitions before reaching the context limit. Such transitions also occur within 32K rollouts, and these results suggest that the learned behavior remains effective under different context-window settings.
W2. Training horizon and multi-segment credit assignment.
Training horizon. In preliminary experiments, increasing the RL training context from 32K to 128K did not improve the pass rate. Instead, the policy learned longer interactions: model calls and generated tokens roughly doubled, and it hit the context limit more often. Together with the 16K and 256K results above, this indicates that 32K is sufficient to learn effective compaction at a substantially lower rollout cost.
Credit assignment. We deliberately use standard outcome-reward GRPO/RLOO, in which all model-generated tokens of a trajectory share its advantage. Segmenting is only an implementation detail required because
compact()rewrites the context prefix. Each token's log-probability is computed under the context in which it was generated, so the gradient is exactly standard GRPO over the full trajectory.This standard setting is already sufficient: without any compaction-specific credit assignment or reward shaping, RL improves the pass rate by 7.4 points over SFT. It also learns better compaction, with proactive use rising from 44.3% to 58.5% of tasks and key-state omissions falling from 3.1% to 0.2%.
Designing new credit-assignment schemes is a separate research problem and not the contribution of this paper, so we did not explore it. Our contribution is learning when to compact, what to preserve, and how to continue. Improved credit assignment is orthogonal and could be combined with AutoCompact in future work.
W3. The efficiency analysis relies heavily on dollar-based inference budgets without reporting the underlying resource usage.
Thank you for the suggestion. To separate resource efficiency from token pricing and prefix-caching assumptions, we additionally report raw token usage and interaction rounds at approximately matched performance. At comparable pass rates (38.0% for AutoCompact and 37.7% for no compaction), AutoCompact uses 0.795M raw tokens and 53.7 interaction rounds per task, compared with 1.845M tokens and 79.4 rounds for no compaction. AutoCompact therefore requires 56.9% fewer raw tokens and 32.4% fewer interaction rounds to reach approximately the same success rate. Raw token usage sums the complete input and output of every model call, including summary generation, without applying any prefix-caching discount. These results show that AutoCompact improves the pass-rate–resource trade-off independently of the pricing scheme.