When Does Query Expansion Help Agent Memory? A Multi-Seed Study of Selective Expansion and Gate Reliability
Abstract
Long-horizon software agents store execution traces and later retrieve them with natural-language questions, so the query and the memory are written in different "languages". LLM query expansion can bridge this gap, but it costs generation on every query. We study Selective Query-Side Expansion (SQE), which expands a query with hypothetical execution traces and paraphrases only when the top-1 dense retrieval score is low, then fuses all rankings with Reciprocal Rank Fusion. Across 8 resampled memory stores with rebuilt indices (4,000 queries over SWE-smith agent steps), SQE reaches 69.4% Recall@5 while expanding 48% of queries; in a token-measured rerun it uses 55% fewer LLM tokens than always-on expansion. The observed gain over dense retrieval is 0.9 Recall@5 points (95% CI [+0.1, +1.7], Holm-adjusted p=0.092). Recall@1 drops, and the fixed top-1 gate shows no reliable gain over random selection at a similar budget. In an oracle analysis, expansion helps only 5.3% of queries and hurts 4.2%, so a perfect gate for this policy gains at most 5.3 points. We release the memory stores, per-method summaries, and analysis scripts.
Create a lesson
Metadata
- Categories
- cs.IR, cs.AI
- Comments
- 9 pages, 5 figures. An earlier version was presented at NAFSIK 2026
Related papers
MADRec: Reliable Multi-Agent Reasoning with Evidence-Grounded Debate for Recommendation
Shared title terminologycs.IRZunlong Liu, Weijie Feng, Jingzhi Li et al.
Agent-R: Making More Evidence Matter in Agentic Multi-Path Recommendation
Shared title terminologycs.IRWei Yang, Zihan Lin, Zhishan Jiang et al.
Towards Explainability with a Multi-Branch Gated and Cross-Attention Hybrid Rating Predictor Recommender System
Shared title terminologycs.IRSina Heydari, Amirreza Abbasi, Mohsen Hooshmand et al.
Query Obfuscation with Embedding-Optimized Noise (EON): A Representational Blindspot in Agentic Retrieval
Shared title terminologycs.IRAnkit Gupta, Christoph Adami, Emily Dolson
DM-Lab at TREC 2026 RAG: Multi-Query Retrieval, Ensemble Judging, and Claim-Pack Generation
Shared title terminologycs.IRElyas Irankhah, Muhammad Arif, Sreeraj Ramachandran et al.
GuardAgent: A Memory-Augmented Agentic Framework for Adaptive Detection of Adversarial Promotions in LLM-Based Recommendation
Shared title terminologycs.IRShiyi Yang, Xinshu Li, Chen Wang et al.