TL;DR
RAG-FGO introduces a dynamic optimization framework that treats query rewriting as an evolvable, agent-based task. By jointly optimizing discrete prompt templates and continuous decoding parameters using a fungal-growth-inspired search strategy, it significantly boosts retrieval accuracy and downstream performance in complex Retrieval-Augmented Generation (RAG) scenarios.
What Problem Does This Paper Address?
Retrieval-Augmented Generation (RAG) is the go-to solution for reducing hallucinations in Large Language Models (LLMs) by grounding them in external knowledge. However, the system's success hinges on the quality of the retrieval, which in turn depends on the query.
Standard RAG often fails because user queries are poorly aligned with how information is stored in a knowledge base. While "generative retrieval" (using an LLM to rewrite the query) helps, it faces three major hurdles:
- Noisy Feedback: Retrieval results are stochastic and inconsistent, making it hard to tell if a prompt change actually helped.
- Mixed Optimization Space: You have to optimize both the text of the prompt (discrete) and parameters like temperature or top-p (continuous).
- Static Limitations: A single, fixed rewriting strategy rarely generalizes across different domains or complex, multi-hop questions.
Methods
The authors propose RAG-FGO (Fungal Growth Optimizer), which reframes query rewriting as a black-box optimization problem. Instead of a static prompt, they use Query-Rewriting Agents that bundle a prompt template with specific decoding configurations.
The core of the framework is inspired by the growth patterns of fungi (hyphae):
- Global Search (Exploration): Like a fungus sending out long-distance spores, the system uses an LLM to perform "semantic jumps"—restructuring prompts entirely to escape local optima and find "info-rich" zones in the retrieval space.
- Local Search (Exploitation): Once a promising region is found, the system performs fine-grained tweaks, such as synonym replacement or minor parameter adjustments, to "settle" into the best possible configuration.
- Elite-Preserving Memory Pool: To combat the "noise" of retrieval feedback, RAG-FGO maintains a pool of the best-performing agents across iterations. This ensures that a lucky (but actually poor) agent doesn't derail the optimization and that high-quality strategies are never lost.
Datasets
The researchers evaluated RAG-FGO across a massive suite of benchmarks to test different capabilities:
- QA Benchmarks: LongBench (long context), HotpotQA, 2WikiMultihopQA, MuSiQue (multi-hop reasoning), Natural Questions (NQ), SQuAD, StrategyQA, AmbigQA (ambiguity), and PopQA (long-tail knowledge).
- Reasoning Benchmarks: MATH500, MMLU-pro, GPQA, DROP, and MuSR (symbolic reasoning).
Key Insights and Ideas
- Joint Optimization is Critical: The paper argues that you cannot optimize prompts and decoding parameters in isolation. A "creative" prompt might need a lower temperature to stay on track, while a "structured" prompt might benefit from higher diversity. RAG-FGO unifies these into a single agent.
- The "Hyphae" Metaphor Works: The dual-search strategy (global jumps + local tweaks) effectively navigates the non-differentiable landscape of LLM prompting where traditional gradient-based methods fail.
- Stability through Memory: The most important component for performance was the elite-preserving memory pool. Without it, the "volatility" of retrieval feedback causes the system to frequently discard good strategies in favor of temporary, noisy gains.
Key Results
RAG-FGO consistently outperformed state-of-the-art baselines (like ReAct and Aflow) across various LLM backbones, including GPT-4o-mini, Qwen2.5, and Gemma2.
- Performance Gains: On the GPT-4o-mini backbone, RAG-FGO achieved an average F1 score of 77.1% across QA tasks, compared to 68.9% for the best baseline (Aflow).
- Robustness: The system showed particularly strong improvements in "knowledge-heavy" and "ambiguous" datasets like PopQA and AmbigQA, where precise query alignment is most difficult.
- Ablation Success: Removing the memory pool caused a massive drop (~6-7 F1 points), proving that managing stochasticity is just as important as the search algorithm itself.
Limitations and Future Work
- Offline Overhead: The optimization process happens in an offline "training" phase. While the resulting agent is fast at inference time, the initial search requires a significant token budget.
- Static Knowledge Bases: The current version assumes the knowledge base is static during optimization. It does not yet support "online" adaptation where the agent learns as the underlying data changes.
- Future Directions: The authors suggest exploring more efficient "surrogate objectives" to reduce the computational cost of the search and extending the framework to multi-modal RAG (e.g., retrieving images or video).
Summary updated