29 Aug 2025

The Complexity Trap: Simple Observation Masking Is as Efficient as LLM Summarization for Agent Context Management

A study of context-management strategies for coding agents — context compression and observation masking over long horizons.

Read the paperDownload PDF

Abstract

Large Language Model (LLM)-based agents solve complex tasks through iterative reasoning, exploration, and tool-use, a process that can result in long, expensive context histories. While state-of-the-art Software Engineering (SE) agents like OpenHands or Cursor use LLM-based summarization to tackle this issue, it is unclear whether the increased complexity offers tangible performance benefits compared to simply omitting older observations. We present a systematic comparison of these approaches within SWE-agent on SWE-bench Verified across five diverse model configurations. Moreover, we show initial evidence of our findings generalizing to the OpenHands agent scaffold. We find that a simple environment observation masking strategy halves cost relative to the raw agent while matching, and sometimes slightly exceeding, the solve rate of LLM summarization. Additionally, we introduce a novel hybrid approach that further reduces costs by 7% and 11% compared to just observation masking or LLM summarization, respectively. Our findings raise concerns regarding the trend towards pure LLM summarization and provide initial evidence of untapped cost reductions by pushing the efficiency-effectiveness frontier. We release code and data for reproducibility.

Type
Study
Venue
DL4C @ NeurIPS 2025
First public
29 Aug 2025
arXiv
2508.21433
Authors
Tobias Lindenbauer
Igor Slinko
Ludwig Felder
Egor Bogomolov
Yaroslav Zharov

More from Machine Learning

Apr 2025
BenchmarkMachine Learning

Drawing Pandas: A Benchmark for LLMs in Generating Plotting Code

175 human-curated data-analysis tasks that score plotting code by the picture it draws, judged by a vision model against the ground-truth plot.

Mar 2025
BenchmarkMachine Learning

EnvBench: A Benchmark for Automated Environment Setup

Hard automated development-environment-setup cases across Python and JVM repositories, with dataset and code.

Jun 2024
BenchmarkMachine Learning

Long Code Arena: A Set of Benchmarks for Long-Context Code Models

Six benchmarks for long-context code tasks — library-based generation, CI build repair, project-level completion, commit message generation, bug localization, and module summarization.