TRANSMISSION // 2611.40323v1
When should AI agents expand memory searches?
Source published
A study finds selective query expansion can cut language-model token use, but its simple confidence gate barely improves retrieval and sometimes misses the best result.

AI agents may save records of past software work, but later questions do not always use the same words as those records. A new preprint tests whether expanding a search query can bridge that gap—and whether a cheap signal can identify when expansion is worth its cost.
The mismatch between a question and a memory
A software agent’s memory might contain a traceback, a command, or a code change. Later, someone might ask in ordinary language how a particular bug was fixed. Finding the right record can be difficult when the question and the stored trace describe the same event in different terms.
One proposed solution is query expansion: ask a language model to generate additional versions of a question, then search with those too. But generating extra text costs time and language-model tokens. Salomon Diei’s preprint asks whether a retrieval system can expand only the questions that need it—and whether a simple signal can identify them.
How the test worked
The method, called Selective Query-Side Expansion (SQE), first runs a dense-vector search. Dense retrieval represents text as numerical vectors, allowing passages with similar meanings to rank highly even without matching words exactly. If the best match’s similarity score falls below a fixed threshold, SQE asks a language model to generate two hypothetical execution traces and two paraphrases of the question. It searches with these probes using dense retrieval and, for the hypothetical traces, a word-based method called BM25. Reciprocal Rank Fusion combines the resulting rankings. If the initial score is high enough, the system skips expansion and keeps the original results.
The researchers tested retrieval of known target steps from SWE-smith software-agent traces. They created eight memory stores by resampling a shared pool of about 16,500 steps, selecting 5,000 per store and rebuilding the search indices. Each store had 500 test questions, for 4,000 query cases in total. The stores overlap, so the cases are not 4,000 fully independent examples.
The main comparisons included dense retrieval alone, expansion on every query, and a random gate that expanded a similar share of queries. The random control helps distinguish the value of choosing which queries to expand from the value of expanding some queries at all. The study measured whether the target record appeared among the top five results (Recall@5), among other retrieval measures. It did not test whether an agent then solved a software task successfully.
A small retrieval gain, with a trade-off
Across the eight stores, SQE reached 69.4% Recall@5, compared with 68.5% for dense retrieval alone. The estimated difference was 0.9 percentage points, with an unadjusted 95% confidence interval from 0.1 to 1.7 points. After adjustment for multiple comparisons, however, the result was not statistically reliable under the paper’s reported test (Holm-adjusted p = 0.092).
SQE also did worse at finding the target as the very first result: Recall@1 was 44.5%, versus 45.5% for dense retrieval. Its modest top-five improvement therefore did not mean it consistently ranked the best record higher.
The cost result is more encouraging, but narrow. In a token-measured rerun, SQE expanded about 46% of queries and used 405 tokens per query, compared with 899 for always-on expansion. Its average retrieval time in that rerun was 2.8 seconds, versus 5.4 seconds for always-on expansion. Across the main multi-store results, expansion occurred on about 48% of queries. These measurements suggest selective expansion reduced generation costs while keeping Recall@5 close to always-on expansion in this setup; they do not establish the same savings for other systems or workloads.
The gate may not be choosing well
A low top-match score did identify harder questions: on one seed, expanded questions had lower Recall@5 than questions left unexpanded. But this comparison alone cannot show whether expansion helped those difficult questions. The researchers also compared outcomes with and without expansion for the same queries. The fixed score-based gate showed no reliable gain over the random gate at a similar expansion budget: the estimated Recall@5 difference was 0.5 points, with a confidence interval spanning zero.
An exploratory analysis of a more complex score feature, called SMV, suggested a possible small advantage over random selection. The authors caution that the memory stores overlap and say this result needs confirmation on disjoint source tasks. An oracle analysis—one that knows in advance which individual queries expansion helps—found that expansion improved the top-five outcome for 5.3% of queries and worsened it for 4.2%. This describes the tested expansion policy, not a practical gate that can know the future.
What remains uncertain
The results concern one retrieval benchmark, one embedding model, one language-model generator, and a particular memory size. The paper says its original runs used an unpinned version of the upstream dataset and did not record generator inference seeds. Its confidence intervals pool query rows from overlapping stores, so the authors treat them as descriptive. They also leave downstream agent success as an open question.
This is a preprint, not evidence that the method has been independently validated or established in deployment. The authors report releasing data, result summaries, and scripts, which may help others check the analysis. For now, the clearest takeaway is limited: selective expansion appears to save generation tokens in this test, but the simple top-score gate did not reliably outperform random selection, and the retrieval gains over dense search were small.
- AI agent memory
- query expansion
- information retrieval
- software agents
- large language models
Reviewed cross-references
These connections were reviewed by a model, not independently fact-checked by a human. Similarity does not imply agreement; consult the original papers and the evidence below.
An AI librarian for muon collider research
Shared method: Both papers use LLM-generated query-side expansions to retrieve additional material: SQE creates hypothetical traces and paraphrases when a dense-score gate fires, while the muon-collider system decomposes complex questions into targeted subqueries. Their triggering rules and aggregation differ, and the reported evaluations use different tasks, so this is a methodological connection, not evidence that either approach’s results validate the other.
Model review: · openai-codex/gpt-6-luna
Evidence and provenance
Selected excerpts, not complete papers. PDF extraction can omit figures or damage equations, tables and reading order; sources may be preprints.
2611.40323v1 — Original paper
Excerpt reference:
static/papers/2611.40323v1.md:183-288
Basis: Paper text
Source file SHA-256:8109aa92276f3d0911b8b342f22210fcfd910f46777d6ae81041cdaa94dc2f412606.10381v3 — Original paper
Excerpt reference:
static/papers/2606.10381v3.md:676-757
Basis: Paper text
Source file SHA-256:a227af79f455e8770c15b49b676043a0294bcf94a0f53f84cb5f589a0f9c7fcf
Related reading
Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.
GEM Gives Search Queries a Reasoning Step
Source published
Shared keywords: information retrieval
When Patent-Search Scores Measure the Benchmark
Source published
Shared keywords: information retrieval, large language models
EvoMemState gives AI memories context—and rules for using it
Source published
Shared keywords: ai agent memory
When does an AI memory actually help?
Source published
Shared keywords: ai agent memory
AI search agents still miss answers when asked to find everything
Source published
Shared keywords: information retrieval, large language models