Back to AI Research

AI Research

CliffCompaction: Cost-Efficient Compaction for Long... | AI Research

Key Takeaways

  • CliffCompaction: Cost-Efficient Compaction for Long-Horizon Coding Agents Coding agents often struggle with long-running tasks that require millions of token...
  • Agents often work on complex problems that require millions of tokens of context, which necessitates compacting across sessions due to limited context windows.
  • The per-rollout savings of CliffCompaction make the performance--cost trade-off of test-time scaling more efficient, adding over 10 percentage points on Terminal-Bench for less than the cost of two full-context runs.
  • Under parallel test-time scaling, CliffCompaction lets Kimi K2.6 match Opus 4.7, and exceed Opus 4.6 and GPT-5.3 Codex at lower cost.
  • The key to CliffCompaction's effectiveness is that it keeps compacted information faithful by only truncating or dropping content, never rephrasing or rewriting it.
Paper AbstractExpand

Agents often work on complex problems that require millions of tokens of context, which necessitates compacting across sessions due to limited context windows. We develop CliffCompaction, an autocompaction technique that reduces cost by up to 50% under a bounded context while maintaining or improving performance on Terminal-Bench and achieving new levels of efficiency for test-time scaling and state-of-the-art results on KernelBench. The per-rollout savings of CliffCompaction make the performance--cost trade-off of test-time scaling more efficient, adding over 10 percentage points on Terminal-Bench for less than the cost of two full-context runs. Under parallel test-time scaling, CliffCompaction lets Kimi K2.6 match Opus 4.7, and exceed Opus 4.6 and GPT-5.3 Codex at lower cost. The key to CliffCompaction's effectiveness is that it keeps compacted information faithful by only truncating or dropping content, never rephrasing or rewriting it. We never compact a compaction---each pass operates only on original content, and prior compacted output is discarded, preventing context drift from accumulating. These properties sustain continual learning over sessions exceeding a million tokens: on KernelBench, CliffCompaction reaches CUDA kernel speedups of $2.23\times$ after 200 steps and $3.58\times$ after 400 steps, surpassing specialized search algorithms and trained agents despite being a general-purpose compaction technique. We open-source a scaffold-agnostic API-proxy implementation of CliffCompaction usable with Claude Code, Codex and other harnesses.

CliffCompaction: Cost-Efficient Compaction for Long-Horizon Coding Agents

Coding agents often struggle with long-running tasks that require millions of tokens of context. As these sessions grow, the computational cost of managing the context increases, and the sheer volume of information can actually hinder an agent's performance. CliffCompaction is a new, rule-based technique designed to manage this context efficiently. By automatically compacting information when a session hits a specific token limit, it reduces costs by up to 50% while maintaining or even improving the agent's success rate on complex coding benchmarks.

How It Works

Unlike traditional methods that summarize past conversations—which can lead to "context drift" or the loss of important details—CliffCompaction focuses on maintaining high precision. It does this by never rephrasing or rewriting content. Instead, it uses a simple set of rules to truncate or drop less critical information, such as long tool results or verbose tool calls, while keeping essential data intact. The ai agents story also surfaces in OpenAI Says AI Found Possible Navier–Stokes..., adding another angle.
Crucially, CliffCompaction does not "compact a compaction." Each time the agent reaches its token limit, the system discards the previous compacted block and creates a fresh one from the most recent, active session. This "cliff-like" approach prevents the accumulation of errors that typically occurs when summaries are repeatedly summarized, ensuring that the agent always works with high-fidelity information.

Efficiency and Cost Savings

By managing the context this way, CliffCompaction significantly reduces the need for expensive, repetitive processing of long histories. Because the system only triggers compaction when necessary, it remains "cache-friendly," allowing the agent to reuse existing data for longer periods. These savings make advanced techniques like test-time scaling—where a model is run multiple times to improve its output—much more affordable. For example, researchers found that using CliffCompaction allowed them to perform multiple rollouts of a model for less than the cost of two full-context runs, leading to substantial performance gains on tasks like Terminal-Bench. The ai agents story also surfaces in Google opens early access to AI..., adding another angle.

Performance on Complex Tasks

CliffCompaction has proven effective across various benchmarks, including SWE-bench Verified and KernelBench. On KernelBench, which tests an agent's ability to continually improve code over millions of tokens, CliffCompaction achieved state-of-the-art results. It reached significant speedups in CUDA kernel development, outperforming specialized search algorithms and trained agents despite being a general-purpose tool. Because it is scaffold-agnostic, it can be easily integrated as an API proxy with existing coding tools like Claude Code, allowing developers to implement it without needing to modify their underlying agent architecture. The ai agents story also surfaces in Claude autonomously improved models across 10..., adding another angle. as detailed in the full paper on Arxiv

Comments (0)

No comments yet

Be the first to share your thoughts!