CompactionRL, a reinforcement learning method from Tsinghua University researchers, lifted the open GLM-4.5-Air model to 66.8% on SWE-bench Verified — a 7-point absolute gain on one of AI coding's hardest benchmarks [S1]. The number matters less than what it reveals: the wall that has been quietly capping how long AI agents can work is starting to crack. The question is whether teaching a model to forget on purpose could be the skill that finally lets agents operate for hours, not minutes.

The wall every long-horizon agent hits

Give an AI agent a complex coding task — fix a bug across multiple files, run tests, read error logs, iterate — and it starts brilliantly. Then, somewhere around the 20th tool call, something degrades. The context window fills with stale outputs, old reasoning chains, and dead-end code snippets. The model keeps reading them, anchoring on information that no longer matters, until it either runs out of room or loses the thread entirely [P4].

This is the long-horizon problem. It is not a speed limit or a cost issue. It is a memory issue. And until now, most fixes have been scaffolding — external scripts that truncate or summarise context at fixed token thresholds, paying no attention to what the agent actually still needs [P4].

Teaching the model to compress its own memory

CompactionRL takes a different bet: train the model itself to decide what to keep and what to collapse into a summary [S1]. The approach works by having the model condense its earlier interaction history into a shorter form, then carry on its sequence of actions working from that slimmer context instead of the full record [S1].

The technical novelty is in how the training balances two competing objectives. The model has to be good at the task (writing correct code) and good at summarising (deciding what matters from its own history). CompactionRL trains both skills together through a pair of mechanisms. The first adjusts the training loss so that the longer summary passages do not overwhelm the shorter task outputs during learning. The second lets the model draw lessons by comparing its performance across separate task attempts, rather than only looking within a single run [S1].

In plain terms: the model learns to code and learns to take notes, and the training method ensures neither skill starves the other.

The numbers on two open models

The authors report gains across two open-weight models and two benchmarks [S1]:

  • GLM-4.5-Air (106B-A30B): 66.8% Pass@1 on SWE-bench Verified (+7.0 points) and 24.5% on Terminal-Bench 2.0 (+3.1 points) [S1].
  • GLM-4.7-Flash (30B-A3B): 56.0% on SWE-bench Verified (+5.5 points) and 20.2% on Terminal-Bench 2.0 (+6.8 points) [S1].

SWE-bench Verified measures whether an agent can autonomously fix real GitHub issues. Terminal-Bench 2.0 tests command-line task completion. Both reward models that can sustain coherent work over many steps — exactly the regime where context exhaustion bites hardest.

The smaller GLM-4.7-Flash saw the larger relative jump on Terminal-Bench 2.0, which hints that compaction may disproportionately help models with less raw capacity to waste on stale context. That pattern, if it holds, matters for anyone running agents on modest hardware.

CompactionRL has also been deployed in the reinforcement-learning pipeline for training GLM-5.2, a 750B-parameter model (active 40B) — though that model is still in training, not publicly released [S1].

What it means

The core insight is simple enough to feel obvious in hindsight: an agent that cannot manage its own memory cannot work for long. Every person who has ever written a long document knows this — you do not keep every draft in your head, you summarise what you have done and move forward. CompactionRL bakes that habit into the model's training, not its prompt.

This matters because the alternative — just making context windows bigger — is running into diminishing returns. Larger windows cost more in inference (the compute spent actually running the model) and do not solve the anchoring problem: a model with a 200K-token window still gets confused by 200K tokens of stale noise. Compression, done well, is cheaper and smarter than brute-force expansion.

The connection to broader currents is direct. Open-weight models like the GLM family are closing gaps with closed systems on agentic benchmarks, and methods like CompactionRL — which improve how models use their existing capacity — are a key reason. CompactionRL fits a wider pattern in the field: structural fixes to how agents operate are proving more valuable than simply scaling up model size.

What it means for business

For a two-person dev shop or a suburban software agency already experimenting with AI coding agents, the practical signal is this: the models getting better at long tasks are not necessarily the biggest or most expensive. They are the ones trained to manage their own context.

If you are running agents on open models today — through frameworks like OpenRLHF, which supports agentic RL training with PPO and related algorithms [P3] — CompactionRL suggests a concrete upgrade path: fine-tuning your agent with compaction-aware RL could extend the effective working window without paying for a larger model or a longer context subscription.

For teams building agent pipelines, the workflow impact is tangible. Today, most long-running agent setups require manual context management — external scripts that chop history, or human checkpoints where a developer resets the agent's state. A model trained with compaction could handle that internally, reducing the scaffolding tax and letting agents run longer autonomously before hitting a wall.

The cost angle cuts both ways. Compressed context means fewer tokens processed per step, which lowers inference cost on long runs. But the training itself — reinforcement learning with multi-step rollouts and cross-trajectory comparisons — is compute-intensive. The payoff comes at deployment, not at training.

What we don't know yet

Everything in this story comes from a single arXiv preprint, not yet peer-reviewed or independently replicated [S1]. The benchmark gains are self-reported. No third party has confirmed that CompactionRL produces the same lifts when applied by other teams to other model families.

The deployment in GLM-5.2 training tells us the method scales to a 750B-parameter model, but it does not tell us whether GLM-5.2 will actually ship, when, or whether its public benchmarks will reflect the compaction gains seen in the smaller models [S1].

Several open questions remain:

  • Does compaction hurt performance on short tasks where full context is available? The paper focuses on long-horizon gains; the trade-off on simple tasks is not detailed.
  • How does the quality of the model's self-generated summaries hold up across domains beyond coding? SWE-bench and Terminal-Bench are both software tasks.
  • What licensing terms will accompany any public release of CompactionRL-trained checkpoints? The authors describe their base models as open but the preprint does not specify licences [S1].

The next concrete signal to watch: GLM-5.2's public release, whenever it comes, will be the first chance to see whether compaction-trained agents deliver the same gains at scale and outside the lab.

If your work depends on AI agents that can think for more than a few minutes at a time, this is a thread worth following. Subscribe to keep reading as the benchmarks land.

Sources

Sources


Generated from an audited evidence pack with primary-source research. Social-media items are discussion signals, not verified facts. Nothing here is financial, legal or medical advice.