Compact filtering is a training technique for reinforcement learning (RL) on multi-turn LLM agents in which trajectories that terminate by hitting the maximum context length, the maximum number of environment steps, or a timeout are masked out of the loss, so that only trajectories the agent ended deliberately contribute to training. It was introduced in DeepSWE: Training a Fully Open-sourced, State-of-the-Art Coding Agent by Scaling RL as an extension of DAPO’s overlong filtering, which masks only trajectories that reach the maximum context length; the authors’ reasoning is that in multi-turn agentic settings a trajectory can also end by timing out — through long generation or long environment execution — or by running out of steps.

Usage

It is one component of GRPO++, the RL algorithm used to train the DeepSWE-Preview coding agent, where the generation timeout was 20 minutes. The authors give two reasons it helps. First, it prevents or delays reward collapse: an agent can stumble on a patch that passes all tests without knowing it, and rewarding such runs reinforces undesired behaviour across steps — for example, answering correctly early and then patching random files — which accumulates until training collapses; assigning reward only when the agent deliberately submits encourages rigorous testing before the final submission. Second, it reduces excessive thinking within each step and encourages longer reasoning across steps: in a run with compact filtering enabled, average response length fell while the average number of environment steps rose.

When It Applies

It applies to RL training of agents that act over many turns in an environment and whose trajectories can end by exhaustion (context, steps, time) as well as by an explicit submit or finish action; it assumes such a finish action exists so that deliberate termination can be told apart. The evidence for it is a single team’s report: an ablation on Qwen3-14B with and without compact filtering, and training curves from the DeepSWE run, as presented by the authors themselves.

Trajectory Evaluation, AI Coding Agent