arXiv:2611.07976cs.LGNov 2026

Manuscript Offprint

arXiv:2611.07976

QRAE: Query-Relevant Attention Entropy for Context Compression in DeepSearch Agents

Yingjie Tan, Haiquan Qiu, Quanming Yao, Manyi Zhong, Xianzhi Yu, Yaqing Wang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

DeepSearch LLM agents repeatedly search and carry retrieved sources into subsequent reasoning steps. This expanding context increases token consumption and latency, although many results do not contribute to later reasoning. We propose Query-Relevant Attention Entropy (QRAE), an online context compression method that uses sparse evidence-assessment heads to decide which intact retrieved chunks should persist across reasoning steps. It scores bounded candidate batches through paired prefills: a query-free control suppresses shared attention responses, while normalized entropy measures the breadth of the positive response within each chunk. High-scoring chunks enter a persistent evidence whitelist and are included in the reasoning context. Uncertain chunks remain outside the reasoning context but are retained in a candidate cache, where they can be retrieved for later reevaluation. QRAE requires neither an additional generative compression pass nor modification of the attention operator. Across multiple DeepSearch benchmarks and reasoning models, QRAE improves task success by an average of 2.35 percentage points and reduces end-to-end latency and reported token usage by an average of 30% and 45%, respectively. These benefits generalize to a model with nearly 100B parameters.

1 INTRODUCTION

DeepSearch agents answer information-intensive questions through a cycle of thought and action, as exemplified by Tongyi DeepResearch and OpenResearcher (Tongyi DeepResearch Team, 2025; Li et al., 2026c). At each step, the agent generates reasoning and a tool action, such as searching, opening a page, or finding information within it, then reads the result and continues until it can synthesize an answer. Search returns text snippets, also known as chunks. Because each search returns multiple results, these snippets make up most of the reasoning context and accumulate across steps, requiring repeated processing in later model calls.

To reduce token cost and bound context length, many agent systems invoke an LLM to summarize, reflect on, or refine the accumulated history. RE-TRAC turns completed search trajectories into structured states for subsequent exploration (Zhu et al., 2026); ACON condenses observations and interaction histories; and Context-Folding replaces completed subtrajectories with compact summaries (Kang et al., 2026; Sun et al., 2025). Although effective, these approaches require an additional language-model compression pass, adding compute and wall-clock latency. Retrieval compression can instead prune passages before reasoning, while KV-cache compression reduces serving memory and attention cost (Sharifymoghaddam & Lin, 2026; Li et al., 2024; Zhang et al., 2023). These methods remain useful, but they operate on different dimensions from deciding which redundant search results should persist across reasoning steps. This motivates a mechanism-grounded compression method that derives its selection signal from the reasoning model itself without an additional LLM call.

We propose Query-Relevant Attention Entropy (QRAE), an online context compression method that scores search snippets before they enter the reasoning context, using attention entropy from the

∗^{*}Core-author contact: Tan Yingjie, tanyj23@mails.tsinghua.edu.cn.

reasoning model itself. New chunks enter a candidate cache, and each bounded candidate batch receives normalized-entropy scores from prefill-only evaluation. Chunks ranked highest by their running-mean scores enter a persistent evidence whitelist and remain in the reasoning context across subsequent steps. Uncertain chunks stay in a candidate cache outside the reasoning context, allowing the manager to retrieve, reevaluate, and admit them when later evidence changes their utility.

We use the attention entropy of a small set of localized query-relevant heads as a model-internal signal of each search snippet's relevance to the current query. We draw inspiration from transformer-circuit analyses (Elhage et al., 2021; Olsson et al., 2022): models contain circuits that direct attention toward query-relevant input tokens before answer generation, acting as an internal gating mechanism. We therefore localize heads offline whose query-conditioned prefill attention consistently responds to answer-bearing spans. We observe that relevant chunks tend to elicit responses across multiple supporting tokens, whereas incidental matches produce isolated peaks. We use normalized entropy to quantify the breadth of the positive query-induced response, yielding the QRAE score used by the compression framework.

We evaluate QRAE across multiple models and datasets. End-to-end agent experiments show that QRAE substantially reduces wall-clock time and token consumption while modestly improving overall task success. The QRAE signal identifies relevant chunks containing supporting evidence. Sparse query-relevant heads recur across models and architectures, including hybrid architectures with linear-time components and sparse-attention models. Their consistent responses across datasets and reasoning steps support a model-level mechanism that generalizes beyond the localization data. Finally, strengthening the signals of these heads substantially improves downstream task performance.

Our contributions are:

  • Method contribution: We propose a context compression method for DeepSearch agents, framing context management as decisions about which intact retrieved snippets to pass to the reasoning context. It combines model-internal scoring with recoverable deferral to manage context efficiently.
  • Mechanistic contribution: Through mechanistic analysis, we identify a model-internal evidence signal carried by a family of model-level heads. These heads consistently respond to query-relevant input, and this mechanism generalizes across models of different sizes and architectures.
  • Experimental contribution: Agent experiments show that QRAE substantially reduces end-to-end time and token costs while modestly improving overall task success. Evaluation experiments show that the QRAE signal effectively identifies query-relevant input content.

References (93)