RAG-FGO: Dynamic Optimization of Query-Rewriting Agents for Generative RAG
Summary
The paper proposes RAG-FGO, a dynamic optimization framework that formulates RAG query rewriting as a non-differentiable black-box problem over mixed discrete-continuous space, jointly optimizing prompt templates and decoding parameters via global search, local perturbations, and an elite-preserving memory pool to improve robustness under noisy retrieval feedback.
View Cached Full Text
Cached at: 11/16/26, 08:21 AM
# RAG-FGO: Dynamic Optimization of Query-Rewriting Agents for Generative RAG
Source: [https://arxiv.org/html/2611.17788](https://arxiv.org/html/2611.17788)
Xudong WangChaoning ZhangChenghao LiJiaquan ZhangJiehui XieSungyoung LeeJie ZouNing XiePeng WangYang YangHeng Tao Shen††thanks:Qigan Sun, Xudong Wang, and Sungyoung Lee are with the School of Computing, Kyung Hee University, Yongin\-si, South Korea \(e\-mail: sunqigan0206@gmail\.com; wl200203@khu\.ac\.kr; sylee@oslab\.khu\.ac\.kr\)\.††thanks:Chaoning Zhang, Chenghao Li, Jiaquan Zhang, Jiehui Xie, Ning Xie, Jie Zou, Peng Wang, and Yang Yang are with the School of Information and Software Engineering, University of Electronic Science and Technology of China, Chengdu, China \(e\-mail: chaoningzhang1990@gmail\.com; lch17692405449@gmail\.com; 2024091202001@std\.uestc\.edu\.cn; jiehuixie@std\.uestc\.edu\.cn; jie\.zou@uestc\.edu\.cn; seanxiening@gmail\.com; p\.wang6@hotmail\.com; yang\.yang@uestc\.edu\.cn\)\.††thanks:Heng Tao Shen is with the School of Computer Science and Technology, Tongji University, Shanghai, China \(e\-mail: shenhengtao@hotmail\.com\)\.
###### Abstract
In retrieval\-augmented generation \(RAG\), query rewriting serves as a core interface that aligns user intent with external knowledge bases, and its effectiveness directly determines overall system performance\. However, generative retrieval faces three critical challenges in real\-world deployment: noisy retrieval feedback, the difficulty of jointly optimizing discrete prompt templates and continuous decoding\-control parameters, and the limited generalization of static rewriting strategies under semantically complex scenarios\. To address these issues, we propose RAG\-FGO, a dynamic optimization framework for generative retrieval strategies\. RAG\-FGO formulates query rewriting as a non\-differentiable black\-box optimization problem in a mixed discrete–continuous space, and represents prompt templates and decoding parameters as adaptively optimizable query\-rewriting agents\. The framework performs global search to enable semantic jumps and structural reorganization that escape local optima, while applying local perturbations for fine\-grained alignment and precise refinement\. In addition, RAG\-FGO introduces an elite\-preserving memory pool that accumulates high\-quality strategies across iterations, thereby mitigating the impact of stochasticity and noisy feedback on optimization stability\. Experimental results on a diverse suite of benchmarks demonstrate the effectiveness and robustness of the proposed method, supporting its applicability to complex semantic retrieval tasks\.
###### Index Terms:
Retrieval\-Augmented Generation, Query Rewriting, Agent\-based Optimization
## IIntroduction
Retrieval\-Augmented Generation \(RAG\) integrates external knowledge sources into the generation process by retrieving relevant evidence from a knowledge corpus and injecting it into the model context, thereby explicitly coupling language models with external memory\. As a result, RAG has become a core paradigm for knowledge\-intensive tasks such as open\-domain question answering, fact verification, and domain\-specific text generation\[[1](https://arxiv.org/html/2611.17788#bib.bib27),[2](https://arxiv.org/html/2611.17788#bib.bib60),[3](https://arxiv.org/html/2611.17788#bib.bib58),[4](https://arxiv.org/html/2611.17788#bib.bib50)\]\. Compared to generation methods that rely solely on parametric memory, RAG dynamically incorporates traceable evidence at inference time, providing factual grounding for generated outputs\. This design reduces hallucination caused by missing or outdated knowledge and improves the verifiability and reliability of model predictions\[[5](https://arxiv.org/html/2611.17788#bib.bib61),[6](https://arxiv.org/html/2611.17788#bib.bib59)\]\. In most traditional RAG systems, however, the user query is assumed given, and the retrieval module passively matches documents based on the original query\[[7](https://arxiv.org/html/2611.17788#bib.bib22),[3](https://arxiv.org/html/2611.17788#bib.bib58)\]\.
Fig\. 1:Conceptual illustration of the FGO\-inspired search dynamics in RAG\-FGO\. Hyphae grow from low\-efficiency \(info\-sparse\) zones toward high\-efficiency \(info\-rich\) zones in the retrieval space\. \(i\) Local search enables fine\-grained exploitation within promising regions; \(ii\) global search facilitates large semantic jumps to escape local optima and discover new resource\-rich areas\.Under this setting, retrieval effectiveness heavily depends on the surface form of the original query\. Semantic mismatches between query expressions and knowledge corpus representations often directly limit the accessible evidence space\[[8](https://arxiv.org/html/2611.17788#bib.bib17),[9](https://arxiv.org/html/2611.17788#bib.bib10)\]\. To mitigate this issue, generative retrieval enhances RAG’s adaptability in complex semantic scenarios\. Generative retrieval leverages large language models \(LLMs\) to actively rewrite and structure user intents, producing retrieval\-friendly queries that better align with the knowledge corpus\. This approach facilitates evidence retrieval under semantic diversity, ambiguous expressions, or cross\-domain transfer\[[10](https://arxiv.org/html/2611.17788#bib.bib56),[11](https://arxiv.org/html/2611.17788#bib.bib55)\]\. More importantly, the generate\-then\-retrieve paradigm introduces a controllable semantic transformation space into the retrieval process, enabling the system to flexibly align with the organization and inductive biases of the knowledge corpus without relying solely on the retriever’s representation capacity or index structure\[[12](https://arxiv.org/html/2611.17788#bib.bib54)\]\. However, this flexibility also introduces new challenges\. The behavior of generative retrieval depends not only on the retriever but also on the generation configuration, which makes strategy optimization non\-trivial\. Moreover, retrieval quality is often assessed through indirect or proxy feedback signals that are noisy and may drift across queries and domains, rendering strategy selection and optimization susceptible to noise and non\-stationary distributions\[[13](https://arxiv.org/html/2611.17788#bib.bib39),[14](https://arxiv.org/html/2611.17788#bib.bib53)\]\. As a result, static rewriting strategies frequently fail to generalize under semantically complex scenarios\.
Motivated by these observations, we adopt a different modeling perspective:Instead of treating generative retrieval as a one\-shot query rewriting process, we reformulate it as an optimization problem over a retrieval strategy space\.Specifically, we represent a retrieval strategy as query\-rewriting agents jointly parameterized by discrete prompt templates and continuous decoding parameters\. The prompt template defines the structural form of query rewriting, while decoding parameters \(e\.g\., temperature, top\-pp, and repetition penalty\) control the generation distribution and output characteristics\. Given a user query, our query\-rewriting agents generate rewritten queries for retrieval\. Their performance is evaluated based on the semantic similarity between the retrieved results and the target information need\. Since strategy performance can only be assessed through randomly generated queries and their corresponding retrieval outcomes, and this evaluation involves non\-differentiable retrieval operators and sampling randomness, the optimization problem exhibits a mixed discrete–continuous, noisy, black\-box nature that is difficult to solve using gradient\-based methods\[[15](https://arxiv.org/html/2611.17788#bib.bib52),[16](https://arxiv.org/html/2611.17788#bib.bib51)\]\. Consequently, strategies based on static or purely local adjustments often fail to sufficiently explore the strategy space and struggle to achieve stable improvements under noisy feedback\.
To address these challenges, we propose RAG\-FGO, a dynamic optimization framework for query\-rewriting agents\. Inspired by the Fungal Growth Optimizer \(FGO\)\[[17](https://arxiv.org/html/2611.17788#bib.bib7)\], RAG\-FGO combines global exploration with local refinement to enable effective search in complex and non\-stationary strategy spaces\. Figure[1](https://arxiv.org/html/2611.17788#S1.F1)illustrates this exploration dynamic in the retrieval strategy space\. Global operations facilitate semantic jumps and structural reorganization across distant regions of the strategy space, while local operations perform fine\-grained perturbations and convergent optimization over prompt semantics and decoding parameters\. Furthermore, we introduce an elite\-preserving memory pool that accumulates high\-quality query\-rewriting agents across iterations\. This mechanism mitigates strategy degradation caused by generation stochasticity and noisy retrieval feedback, thereby significantly improving optimization stability\. We conduct systematic evaluations on multiple knowledge\-intensive question answering and reasoning benchmarks\. Experimental results demonstrate that, under identical model size and retrieval budget constraints, RAG\-FGO consistently improves retrieval quality and downstream task performance, and exhibits stronger robustness and transferability across semantically complex and cross\-task scenarios\. Our main contributions are summarized as follows:
- •A novel optimization perspective for generative retrieval that unifies prompt templates and decoding parameters into a single mixed discrete–continuous query\-rewriting agent\.
- •The RAG\-FGO dynamic optimization framework, which facilitates stable and efficient exploration of the strategy space through integrated local and global search, and an elite memory mechanism\.
- •Extensive empirical evaluations across multiple question answering and reasoning benchmarks, demonstrating the proposed method’s effectiveness and generalization capability in semantically complex scenarios\.
## IIRelated Work
### II\-ARAG in Large Language Models
RAG\[[1](https://arxiv.org/html/2611.17788#bib.bib27)\]has become a widely adopted solution to the knowledge limitations of LLMs by explicitly coupling generation with external evidence retrieval\. This enables more grounded and verifiable outputs in knowledge\-intensive tasks such as open\-domain question answering and factual verification\. Prior work has advanced RAG along two main directions: enhancing retrieval quality through dense retrievers\[[7](https://arxiv.org/html/2611.17788#bib.bib22),[18](https://arxiv.org/html/2611.17788#bib.bib71)\], late\-interaction models like ColBERT\[[19](https://arxiv.org/html/2611.17788#bib.bib21)\], and scalable infrastructures; and improving evidence fusion via encoder–decoder designs and retrieval\-aware generation\[[20](https://arxiv.org/html/2611.17788#bib.bib23),[21](https://arxiv.org/html/2611.17788#bib.bib20)\]\. Recent efforts further explore multi\-stage pipelines\[[22](https://arxiv.org/html/2611.17788#bib.bib19)\], reinforcement\-learning\-based adaptive retrieval\[[23](https://arxiv.org/html/2611.17788#bib.bib25),[24](https://arxiv.org/html/2611.17788#bib.bib18)\], and long\-context reasoning for larger evidence windows\[[25](https://arxiv.org/html/2611.17788#bib.bib1)\]\.
More recently, generative retrieval has emerged as a key extension, where LLMs actively rewrite or generate queries to better align user intent with knowledge\-base representations\[[26](https://arxiv.org/html/2611.17788#bib.bib49)\]\. Representative methods include hypothetical document generation, such as HyDE\[[9](https://arxiv.org/html/2611.17788#bib.bib10)\], as well as LLM\-based query rewriting and expansion\[[27](https://arxiv.org/html/2611.17788#bib.bib57)\]\. These approaches introduce a controllable semantic transformation space and demonstrate stronger end\-to\-end performance on ambiguous or compositional queries\.
However, existing generative retrieval methods typically rely on static prompt templates and one\-shot generation, without modeling query formulation as an optimizable process\. Fixed configurations often result in redundant or mismatched retrieval\[[8](https://arxiv.org/html/2611.17788#bib.bib17)\], limiting adaptation to semantic variability across tasks, query types, or domains\. In contrast to prior work that treats query generation as a fixed preprocessing step, our approach reframes it as a learnable retrieval\-agent search problem \(jointly optimizing discrete prompt structures and continuous decoding controls under downstream feedback\) to enable dynamic generative retrieval\.
### II\-BHeuristic Search Algorithms
Heuristic and bio\-inspired search algorithms are classical yet effective tools for tackling high\-dimensional and non\-convex optimization problems, especially when the objective function is expensive, discontinuous, or lacks analytical gradients\[[28](https://arxiv.org/html/2611.17788#bib.bib14),[29](https://arxiv.org/html/2611.17788#bib.bib15),[30](https://arxiv.org/html/2611.17788#bib.bib70)\]\. With the increasing reliance on black\-box LLMs, similar optimization challenges naturally arise in LLM\-related settings, where gradients are unavailable, unreliable, or practically inaccessible due to discrete prompt structures and stochastic generation\. Consequently, gradient\-free search has become a practical paradigm for improving LLM behaviors under indirect supervision signals\.
Existing studies have explored a variety of heuristic strategies for prompt\-related optimization\. A representative line of work focuses on prompt evolution, leveraging genetic algorithms, evolutionary strategies, or population\-based search to refine prompt candidates through iterative mutation and selection\[[31](https://arxiv.org/html/2611.17788#bib.bib37),[32](https://arxiv.org/html/2611.17788#bib.bib38),[13](https://arxiv.org/html/2611.17788#bib.bib39)\]\. Another line investigates gradient\-free prompt discovery or selection mechanisms, including discrete trigger search and black\-box prompt construction\[[33](https://arxiv.org/html/2611.17788#bib.bib47),[34](https://arxiv.org/html/2611.17788#bib.bib40)\]\. Reinforcement\-learning\-based approaches further model prompting as sequential decision making, where prompts or actions are optimized according to task rewards\[[35](https://arxiv.org/html/2611.17788#bib.bib41)\]\. Beyond prompt structures, heuristic optimizers have also been applied to generation\-time control, where swarm\-intelligence methods such as PSO or GA tune decoding parameters or steer generation behavior without backpropagation\[[36](https://arxiv.org/html/2611.17788#bib.bib12),[37](https://arxiv.org/html/2611.17788#bib.bib11)\]\.
Among these families, bio\-inspired methods are particularly attractive because they tend to exhibit a favorable balance between broad exploration and fine\-grained local refinement, making them robust to multi\-modality and noisy feedback\[[38](https://arxiv.org/html/2611.17788#bib.bib16)\]\. The FGO\[[17](https://arxiv.org/html/2611.17788#bib.bib7)\], for instance, mimics hyphal expansion and branching to coordinate local and global search, enabling efficient navigation of complex landscapes\. This search characteristic is well aligned with retrieval\-agent optimization in RAG, where effective strategies often require both non\-trivial semantic shifts \(to escape suboptimal query formulations\) and controlled refinements \(to preserve intent and stability\)\. Motivated by this alignment, we adapt FGO to the RAG setting and develop a dynamic retrieval\-agent optimization framework that iteratively improves query reformulation strategies via structured exploration–exploitation in the strategy space\.
## IIIMethod
In this section, we present the proposed RAG\-FGO framework in detail\. We begin by formalizing the problem of generative retrieval optimization and defining the query\-rewriting agents that jointly model prompt templates and decoding parameters \(Section[III\-1](https://arxiv.org/html/2611.17788#S3.SS0.SSS1)\)\. We then provide an overview of the overall framework and its optimization pipeline\. \(Section[III\-2](https://arxiv.org/html/2611.17788#S3.SS0.SSS2)\)\. Next, we describe the agent initialization strategy and the scoring\-and\-selection mechanism used to evaluate and retain high\-quality query\-rewriting agents \(Section[III\-3](https://arxiv.org/html/2611.17788#S3.SS0.SSS3)and Section[III\-4](https://arxiv.org/html/2611.17788#S3.SS0.SSS4)\)\. We further elaborate on the exploration–exploitation process, including local and global search operations for agent evolution \(Section[III\-5](https://arxiv.org/html/2611.17788#S3.SS0.SSS5)\)\. Finally, we introduce the elite\-preserving memory pool mechanism, describe agent accumulation and termination conditions, and explain how the optimized query\-rewriting agents are selected and deployed for inference \(Sections[III\-6](https://arxiv.org/html/2611.17788#S3.SS0.SSS6)and[III\-7](https://arxiv.org/html/2611.17788#S3.SS0.SSS7)\)\.
#### III\-1Problem Formulation
In the context of RAG, the core challenge lies in bridging the semantic gap between user intent and external knowledge\. We define a dataset𝒟=\{\(qi,ci∗\)\}i=1N\\mathcal\{D\}=\\\{\(q\_\{i\},c\_\{i\}^\{\*\}\)\\\}\_\{i=1\}^\{N\}, whereqiq\_\{i\}is the user query andci∗c\_\{i\}^\{\*\}is the ground\-truth supporting context\. The knowledge base is denoted as𝒦\\mathcal\{K\}\. We formulate it as the optimization of query\-rewriting agentsA=\(C,θ\)A=\(C,\\theta\)\. Here,CCrepresents the discrete prompt template, andθ∈ℝd\\theta\\in\\mathbb\{R\}^\{d\}denotes the continuous decoding hyperparameters\. Given an inputqq, the agent generates a rewritten queryq^=ℒ\(q,A\)\\hat\{q\}=\\mathcal\{L\}\(q;A\)via the LLMℒ\\mathcal\{L\}, which is subsequently used to retrieve contextc^=ℛ\(q^,𝒦\)\\hat\{c\}=\\mathcal\{R\}\(\\hat\{q\},\\mathcal\{K\}\)via the retrieverℛ\\mathcal\{R\}\.
Our ultimate goal is to identify the optimal agent configurationA∗=\(C∗,θ∗\)A^\{\*\}=\(C^\{\*\},\\theta^\{\*\}\)that maximizes the expected semantic similarity between the retrieved evidence and the ground truth:
A∗=argmaxA∈𝒮𝔼\(qi,ci∗\)∼𝒟\[Sim\(ℛ\(ℒ\(qi,A\),𝒦\),ci∗\)\],A^\{\*\}=\\arg\\max\_\{A\\in\\mathcal\{S\}\}\\mathbb\{E\}\_\{\(q\_\{i\},c\_\{i\}^\{\*\}\)\\sim\\mathcal\{D\}\}\\left\[\\text\{Sim\}\\left\(\\mathcal\{R\}\\left\(\\mathcal\{L\}\(q\_\{i\};A\),\\mathcal\{K\}\\right\),c\_\{i\}^\{\*\}\\right\)\\right\],\(1\)where𝒮\\mathcal\{S\}is the joint solution space of prompt templates and decoding parameters, andSim\(⋅,⋅\)\\text\{Sim\}\(\\cdot,\\cdot\)is the cosine similarity metric\.
Fig\. 2:Overview of the main components of RAG\-FGO\. \(a\) A query\-rewriting agent consists of a prompt template and continuous decoding parameters\. \(b\) Variation optimization evolves agents via local search \(synonym\-level or minor phrasing edits\) and global search \(LLM\-driven prompt rewriting\)\. \(c\) Candidate agents are scored, ranked, and filtered to select elites\. \(d\) The elite\-preserving memory pool retains elite agents and prunes inferior ones across iterations for subsequent refinement\.
#### III\-2Overview of RAG\-FGO Framework
Figure[2](https://arxiv.org/html/2611.17788#S3.F2)illustrates the key definitions and operational concepts of the proposed RAG\-FGO framework\. The framework is designed for the dynamic optimization of query\-rewriting agents, each comprising a discrete prompt template and a set of continuous decoding parameters \(e\.g\., temperature, top\-pp, and maximum generation length\)\. Starting from a natural language query, the template initialization module generates an initial population of diverse agents\. Each agent is used to generate a rewritten query, which is then utilized to retrieve contextual information from an external knowledge base\. These retrieved results are compared against reference contexts to evaluate the performance of each agent based on semantic similarity\. Following this evaluation, the query\-rewriting agents are ranked, and the top\-performing individuals are selected as the basis for subsequent iterative refinement\.
To navigate the complex retrieval strategy space, the framework employs local search and global search in parallel, each serving a distinct optimization objective\. Global search utilizes LLMs to restructure prompts entirely, facilitating large\-scale semantic shifts that allow the system to escape local optima and discover new, high\-efficiency zones\. Conversely, local search focuses on fine\-grained exploitation within promising regions by introducing subtle variations—such as synonym replacement or tone adjustment—to achieve precise alignment\. The high\-quality query\-rewriting agents identified through these dual operations are then integrated into an elite\-preserving memory pool\.
This elite\-preserving memory pool serves to mitigate the impact of retrieval noise and stochastic fluctuations by accumulating historically effective strategies over successive iterations\. As the optimization progresses, the pool is continuously updated to maintain a diverse yet high\-performing population of agents, providing a robust foundation for the next round of search\. This cycle of exploration and memory\-enhanced refinement continues until the system converges on a stable, optimal configuration\. Ultimately, the agent demonstrating the highest retrieval performance is selected from the pool as the final output, ensuring significant improvements in semantic similarity and factual grounding\. The detailed training workflow of RAG\-FGO is illustrated in Figure[3](https://arxiv.org/html/2611.17788#S3.F3)\.
#### III\-3Agent initialization
RAG\-FGO first initializes a set ofNNagents𝒜=\{A1,A2,…,AN\}\\mathcal\{A\}=\\\{A\_\{1\},A\_\{2\},\\dots,A\_\{N\}\\\}, where each agentAj=\(Cj,θj\)A\_\{j\}=\(C\_\{j\},\\theta\_\{j\}\)consists of a promptCjC\_\{j\}and parametersθj∈ℝd\\theta\_\{j\}\\in\\mathbb\{R\}^\{d\}\. These agents encode diverse query augmentation strategies, covering multiple intent expressions and prompting styles to meet heterogeneous retrieval needs\. Initial prompts are sampled from a predefined prompt space, which may include templates such as:“As a linguistic diversity expert, you excel at subtly rewriting sentences while preserving their core intent and information\.”In parallel, each agent is assigned a decoding parameter vectorθj\\theta\_\{j\}that controls generation behavior, for example: temperature = 0\.7, top\-pp= 0\.8, frequency penalty = 2\.0, presence penalty = 2\.0, max tokens = 1024\. Formally, prompts are drawn from a structured template pool, while parametersθj\\theta\_\{j\}are initialized from a normal distribution to ensure diversity across the agent population:
θj∼𝒩\(μ0,σ02\)\\theta\_\{j\}\\sim\\mathcal\{N\}\(\\mu\_\{0\},\\sigma\_\{0\}^\{2\}\)\(2\)whereμ0\\mu\_\{0\}andσ0\\sigma\_\{0\}are predefined mean and variance, respectively\. This initialization ensures diversity at the starting point of optimization\.
#### III\-4Scoring and Selection
During training, we first employ the agents selected in the current iteration to generate candidate context passages, which are then compared against the corresponding reference contextci∗c\_\{i\}^\{\*\}for semantic similarity\. Specifically, the semantic similarity between a candidate contextci,jc\_\{i,j\}and its referenceci∗c\_\{i\}^\{\*\}is then computed by measuring the cosine similarity between their corresponding embeddings, reflecting how closely the candidate aligns with the reference in terms of meaning:
si,j=Sim\(ci,j,ci∗\)=ci,j⋅ci∗‖ci,j‖‖ci∗‖s\_\{i,j\}=\\text\{Sim\}\(c\_\{i,j\},c\_\{i\}^\{\*\}\)=\\frac\{c\_\{i,j\}\\cdot c\_\{i\}^\{\*\}\}\{\\\|c\_\{i,j\}\\\|\\,\\\|c\_\{i\}^\{\*\}\\\|\}\\,\(3\)Here,ci,jc\_\{i,j\}andci∗c\_\{i\}^\{\*\}denote dense vector representations obtained from a pretrained embedding model, which projects semantic information into a shared vector space\. The resulting scoresi,js\_\{i,j\}provides a normalized measure of semantic similarity, independent of vector scale\. Based on these scores, all agents are ranked within the current iteration, and the top\-kkagents are selected according to a maximum selection rule:
𝒜top\-k=Top\-k\(\{\(Aj,si,j\)∣Aj∈𝒜\}\)\\mathcal\{A\}\_\{\\text\{top\-\}k\}=\\operatorname\{Top\\mbox\{\-\}k\}\\bigl\(\\\{\(A\_\{j\},s\_\{i,j\}\)\\mid A\_\{j\}\\in\\mathcal\{A\}\\\}\\bigr\)\(4\)This mechanism ensures that, in each iteration, only the query\-rewriting agents producing candidate outputs most aligned with the reference contexts are retained\. The selected agents are subsequently stored in the elite\-preserving memory poolℳ\\mathcal\{M\}, which acts as a global repository of high\-quality query\-rewriting agents\.
#### III\-5Exploration and Exploitation
To maintain population diversity and prevent entrapment in local optima, RAG\-FGO employs a dual\-search mechanism for each selected agentAj=\(Cj,θj\)A\_\{j\}=\(C\_\{j\},\\theta\_\{j\}\)\. Each agent acts as a seed to generatemcmc\(mutation count\) variation candidates through iterative mutation, effectively expanding the search frontier within the strategy space\. The selection between local search and global search for thesemcmccandidates is governed by a dynamic probabilityptp\_\{t\}\. At the beginning of each iterationtt, a dynamic local search probabilityptp\_\{t\}is scheduled between predefined minimum and maximum valuespminp\_\{\\min\}andpmaxp\_\{\\max\}:
pt=pmin\+t−1Tmax−1\(pmax−pmin\)p\_\{t\}=p\_\{\\min\}\+\\frac\{t\-1\}\{T\_\{\\max\}\-1\}\(p\_\{\\max\}\-p\_\{\\min\}\)\\,\(5\)This scheduling strategy ensures that early iterations emphasize global search \(ptp\_\{t\}small\), while later iterations gradually shift toward local refinement \(ptp\_\{t\}large\)\. For each mutation, the algorithm samples fromBernoulli\(pt\)\\mathrm\{Bernoulli\}\(p\_\{t\}\)to decide whether to perform local search or global search\. Local search introduces slight semantic modifications to the prompt and applies small perturbations to the parameters:
Cj′=mlocal\(Cj,ϵc\(l\)\),θj′=θj\+ϵθ\(l\),ϵθ\(l\)∼TruncNorm\(0,σl2,\[−klσl,klσl\]\),\\begin\{split\}C\_\{j\}^\{\\prime\}&=m\_\{\\text\{local\}\}\(C\_\{j\},\\epsilon\_\{c\}^\{\(l\)\}\),\\quad\\theta\_\{j\}^\{\\prime\}=\\theta\_\{j\}\+\\epsilon\_\{\\theta\}^\{\(l\)\},\\\\ \\epsilon\_\{\\theta\}^\{\(l\)\}&\\sim\\text\{TruncNorm\}\(0,\\sigma\_\{l\}^\{2\},\[\-k\_\{l\}\\sigma\_\{l\},k\_\{l\}\\sigma\_\{l\}\]\),\\end\{split\}\(6\)wheremlocal\(⋅\)m\_\{\\text\{local\}\}\(\\cdot\)is the local modification function that performs fine\-grained semantic adjustments \(e\.g\., synonym replacement\) while preserving the core intent of the prompt, and bothϵc\(l\)\\epsilon\_\{c\}^\{\(l\)\}andϵθ\(l\)\\epsilon\_\{\\theta\}^\{\(l\)\}represent small perturbation magnitudes\. In contrast, global search introduces more substantial modifications to both the prompt and the parameters\. It excludes perturbations near zero by sampling only values whose absolute magnitude exceeds a thresholdδ\\delta:
Cj′=mglobal\(Cj,ϵc\(g\)\),θj′=θj\+ϵθ\(g\),ϵθ\(g\)∼TruncNorm\(0,σg2,\[−kgσg,−δ\]∪\[δ,kgσg\]\),\\begin\{split\}C\_\{j\}^\{\\prime\}=m\_\{\\text\{global\}\}\(C\_\{j\},\\epsilon\_\{c\}^\{\(g\)\}\),\\quad\\theta\_\{j\}^\{\\prime\}=\\theta\_\{j\}\+\\epsilon\_\{\\theta\}^\{\(g\)\},\\\\ \\epsilon\_\{\\theta\}^\{\(g\)\}\\sim\\text\{TruncNorm\}\(0,\\sigma\_\{g\}^\{2\},\[\-k\_\{g\}\\sigma\_\{g\},\-\\delta\]\\cup\[\\delta,k\_\{g\}\\sigma\_\{g\}\]\),\\end\{split\}\(7\)wheremglobal\(⋅\)m\_\{\\text\{global\}\}\(\\cdot\)denotes the global restructuring function for prompt templates, which leverages a pre\-trained LLM to reconstruct the prompt structure for large\-scale semantic shifts without altering the retrieval task objective, whileϵc\(g\)\\epsilon\_\{c\}^\{\(g\)\}represents the perturbation intensity for global prompt variation\. To ensure exploration, we setδ\>0\\delta\>0to exclude trivial parameter changes and defineσg\>σl\\sigma\_\{g\}\>\\sigma\_\{l\}to facilitate larger parameter shifts compared to local search\. The constantkgk\_\{g\}constrains the global perturbation range to prevent excessive hyperparameter deviations, whileklk\_\{l\}serves as a local scaling coefficient that restricts the search to a narrow neighborhood of the current configuration, thereby ensuring the stability of the optimized decoding configurations throughout the refinement process\.
Fig\. 3:Training process for optimizing query\-rewriting agents driven by RAG\-FGO\. Query\-rewriting agents, consisting of a prompt template and continuous decoding parameters, iteratively rewrite queries for retrieval\. Retrieved contexts are ranked by semantic similarity to reference evidence, and the corresponding elite agents are stored in an elite\-preserving memory pool\. The memory\-retained agents are then evolved through local search \(synonym\-level or minor phrasing edits\) and global search \(LLM\-driven prompt rewriting\) for the next iteration\.
#### III\-6elite\-preserving Memory Pool
The memory poolℳ\\mathcal\{M\}serves as a dynamic repository for retaining high\-quality query\-rewriting agents, ensuring that effective strategies are preserved throughout the optimization process\. Formally, it maintains a population of the top\-MMelite agents:
ℳt=\{A1,A2,…,AM\}\\mathcal\{M\}\_\{t\}=\\\{A\_\{1\},A\_\{2\},\\dots,A\_\{M\}\\\}\(8\)Given the non\-stationary nature of query complexity across iterations, comparing candidates based on historical scores may introduce bias\. To address this, RAG\-FGO employs an Elite\-Preserving Re\-evaluation Mechanism\. In each iterationttwith a new query batchqtq\_\{t\}, the framework re\-evaluates the previous elite agentsℳt−1\\mathcal\{M\}\_\{t\-1\}alongside the set of newly generated agents𝒜t\\mathcal\{A\}\_\{t\}\. This procedure establishes a unified performance baseline on the current task instance, enabling a direct comparison between existing and new strategies\. The memory pool is subsequently updated by retaining the top\-MMperforming agents from the combined population:
ℳt=Top−M\(ℳt−1∪𝒜t\|qt\)\\mathcal\{M\}\_\{t\}=\\operatorname\{Top\-M\}\\left\(\\mathcal\{M\}\_\{t\-1\}\\cup\\mathcal\{A\}\_\{t\}\\Big\|q\_\{t\}\\right\)\(9\)This mechanism ensures that the retained agents represent the most effective strategies for the current retrieval context, thereby mitigating the impact of query difficulty fluctuations on the optimization trajectory\.
#### III\-7Termination and Application
The optimization process continues iteratively until the discovered strategy demonstrates robustness or the computational budget is exhausted\. LetAbest\(t\)A\_\{\\text\{best\}\}^\{\(t\)\}denote the highest\-ranked agent in the updated elite\-preserving memory poolℳt\\mathcal\{M\}\_\{t\}at iterationtt\. We define a stability counterτ\\tau, which increments if the top\-performing agent remains identical to that of the previous iteration \(i\.e\.,Abest\(t\)=Abest\(t−1\)A\_\{\\text\{best\}\}^\{\(t\)\}=A\_\{\\text\{best\}\}^\{\(t\-1\)\}\) and resets otherwise\. To balance optimization quality with resource efficiency, the training terminates when either of the following conditions is met:
- •Stabilization: The stability counterτ\\taureaches a thresholdTstableT\_\{\\text\{stable\}\}\(indicating a robust optimum has been found\)\.
- •Budget Limit: The current iterationttreaches a maximum limitTmaxT\_\{\\text\{max\}\}\(preventing excessive computational cost\)\.
Upon termination, the best\-performing agent from the final elite\-preserving memory pool is selected as the output:
A∗=Abest\(final\)∈ℳfinalA^\{\*\}=A\_\{\\text\{best\}\}^\{\(\\text\{final\}\)\}\\in\\mathcal\{M\}\_\{\\text\{final\}\}\(10\)The selected agentA∗=\(C∗,θ∗\)A^\{\*\}=\(C^\{\*\},\\theta^\{\*\}\)contains both the optimized promptC∗C^\{\*\}and the optimized parametersθ∗\\theta^\{\*\}\. This agent is then deployed in the testing phase, applying its learned rewriting strategy to unseen queries\. This ensures that the system utilizes the most robust retrieval policy discovered and validated throughout the dynamic optimization process\.
## IVExperiments
### IV\-AExperimental Setup
#### IV\-A1Datasets
We evaluate our methods on two groups of benchmarks\.QA benchmarks:LongBench\[[25](https://arxiv.org/html/2611.17788#bib.bib1)\]targets long\-context understanding with inputs up to 100K tokens\. HotpotQA\[[39](https://arxiv.org/html/2611.17788#bib.bib3)\]is a multi\-hop QA dataset over multiple supporting documents\. 2WikiMultihopQA\[[40](https://arxiv.org/html/2611.17788#bib.bib6)\]focuses on compositional multi\-hop questions in Wikipedia\. MuSiQue\[[41](https://arxiv.org/html/2611.17788#bib.bib5)\]decomposes multi\-hop reasoning into single\-hop questions\. Natural Questions \(NQ\)\[[42](https://arxiv.org/html/2611.17788#bib.bib4)\]contains real queries with Wikipedia passages\. SQuAD\[[43](https://arxiv.org/html/2611.17788#bib.bib2)\]is a reading comprehension dataset with span\-based answers\. StrategyQA\[[44](https://arxiv.org/html/2611.17788#bib.bib63)\]requires implicit reasoning steps to answer strategy\-based questions\. AmbigQA\[[45](https://arxiv.org/html/2611.17788#bib.bib64)\]targets ambiguous queries that involve multiple potential interpretations\. PopQA\[[46](https://arxiv.org/html/2611.17788#bib.bib65)\]focuses on long\-tail factual knowledge with low\-popularity entities\.Reasoning benchmarks:MATH500\[[47](https://arxiv.org/html/2611.17788#bib.bib28)\]is a subset of the MATH dataset containing 500 challenging competition\-level problems\. MMLU\-pro\[[48](https://arxiv.org/html/2611.17788#bib.bib29)\]extends the standard MMLU benchmark with more professional and domain\-specific tasks\. GPQA\[[49](https://arxiv.org/html/2611.17788#bib.bib30)\]is a challenging benchmark that evaluates graduate\-level problem\-solving in science and engineering domains\. DROP\[[50](https://arxiv.org/html/2611.17788#bib.bib31)\]is a reading comprehension dataset requiring discrete numerical reasoning, such as addition, counting, subtraction, and comparison\. MuSR\[[51](https://arxiv.org/html/2611.17788#bib.bib32)\]is a benchmark for multi\-step symbolic reasoning, comprising two subsets: MuSR\-op \(operational reasoning\) and MuSR\-ta \(temporal and abstract reasoning\)\.
#### IV\-A2Baselines
We compare RAG\-FGO with three groups of representative methods\.Retrieval\-based baselines:Direct lets the LLM answer questions without retrieval\. ReAct\[[52](https://arxiv.org/html/2611.17788#bib.bib9)\]integrates CoT reasoning with retrieval tool use\. Self\-Act\[[53](https://arxiv.org/html/2611.17788#bib.bib8)\]\(Self\-Ask with Search\) decomposes a query into sub\-questions and retrieves evidence for each\. Aflow\[[54](https://arxiv.org/html/2611.17788#bib.bib26)\]employs an adaptive flow strategy that dynamically decides when to reason or retrieve, making it effective for multi\-hop QA\.Reasoning\-based baselines:Zero\-shot CoT elicits reasoning by adding a trigger phrase \(e\.g\., “Let us reason step by step”\) to the query without in\-context exemplars\. Few\-shot CoT guides reasoning by providing a small set of annotated exemplars, allowing the model to learn from in\-context demonstrations\. USC\[[55](https://arxiv.org/html/2611.17788#bib.bib33)\]generates multiple CoT reasoning paths and selects the final answer by majority voting\. CoT\-WP\[[56](https://arxiv.org/html/2611.17788#bib.bib34)\]weights reasoning paths by confidence scores from token\-level probabilities and aggregates them via weighted voting\. LEAP\[[57](https://arxiv.org/html/2611.17788#bib.bib35)\]enhances few\-shot prompting by inducing errors on exemplars and using self\-reflection to extract transferable reasoning principles\. ReFeri\[[58](https://arxiv.org/html/2611.17788#bib.bib36)\]recycles few\-shot exemplars to score and verify candidate outputs, selecting responses that are both confident and contextually coherent without additional training\.Query Rewriting Baselines:We cover a range of query rewriting baselines, from prompt\-driven LLM rewriting to supervised fine\-tuning and advanced training paradigms\. We include LLM\-based methods \(LLM Rewrite, HyDE\[[9](https://arxiv.org/html/2611.17788#bib.bib10)\], Query2Doc\[[59](https://arxiv.org/html/2611.17788#bib.bib66)\], and Crafting\[[60](https://arxiv.org/html/2611.17788#bib.bib67)\]\) that generate retrieval\-oriented query variants via prompting\. We also evaluate SFT, which fine\-tunes the rewriter on labeled data\. In addition, we consider stronger training\-based approaches, including RaFe \(DPO\)\[[61](https://arxiv.org/html/2611.17788#bib.bib68)\], RRR \(PPO\)\[[27](https://arxiv.org/html/2611.17788#bib.bib57)\], and Q\-PRM\[[62](https://arxiv.org/html/2611.17788#bib.bib69)\]\. These methods optimize query rewriting through preference learning, reward signals, or process\-level supervision\. All approaches are evaluated under a unified setting on benchmarks that span multi\-hop reasoning, ambiguous queries, and open\-domain question answering\.
#### IV\-A3LLM Generators
We evaluate the real\-world performance of RAG\-FGO using a diverse range of proprietary and open\-source LLMs as backbones\. These include: GPT\-4o\-mini and GPT\-4\.1\-nano, representing compact yet powerful proprietary models; Qwen\-Long and Qwen\-Max, designed for long\-context reasoning and high\-performance tasks; Qwen2\.5\-7B\-Instruct, a versatile open\-source model used to assess instruction\-following and reasoning capabilities in practical applications; and Gemma2\-27B, a large\-scale open\-source model optimized for both efficiency and accuracy\. We utilize these backbone models to test the end\-to\-end performance of our optimized query\-rewriting agents in realistic retrieval\-augmented generation scenarios\.
TABLE I:Comparison with retrieval\-based baselines across six QA benchmarks using five LLM generators\. Metrics are answer\-level F1 scores \(%\)\. Best results are highlighted in bold\.ModelMethodLongBenchHotpotQA2WikiMuSiQueNQSQuADAVGGPT\-4o\-miniDirect58\.151\.148\.940\.136\.451\.247\.6ReAct62\.765\.652\.353\.648\.955\.356\.4Self\-Act68\.973\.169\.267\.362\.469\.568\.4Aflow61\.073\.565\.771\.667\.973\.768\.9RAG\-FGO71\.581\.577\.379\.473\.879\.277\.1GPT\-4\.1\-nanoDirect56\.348\.545\.338\.233\.749\.345\.2ReAct59\.761\.348\.947\.345\.450\.952\.2Self\-Act64\.569\.762\.261\.159\.862\.763\.3Aflow66\.174\.270\.169\.466\.572\.169\.7RAG\-FGO67\.877\.875\.773\.170\.377\.673\.7Qwen\-LongDirect59\.355\.751\.955\.443\.454\.353\.3ReAct64\.269\.257\.258\.956\.358\.760\.8Self\-Act68\.376\.473\.172\.368\.970\.471\.6Aflow70\.880\.176\.878\.974\.677\.176\.4RAG\-FGO72\.384\.380\.282\.679\.180\.479\.8Qwen\-MaxDirect47\.252\.746\.649\.953\.348\.549\.7ReAct52\.360\.153\.153\.659\.854\.555\.6Self\-Act58\.765\.664\.861\.867\.868\.364\.5Aflow61\.271\.468\.165\.373\.974\.069\.0RAG\-FGO63\.976\.671\.167\.477\.378\.272\.4Gemma\-2\-27BDirect49\.349\.743\.448\.451\.348\.548\.4ReAct52\.556\.350\.851\.757\.854\.553\.9Self\-Act56\.460\.559\.759\.765\.365\.761\.2Aflow60\.869\.163\.263\.469\.471\.966\.3RAG\-FGO64\.974\.566\.766\.173\.176\.670\.3
TABLE II:Comparison of RAG\-FGO with query rewriting baselines on QA benchmarks using Qwen2\.5\-7B\-Instruct as the generator LLM\. Best results are highlighted in bold\.MethodHotpotQAStrategyQAAmbigQAPopQAEMF1AccEMF1AccEMF1AccEMF1AccLLM Rewrite25\.834\.330\.661\.461\.465\.433\.444\.048\.69\.223\.252\.8HyDE32\.843\.838\.667\.267\.271\.047\.260\.464\.69\.022\.752\.8Query2Doc30\.841\.336\.863\.663\.667\.648\.660\.865\.28\.219\.544\.2Crafting28\.839\.335\.465\.265\.269\.042\.855\.160\.87\.618\.444\.8SFT29\.839\.436\.263\.663\.667\.643\.256\.062\.29\.022\.354\.0RaFe \(DPO\)32\.643\.238\.468\.868\.871\.848\.060\.864\.411\.426\.758\.0RRR \(PPO\)33\.644\.239\.268\.668\.671\.247\.059\.964\.412\.228\.962\.6Q\-PRM34\.244\.539\.470\.270\.272\.651\.063\.969\.212\.229\.863\.6RAG\-FGO35\.445\.840\.172\.172\.175\.253\.266\.471\.114\.631\.165\.2TABLE III:Comparison of RAG\-FGO with baseline methods on seven reasoning benchmarks using GPT\-4o\-mini as the generator LLM\. Best results are highlighted in bold\.MethodMATH500MMLU\-proGPQADROPHotpotQAMuSR\-opMuSR\-taAvg\.\(Acc\.\)\(Acc\.\)\(Acc\.\)\(EM/F1\)\(EM\)\(Acc\.\)\(Acc\.\)Zero\-shot CoT76\.463\.043\.077\.6/85\.631\.558\.156\.258\.0Few\-shot CoT75\.263\.041\.376\.8/83\.134\.059\.477\.061\.0USC78\.662\.542\.478\.8/85\.836\.659\.876\.462\.2CoT\-WP77\.864\.242\.477\.6/83\.134\.057\.079\.661\.8LEAP74\.563\.243\.975\.8/83\.034\.059\.874\.460\.8ReFeri78\.265\.042\.479\.6/85\.336\.261\.382\.863\.6RAG\-FGO78\.064\.544\.179\.2/85\.035\.961\.783\.163\.7
TABLE IV:Comparison with gradient\-free prompt optimization baselines\. All results are reported in F1 \(%\)\.MethodHotpotQAMuSiQueNQAvg\.AutoPrompt\[[33](https://arxiv.org/html/2611.17788#bib.bib47)\]60\.254\.561\.358\.6Genetic Prompt Search\[[63](https://arxiv.org/html/2611.17788#bib.bib48)\]58\.763\.967\.963\.5RLPrompt\[[35](https://arxiv.org/html/2611.17788#bib.bib41)\]65\.159\.265\.463\.2RAG\-FGO74\.566\.173\.171\.2
#### IV\-A4Implementation Details
We implement the RAG pipeline with dense retrieval using the E5\-base\-v2 model\[[64](https://arxiv.org/html/2611.17788#bib.bib62)\]over the English Wikipedia corpus from the DPR split \(December 20, 2018 dump, 21 million 100\-word passages\)\[[7](https://arxiv.org/html/2611.17788#bib.bib22)\]\. Pre\-processed FAISS indices are sourced from public repositories\. Retrieval fetches the top\-10 passages \(k=10k=10\) per rewritten queryq^\\hat\{q\}using FAISS\[[65](https://arxiv.org/html/2611.17788#bib.bib24)\]with Inner Product similarity\. The query\-rewriting agent is optimized using Qwen2\.5\-7B\-Instruct as the rewriter LLM, while final answer generation is performed by the backbone LLMs\.
To maintain consistent performance across varying levels of task complexity, we employ hyperparameter configurations that scale with the retrieval difficulty of each benchmark \(e\.g\.,mc=9mc=9for LongBench andmc=12mc=12for HotpotQA\)\. We further set a constant elite\-preserving memory pool capacity ofM=5M=5for all experiments\. These settings represent balanced search budgets that are further justified by the sensitivity analysis in our ablation study\. Unless otherwise specified, all reported metrics are based on the final optimized agents obtained at the conclusion of the RAG\-FGO training process\.
### IV\-BPerformance Evaluation
#### IV\-B1Retrieval\-based baselines
We compare RAG\-FGO with four representative retrieval\-based baselines across six QA benchmarks and five LLM backbones, as summarized in Table[I](https://arxiv.org/html/2611.17788#S4.T1)\. RAG\-FGO consistently achieves the strongest performance across all backbones, indicating that its advantages are not tied to a specific model family\.
On the GPT\-4o\-mini backbone, RAG\-FGO substantially outperforms competitive baselines such as Aflow and Self\-Act on retrieval\-intensive benchmarks, including HotpotQA, 2Wiki, and MuSiQue\. These gains suggest that the proposed search\-based optimization effectively aligns rewritten queries with multi\-hop and compositional evidence requirements\. Notably, RAG\-FGO also yields consistent improvements on knowledge\-heavy datasets such as NQ and SQuAD, demonstrating that the optimized rewriting strategy generalizes beyond explicit multi\-hop settings\. Similar patterns are observed across other backbones, including Qwen\-Long, Qwen\-Max, and Gemma\-2\-27B, where RAG\-FGO maintains clear margins over fixed\-prompt agentic workflows\. Overall, these results highlight that strategy\-level refinement of query rewriting provides a more robust foundation for retrieval\-augmented generation than static or heuristic\-based baselines\.
#### IV\-B2Query\-Rewriting Baselines
Table[II](https://arxiv.org/html/2611.17788#S4.T2)compares RAG\-FGO with representative query rewriting baselines under a unified Qwen2\.5\-7B\-Instruct backbone\. Across all four benchmarks, RAG\-FGO consistently achieves the best performance on EM, F1, and accuracy, indicating a robust improvement rather than isolated gains on specific datasets\. Notably, the improvements are most pronounced on AmbigQA and PopQA, where semantic ambiguity and long\-tail knowledge pose significant challenges to retrieval\. This suggests that the iterative, feedback\-driven optimization in RAG\-FGO effectively reduces query–document mismatch in scenarios where naive rewriting strategies are insufficient\. In contrast, gains on HotpotQA and StrategyQA, while more moderate, remain consistent across all metrics, demonstrating that RAG\-FGO enhances evidence retrieval without disrupting multi\-hop or implicit reasoning\.
Overall, these results highlight that RAG\-FGO provides a generalizable optimization of query rewriting strategies, yielding stable improvements across diverse QA settings with different reasoning and retrieval characteristics\.
#### IV\-B3Reasoning\-Centric Baselines
As shown in Table[III](https://arxiv.org/html/2611.17788#S4.T3), RAG\-FGO achieves the best overall average score \(63\.7\) on the seven reasoning benchmarks, narrowly surpassing ReFeri \(63\.6\)\. Beyond the average, RAG\-FGO shows its clearest benefits on knowledge\-intensive and multi\-hop benchmarks such as GPQA and MuSR, where optimized rewriting better aligns retrieval with the underlying evidence needs, yielding consistent gains over strong prompt\-based baselines\.
TABLE V:Performance comparison of different heuristic optimizers under identical RAG configurations, using GPT\-4o\-mini as the generator LLM\. Results are reported in F1 \(%\)\.MethodLongBenchHotpotQA2WikiMultihopQAPSO\[[66](https://arxiv.org/html/2611.17788#bib.bib42)\]66\.272\.969\.1GA\[[67](https://arxiv.org/html/2611.17788#bib.bib43)\]65\.571\.367\.8SA\[[68](https://arxiv.org/html/2611.17788#bib.bib13)\]61\.067\.263\.5FOA\[[69](https://arxiv.org/html/2611.17788#bib.bib44)\]68\.876\.472\.5TLBO\[[70](https://arxiv.org/html/2611.17788#bib.bib45)\]63\.369\.065\.4HS\[[71](https://arxiv.org/html/2611.17788#bib.bib46)\]64\.170\.266\.7RAG\-FGO71\.581\.577\.3On a few benchmarks that are comparatively less constrained by external evidence \(e\.g\., MATH500 and MMLU\-pro\), the improvements are smaller and RAG\-FGO can be slightly behind the strongest prompt\-based method\. Overall, these results indicate that RAG\-FGO is most effective when solving requires grounding in retrieved knowledge, while remaining competitive on reasoning\-centric tasks with weaker reliance on retrieval\.
#### IV\-B4Experimental Comparison with Prompt Optimization Baselines
To situate RAG\-FGO within the broader space of gradient\-free and evolutionary prompt optimization techniques, we compare it against AutoPrompt, Genetic Prompt Search, and RLPrompt under identical RAG configurations\. All methods use the same retriever and the Gemma\-2\-27B generator to ensure a controlled and comparable evaluation setting\. Because these existing approaches were originally developed for classification or masked\-LM scenarios rather than retrieval\-augmented generation with decoder\-only models, we implement adapted, gradient\-free variants suitable for query\-rewriting prompts\. As shown in Table[IV](https://arxiv.org/html/2611.17788#S4.T4), RAG\-FGO achieves higher scores across HotpotQA, MuSiQue, and NQ\. These results suggest that the performance differences arise from the structured global–local search procedure introduced in RAG\-FGO rather than from generic prompt perturbation or search diversity alone\.
#### IV\-B5Evaluation Against Heuristic Optimization Paradigms
We further examine RAG\-FGO in comparison with several widely used heuristic optimization paradigms, including PSO, GA, SA, FOA, TLBO, and HS, under the same RAG configuration with GPT\-4o\-mini\. Rather than treating these methods as specialized optimizers for prompt agents, we apply them in a direct manner to represent different heuristic search philosophies commonly used in black\-box optimization\.
As shown in Table[V](https://arxiv.org/html/2611.17788#S4.T5), FOA yields the strongest performance among the heuristic paradigms, while PSO and GA achieve moderate results, and SA, TLBO, and HS perform less competitively across datasets\. RAG\-FGO consistently outperforms all heuristic baselines on the three benchmarks, suggesting that a structured combination of global search and local search, tailored to the RAG agent setting, is more effective than directly transferring generic heuristic search strategies\.
#### IV\-B6Cross\-Task Generalization Experiments
Transfer results across QA benchmarks suggest that the query\-rewriting agent optimized on HotpotQA can generalize to other tasks without further tuning while maintaining relatively strong performance \(Table[VI](https://arxiv.org/html/2611.17788#S4.T6)\)\. Although performance drops are observed across all targets, the degradation is more pronounced on AmbigQA and StrategyQA, where the question formulations and supervision signals differ more substantially from those of HotpotQA\.
TABLE VI:Cross\-task generalization from HotpotQA using GPT\-4o\-mini as the generator LLM\. Target\-tuned: performance with target\-specific optimization; HotpotQA→\\rightarrowTarget: performance with the agent transferred from HotpotQA;Δ\\Delta: drop in F1 score\. Results are reported in F1 \(%\)Target DatasetTarget\-tunedHotpotQA→\\rightarrowTargetΔ\\DeltaNQ73\.871\.1\-2\.7SQuAD79\.277\.3\-1\.9AmbigQA63\.959\.8\-4\.1StrategyQA70\.264\.5\-5\.7In particular, AmbigQA emphasizes ambiguity resolution across multiple plausible answers, and StrategyQA focuses on short, implicit reasoning with limited reliance on explicit multi\-hop evidence\. As a result, a rewriting policy optimized for multi\-hop evidence aggregation may not be fully aligned with the retrieval patterns favored by these benchmarks\. Nevertheless, the transferred agent remains competitive across tasks, suggesting that RAG\-FGO captures a rewriting behavior that is partially robust to task shifts\. At the same time, the observed gaps also confirm that task\-specific optimization continues to provide additional benefits when the target task departs from the characteristics of the source dataset\.
### IV\-CAblation Study
Fig\. 4:Performance \(F1, %\) as a function of mutation count \(mcmc\) on six QA benchmarks using GPT\-4o\-mini\.#### IV\-C1Impact of mc on Performance Saturation and Token Consumption
We further investigate the impact of the mutation count \(mcmc\) on both performance and computational cost across the six QA benchmarks using GPT\-4o\-mini as the generator LLM \(Figures[4](https://arxiv.org/html/2611.17788#S4.F4)and[5](https://arxiv.org/html/2611.17788#S4.F5)\)\. As shown in Figure[4](https://arxiv.org/html/2611.17788#S4.F4), F1 scores generally increase asmcmcgrows from 3 to 15 across all datasets\. The gains are most pronounced when moving frommc=3mc=3tomc=6mc=6ormc=9mc=9, after which performance improvements become marginal or saturate \(e\.g\., LongBench plateaus around 71\.5–71\.6%, HotpotQA around 81\.5%, and SQuAD at 79\.4% beyondmc=9mc=9\)\. This saturation pattern suggests that increasing the number of candidate mutations beyond a moderate range yields diminishing returns in terms of final answer quality\.
Fig\. 5:Total token consumption under differentmcmcsettings across six QA datasets\. Each subplot corresponds to a dataset\. The x\-axis denotes the mutation countmcmc, and the y\-axis reports the total tokens \(in millions, M\)\.Figure[5](https://arxiv.org/html/2611.17788#S4.F5)complements this observation by illustrating the corresponding growth in total token consumption during the optimization process\. Token usage increases rapidly withmcmc, with particularly sharp rises at higher values \(e\.g\., frommc=9mc=9tomc=15mc=15, the additional cost ranges from \+0\.34M tokens on SQuAD/HotpotQA to \+0\.50M–0\.69M on LongBench, MuSiQue, and NQ\)\. Taken together, the two figures reveal a clear accuracy–cost trade\-off: configurations aroundmc=9mc=9tomc=12mc=12\(as adopted in our main experiments\) achieve near\-saturation performance while keeping token expenditure within a reasonable range \(typically 0\.5–1\.25M tokens across datasets\), whereas pushingmcmcto 15 provides only marginal F1 gains \(0–0\.6%\) at disproportionately higher cost\. These results confirm that moderatemcmcvalues \(around 9–12, depending on the dataset\) represent an effective sweet spot for RAG\-FGO, balancing retrieval\-augmented performance and optimization efficiency\.
#### IV\-C2Component Ablation
Table[VII](https://arxiv.org/html/2611.17788#S4.T7)indicates that each module of RAG\-FGO contributes meaningfully, but their importance differs\. Removing the elite\-preserving memory pool leads to the largest degradation, with roughly 6–7 F1 drop across all datasets\. This consistent gap suggests that retaining high\-performing agents throughout the search process is crucial: without the elite\-preserving memory pool, the optimization trajectory becomes more volatile, and strong candidates are more likely to be overwritten by short\-term fluctuations, resulting in a noticeably weaker final agent\. Removing local search causes a moderate but stable decrease \(around 6–7% relative drop on average\), highlighting the value of fine\-grained refinements around strong candidates\. Disabling global search yields a smaller drop \(around 4–5% relative drop\), suggesting that broad exploration mainly improves early\-stage coverage, while later\-stage gains depend more on refinement and preservation of effective strategies\. Overall, the ablation results support a complementary design: global search provides diversity, local search improves precision, and the elite\-preserving memory pool stabilizes progress by retaining strong agents across iterations\. We next provide a process\-level analysis to explain why the elite\-preserving memory pool yields the largest gains\.
Fig\. 6:Effect of elite\-preserving memory pool on saturation during RAG\-FGO optimization process\.TABLE VII:Component ablation of RAG\-FGO across datasets \(GPT\-4o\-mini\)\. We report answer\-level F1 \(%\), and the relative change w\.r\.t\. the full model in parentheses\.ConfigurationHotpotMuSiQue2WikiNQSQuADRAG\-FGO \(full\)81\.579\.477\.373\.879\.2w/o Memory Pool75\.2 \(\-6\.3\)72\.8 \(\-6\.6\)70\.9 \(\-6\.4\)66\.9 \(\-6\.9\)72\.1 \(\-7\.1\)w/o Local Search76\.4 \(\-5\.1\)74\.2 \(\-5\.2\)72\.1 \(\-5\.2\)69\.0 \(\-4\.8\)74\.3 \(\-4\.9\)w/o Global Search78\.3 \(\-3\.2\)75\.4 \(\-4\.0\)74\.0 \(\-3\.3\)71\.2 \(\-2\.6\)76\.1 \(\-3\.1\)
#### IV\-C3Effect of elite\-preserving Memory Pool on Optimization Dynamics
Figure[6](https://arxiv.org/html/2611.17788#S4.F6)compares the semantic\-similarity trajectories during training with and without the elite\-preserving memory pool\. Across all datasets, the variant with memory exhibits a faster rise in similarity and reaches an earlier plateau, whereas the variant without memory shows larger oscillations and a lower stable level\. This pattern is especially clear on HotpotQA and 2WikiMultihopQA, where the no\-memory setting undergoes pronounced fluctuations before settling, while the memory\-based variant quickly stabilizes at a higher similarity score\. These trajectories offer a direct explanation for the large performance drop observed in Table[VII](https://arxiv.org/html/2611.17788#S4.T7)when the elite\-preserving memory pool is removed\. By retaining the best\-performing agents across iterations, the elite\-preserving memory pool prevents effective strategies from being discarded due to transient noise in the evaluation signal, leading to more stable optimization behavior and stronger final agents\.
#### IV\-C4Hyperparameter Sensitivity Analysis
To evaluate the robustness of RAG\-FGO with respect to its search\-related hyperparameters, we conduct a one\-factor\-at\-a\-time sensitivity analysis on HotpotQA\. We examine five parameters that control the behavior of agent evolution: the minimum\-change thresholdδ\\deltaused in global perturbations, the local and global perturbation scales\(σl,σg\)\(\\sigma\_\{l\},\\sigma\_\{g\}\), and the corresponding range control coefficients\(kl,kg\)\(k\_\{l\},k\_\{g\}\)\. Each parameter is varied independently within a practical neighborhood around the default configuration, while all other settings are kept fixed\.
For each setting, we report the relative change in answer\-level F1 on HotpotQA and the total token cost incurred during optimization, normalized with respect to the default configuration\. The reported ranges reflect variability across multiple independent runs \(Table[VIII](https://arxiv.org/html/2611.17788#S4.T8)\)\. Overall, the results indicate that RAG\-FGO is relatively insensitive to moderate variations of these hyperparameters, with performance changes typically within±1%\\pm 1\\%in a broad neighborhood of the default setting\. Notably, more aggressive exploration settings \(e\.g\., largerσg\\sigma\_\{g\}orkgk\_\{g\}\) can yield marginal F1 improvements, but at a substantially higher token cost\. Conversely, overly conservative configurations reduce both cost and performance\. These trends suggest that the default hyperparameter values are chosen as a balanced trade\-off between retrieval effectiveness and optimization efficiency, rather than as per\-dataset or per\-task optimal settings\.
TABLE VIII:Sensitivity analysis of search\-related hyperparametersδ,σl,σg,kl,kg\\delta,\\sigma\_\{l\},\\sigma\_\{g\},k\_\{l\},k\_\{g\}on HotpotQA\. We report normalized changes in answer\-level F1 and optimization cost \(token usage\) relative to the default configuration \(δ=1\.00,σl=1\.00,σg=0\.50,kl=0\.50,kg=0\.10\\delta=1\.00,\\ \\sigma\_\{l\}=1\.00,\\ \\sigma\_\{g\}=0\.50,\\ k\_\{l\}=0\.50,\\ k\_\{g\}=0\.10\)\.ParamValueAvg F1Costδ\\delta0\.50↓ 0\.8–1\.5%↓ 2–4%0\.75↓ 0\.1–0\.5%↓ 1–2%1\.00baselinebaseline1\.25↑ 0\.3–0\.9%↑ 1–3%1\.50↓ 0\.5–1\.2%↑ 1–3%σl\\sigma\_\{l\}0\.50↓ 0\.6–1\.2%↓ 2–4%0\.75↓ 0\.1–0\.6%↓ 1–2%1\.00baselinebaseline1\.25↑ 0\.3–0\.9%↑ 1–3%1\.50↓ 0\.5–1\.3%↑ 1–3%σg\\sigma\_\{g\}0\.00↓ 1\.0–1\.5%↓ 4–7%0\.25↓ 0\.5–1\.0%↓ 2–4%0\.50baselinebaseline0\.75↑ 0\.2–0\.8%↑ 1–3%1\.00↑ 0\.8–1\.5%↑ 3–5%klk\_\{l\}0\.00↓ 1\.0–1\.5%↓ 3–6%0\.25↓ 0\.4–0\.9%↓ 2–4%0\.50baselinebaseline0\.75↑ 0\.3–0\.9%↑ 1–3%1\.00↓ 0\.5–1\.3%↑ 1–3%kgk\_\{g\}0\.05↓ 0\.1–0\.6%↓ 1–3%0\.10baselinebaseline0\.20↑ 0\.3–1\.0%↑ 2–5%0\.30↓ 0\.5–1\.5%↑ 4–8%
## VConclusion
In this work, we present RAG\-FGO, a dynamic optimization framework that reframes generative query rewriting in retrieval\-augmented generation as a joint optimization problem over discrete prompt templates and continuous decoding parameters\. By integrating fungal growth\-inspired exploration–exploitation with an elite\-preserving memory pool, RAG\-FGO effectively navigates noisy, non\-stationary, mixed discrete–continuous strategy spaces in real\-world RAG systems\. This study highlights two core lessons: treating query reformulation as an iteratively learnable agent rather than a fixed preprocessing step unlocks substantial gains in retrieval quality under complex semantics; and balancing global semantic jumps with local refinements, stabilized by historical elite retention, is essential to overcome stochastic feedback and escape suboptimal local optima\. Looking forward, promising directions include lightweight online adaptation for continuous agent evolution during deployment, extension to multi\-modal knowledge bases and continual learning under distribution shifts, and more efficient surrogate objectives or meta\-optimization to reduce computational overhead while retaining robustness\.
## VILimitation
Despite its effectiveness, the proposed RAG\-FGO framework has several limitations\. The optimization procedure is conducted in an offline stage that requires an additional training budget prior to deployment, which may reduce flexibility in scenarios involving rapid iteration or frequent updates\. Although the optimized query\-rewriting agent operates efficiently at inference time with a single forward pass, the current framework does not support online or continual adaptation to evolving queries or dynamically changing knowledge bases\. Future work will explore lightweight online adaptation strategies and more efficient optimization schemes, as well as further evaluation in domain\-specific knowledge systems under noisy black\-box feedback\.
## Acknowledgments
This work was supported by the National Natural Science Foundation of China \(NSFC\) under the General Program \(Grant No\. 62572104\)\.
This article used large language models \(such as ChatGPT\) as an auxiliary tool in the language polishing process, but did not use them in research conception and academic content generation\.
## References
- \[1\]P\. Lewis, E\. Perez, A\. Piktus, F\. Petroni, V\. Karpukhin, N\. Goyal, H\. Küttler, M\. Lewis, W\. Yih, T\. Rocktäschel, and S\. Riedel\(2020\)Retrieval\-augmented generation for knowledge\-intensive nlp tasks\.arXiv preprint arXiv:2005\.11401\.External Links:[Link](https://arxiv.org/abs/2005.11401)Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p1.1),[§II\-A](https://arxiv.org/html/2611.17788#S2.SS1.p1.1)\.
- \[2\]Y\. Huang and J\. Huang\(2024\)A survey on retrieval\-augmented text generation for large language models\.arXiv preprint arXiv:2404\.10981\.Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p1.1)\.
- \[3\]S\. Pan, L\. Luo, Y\. Wang, C\. Chen, J\. Wang, and X\. Wu\(2024\)Unifying large language models and knowledge graphs: a roadmap\.IEEE Transactions on Knowledge and Data Engineering36\(7\),pp\. 3580–3599\.Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p1.1)\.
- \[4\]Z\. Hong, Z\. Yuan, Q\. Zhang, H\. Chen, J\. Dong, F\. Huang, and X\. Huang\(2025\)Next\-generation database interfaces: a survey of llm\-based text\-to\-sql\.IEEE Transactions on Knowledge and Data Engineering\.Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p1.1)\.
- \[5\]F\. Petroni, T\. Rocktäschel, S\. Riedel, P\. Lewis, A\. Bakhtin, Y\. Wu, and A\. Miller\(2019\)Language models as knowledge bases?\.InProceedings of the 2019 conference on empirical methods in natural language processing and the 9th international joint conference on natural language processing \(EMNLP\-IJCNLP\),pp\. 2463–2473\.Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p1.1)\.
- \[6\]K\. Shuster, S\. Poff, M\. Chen, D\. Kiela, and J\. Weston\(2021\)Retrieval augmentation reduces hallucination in conversation\.arXiv preprint arXiv:2104\.07567\.Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p1.1)\.
- \[7\]V\. Karpukhin, B\. Oguz, S\. Min, P\. S\. Lewis, L\. Wu, S\. Edunov, D\. Chen, and W\. Yih\(2020\)Dense passage retrieval for open\-domain question answering\.\.InEMNLP \(1\),pp\. 6769–6781\.Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p1.1),[§II\-A](https://arxiv.org/html/2611.17788#S2.SS1.p1.1),[§IV\-A4](https://arxiv.org/html/2611.17788#S4.SS1.SSS4.p1.1)\.
- \[8\]Y\. Gao, Y\. Xiong, X\. Gao, K\. Jia, J\. Pan, Y\. Bi, Y\. Dai, J\. Sun, H\. Wang, and H\. Wang\(2023\)Retrieval\-augmented generation for large language models: a survey\.arXiv preprint arXiv:2312\.109972\.Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p2.1),[§II\-A](https://arxiv.org/html/2611.17788#S2.SS1.p3.1)\.
- \[9\]L\. Gao, X\. Ma, J\. Lin, and J\. Callan\(2023\)Precise zero\-shot dense retrieval without relevance labels\.InProceedings of the 61st Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 1762–1777\.Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p2.1),[§II\-A](https://arxiv.org/html/2611.17788#S2.SS1.p2.1),[§IV\-A2](https://arxiv.org/html/2611.17788#S4.SS1.SSS2.p1.1)\.
- \[10\]L\. Wang, N\. Yang, and F\. Wei\(2023\)Query2doc: query expansion with large language models\.arXiv preprint arXiv:2303\.07678\.Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p2.1)\.
- \[11\]Z\. Dai, V\. Y\. Zhao, J\. Ma, Y\. Luan, J\. Ni, J\. Lu, A\. Bakalov, K\. Guu, K\. B\. Hall, and M\. Chang\(2022\)Promptagator: few\-shot dense retrieval from 8 examples\.arXiv preprint arXiv:2209\.11755\.Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p2.1)\.
- \[12\]C\. Sharma\(2025\)Retrieval\-augmented generation: a comprehensive survey of architectures, enhancements, and robustness frontiers\.arXiv preprint arXiv:2506\.00054\.Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p2.1)\.
- \[13\]C\. Yang, X\. Wang, Y\. Lu, H\. Liu, Q\. V\. Le, D\. Zhou, and X\. Chen\(2023\)Large language models as optimizers\.InThe Twelfth International Conference on Learning Representations,Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p2.1),[§II\-B](https://arxiv.org/html/2611.17788#S2.SS2.p2.1)\.
- \[14\]N\. F\. Liu, K\. Lin, J\. Hewitt, A\. Paranjape, M\. Bevilacqua, F\. Petroni, and P\. Liang\(2024\)Lost in the middle: how language models use long contexts\.Transactions of the association for computational linguistics12,pp\. 157–173\.Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p2.1)\.
- \[15\]H\. Zhang, H\. Zhang, Z\. Liu, B\. Gu, and Y\. Chang\(2025\)Collaborative discrete\-continuous black\-box prompt learning for language models\.InThe Thirteenth International Conference on Learning Representations,Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p3.1)\.
- \[16\]J\. Cheng, X\. Liu, K\. Zheng, P\. Ke, H\. Wang, Y\. Dong, J\. Tang, and M\. Huang\(2024\)Black\-box prompt optimization: aligning large language models without model training\.InProceedings of the 62nd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 3201–3219\.Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p3.1)\.
- \[17\]M\. Abdel\-Basset, R\. Mohamed, and M\. Abouhawwash\(2025\)Fungal growth optimizer: a novel nature\-inspired metaheuristic algorithm for stochastic optimization\.Computer Methods in Applied Mechanics and Engineering437,pp\. 117825\.Cited by:[§I](https://arxiv.org/html/2611.17788#S1.p4.1),[§II\-B](https://arxiv.org/html/2611.17788#S2.SS2.p3.1)\.
- \[18\]B\. Jin, G\. Liu, C\. Han, M\. Jiang, H\. Ji, and J\. Han\(2024\)Large language models on graphs: a comprehensive survey\.IEEE Transactions on Knowledge and Data Engineering\.Cited by:[§II\-A](https://arxiv.org/html/2611.17788#S2.SS1.p1.1)\.
- \[19\]O\. Khattab and M\. Zaharia\(2020\)Colbert: efficient and effective passage search via contextualized late interaction over bert\.InProceedings of the 43rd International ACM SIGIR conference on research and development in Information Retrieval,pp\. 39–48\.Cited by:[§II\-A](https://arxiv.org/html/2611.17788#S2.SS1.p1.1)\.
- \[20\]G\. Izacard and E\. Grave\(2020\)Leveraging passage retrieval with generative models for open domain question answering\.arXiv preprint arXiv:2007\.01282\.Cited by:[§II\-A](https://arxiv.org/html/2611.17788#S2.SS1.p1.1)\.
- \[21\]G\. Mialon, R\. Dessì, M\. Lomeli, C\. Nalmpantis, R\. Pasunuru, R\. Raileanu, B\. Rozière, T\. Schick, J\. Dwivedi\-Yu, A\. Celikyilmaz,et al\.\(2023\)Augmented language models: a survey\.arXiv preprint arXiv:2302\.07842\.Cited by:[§II\-A](https://arxiv.org/html/2611.17788#S2.SS1.p1.1)\.
- \[22\]Y\. Mao, P\. He, X\. Liu, Y\. Shen, J\. Gao, J\. Han, and W\. Chen\(2021\)RIDER: reader\-guided passage reranking for open\-domain question answering\.arXiv preprint arXiv:2101\.00294\.Cited by:[§II\-A](https://arxiv.org/html/2611.17788#S2.SS1.p1.1)\.
- \[23\]Z\. Jiang, F\. F\. Xu, L\. Gao, Z\. Sun, Q\. Liu, J\. Dwivedi\-Yu, Y\. Yang, J\. Callan, and G\. Neubig\(2023\)Active retrieval augmented generation\.InProceedings of the 2023 Conference on Empirical Methods in Natural Language Processing,pp\. 7969–7992\.Cited by:[§II\-A](https://arxiv.org/html/2611.17788#S2.SS1.p1.1)\.
- \[24\]W\. Shi, S\. Min, M\. Yasunaga, M\. Seo, R\. James, M\. Lewis, L\. Zettlemoyer, and W\. Yih\(2023\)Replug: retrieval\-augmented black\-box language models\.arXiv preprint arXiv:2301\.12652\.Cited by:[§II\-A](https://arxiv.org/html/2611.17788#S2.SS1.p1.1)\.
- \[25\]Y\. Bai, X\. Lv, J\. Zhang, H\. Lyu, J\. Tang, Z\. Huang, Z\. Du, X\. Liu, A\. Zeng, L\. Hou,et al\.\(2023\)Longbench: a bilingual, multitask benchmark for long context understanding\.arXiv preprint arXiv:2308\.14508\.Cited by:[§II\-A](https://arxiv.org/html/2611.17788#S2.SS1.p1.1),[§IV\-A1](https://arxiv.org/html/2611.17788#S4.SS1.SSS1.p1.1)\.
- \[26\]A\. Singh, A\. Ehtesham, S\. Kumar, and T\. T\. Khoei\(2025\)Agentic retrieval\-augmented generation: a survey on agentic rag\.arXiv preprint arXiv:2501\.09136\.Cited by:[§II\-A](https://arxiv.org/html/2611.17788#S2.SS1.p2.1)\.
- \[27\]X\. Ma, Y\. Gong, P\. He, H\. Zhao, and N\. Duan\(2023\)Query rewriting in retrieval\-augmented large language models\.InProceedings of the 2023 Conference on Empirical Methods in Natural Language Processing,pp\. 5303–5315\.Cited by:[§II\-A](https://arxiv.org/html/2611.17788#S2.SS1.p2.1),[§IV\-A2](https://arxiv.org/html/2611.17788#S4.SS1.SSS2.p1.1)\.
- \[28\]E\. Talbi\(2009\)Metaheuristics: from design to implementation\.John Wiley & Sons\.Cited by:[§II\-B](https://arxiv.org/html/2611.17788#S2.SS2.p1.1)\.
- \[29\]C\. Blum and A\. Roli\(2003\)Metaheuristics in combinatorial optimization: overview and conceptual comparison\.ACM computing surveys \(CSUR\)35\(3\),pp\. 268–308\.Cited by:[§II\-B](https://arxiv.org/html/2611.17788#S2.SS2.p1.1)\.
- \[30\]A\. Costa, E\. Di Buccio, M\. Melucci, and G\. Nannicini\(2017\)Efficient parameter estimation for information retrieval using black\-box optimization\.IEEE Transactions on Knowledge and Data Engineering30\(7\),pp\. 1240–1253\.Cited by:[§II\-B](https://arxiv.org/html/2611.17788#S2.SS2.p1.1)\.
- \[31\]C\. Fernando, D\. Banarse, H\. Michalewski, S\. Osindero, and T\. Rocktäschel\(2023\)Promptbreeder: self\-referential self\-improvement via prompt evolution\.arXiv preprint arXiv:2309\.16797\.Cited by:[§II\-B](https://arxiv.org/html/2611.17788#S2.SS2.p2.1)\.
- \[32\]W\. Li, J\. Wang, and X\. Zhang\(2024\)PROMPTIST: automated prompt optimization for text\-to\-image synthesis\.InCCF international conference on natural language processing and Chinese computing,pp\. 295–306\.Cited by:[§II\-B](https://arxiv.org/html/2611.17788#S2.SS2.p2.1)\.
- \[33\]T\. Shin, Y\. Razeghi, R\. L\. Logan IV, E\. Wallace, and S\. Singh\(2020\)Autoprompt: eliciting knowledge from language models with automatically generated prompts\.arXiv preprint arXiv:2010\.15980\.Cited by:[§II\-B](https://arxiv.org/html/2611.17788#S2.SS2.p2.1),[TABLE IV](https://arxiv.org/html/2611.17788#S4.T4.5.1.2.1)\.
- \[34\]A\. Prasad, P\. Hase, X\. Zhou, and M\. Bansal\(2023\)Grips: gradient\-free, edit\-based instruction search for prompting large language models\.InProceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics,pp\. 3845–3864\.Cited by:[§II\-B](https://arxiv.org/html/2611.17788#S2.SS2.p2.1)\.
- \[35\]M\. Deng, J\. Wang, C\. Hsieh, Y\. Wang, H\. Guo, T\. Shu, M\. Song, E\. Xing, and Z\. Hu\(2022\)Rlprompt: optimizing discrete text prompts with reinforcement learning\.InProceedings of the 2022 Conference on Empirical Methods in Natural Language Processing,pp\. 3369–3391\.Cited by:[§II\-B](https://arxiv.org/html/2611.17788#S2.SS2.p2.1),[TABLE IV](https://arxiv.org/html/2611.17788#S4.T4.5.1.4.1)\.
- \[36\]S\. Liu, C\. Chen, X\. Qu, K\. Tang, and Y\. Ong\(2024\)Large language models as evolutionary optimizers\.In2024 IEEE Congress on Evolutionary Computation \(CEC\),Vol\.,pp\. 1–8\.External Links:[Document](https://dx.doi.org/10.1109/CEC60901.2024.10611913)Cited by:[§II\-B](https://arxiv.org/html/2611.17788#S2.SS2.p2.1)\.
- \[37\]B\. Qolomany, M\. Maabreh, A\. Al\-Fuqaha, A\. Gupta, and D\. Benhaddou\(2017\)Parameters optimization of deep learning models using particle swarm optimization\.In2017 13th International Wireless Communications and Mobile Computing Conference \(IWCMC\),pp\. 1285–1290\.Cited by:[§II\-B](https://arxiv.org/html/2611.17788#S2.SS2.p2.1)\.
- \[38\]X\. Yang\(2020\)Nature\-inspired optimization algorithms\.Academic Press\.Cited by:[§II\-B](https://arxiv.org/html/2611.17788#S2.SS2.p3.1)\.
- \[39\]Z\. Yang, P\. Qi, S\. Zhang, Y\. Bengio, W\. W\. Cohen, R\. Salakhutdinov, and C\. D\. Manning\(2018\)HotpotQA: a dataset for diverse, explainable multi\-hop question answering\.arXiv preprint arXiv:1809\.09600\.Cited by:[§IV\-A1](https://arxiv.org/html/2611.17788#S4.SS1.SSS1.p1.1)\.
- \[40\]X\. Ho, A\. D\. Nguyen, S\. Sugawara, and A\. Aizawa\(2020\)Constructing a multi\-hop qa dataset for comprehensive evaluation of reasoning steps\.arXiv preprint arXiv:2011\.01060\.Cited by:[§IV\-A1](https://arxiv.org/html/2611.17788#S4.SS1.SSS1.p1.1)\.
- \[41\]H\. Trivedi, N\. Balasubramanian, T\. Khot, and A\. Sabharwal\(2022\)MuSiQue: multihop questions via single\-hop question composition\.Transactions of the Association for Computational Linguistics10,pp\. 539–554\.Cited by:[§IV\-A1](https://arxiv.org/html/2611.17788#S4.SS1.SSS1.p1.1)\.
- \[42\]T\. Kwiatkowski, J\. Palomaki, O\. Redfield, M\. Collins, A\. Parikh, C\. Alberti, D\. Epstein, I\. Polosukhin, J\. Devlin, K\. Lee,et al\.\(2019\)Natural questions: a benchmark for question answering research\.Transactions of the Association for Computational Linguistics7,pp\. 453–466\.Cited by:[§IV\-A1](https://arxiv.org/html/2611.17788#S4.SS1.SSS1.p1.1)\.
- \[43\]P\. Rajpurkar, J\. Zhang, K\. Lopyrev, and P\. Liang\(2016\)Squad: 100,000\+ questions for machine comprehension of text\.arXiv preprint arXiv:1606\.05250\.Cited by:[§IV\-A1](https://arxiv.org/html/2611.17788#S4.SS1.SSS1.p1.1)\.
- \[44\]M\. Geva, D\. Khashabi, E\. Segal, T\. Khot, D\. Roth, and J\. Berant\(2021\)Did aristotle use a laptop? a question answering benchmark with implicit reasoning strategies\.Transactions of the Association for Computational Linguistics9,pp\. 346–361\.Cited by:[§IV\-A1](https://arxiv.org/html/2611.17788#S4.SS1.SSS1.p1.1)\.
- \[45\]S\. Min, J\. Michael, H\. Hajishirzi, and L\. Zettlemoyer\(2020\)AmbigQA: answering ambiguous open\-domain questions\.arXiv preprint arXiv:2004\.10645\.Cited by:[§IV\-A1](https://arxiv.org/html/2611.17788#S4.SS1.SSS1.p1.1)\.
- \[46\]A\. Mallen, A\. Asai, V\. Zhong, R\. Das, D\. Khashabi, and H\. Hajishirzi\(2023\)When not to trust language models: investigating effectiveness of parametric and non\-parametric memories\.InProceedings of the 61st Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 9802–9822\.Cited by:[§IV\-A1](https://arxiv.org/html/2611.17788#S4.SS1.SSS1.p1.1)\.
- \[47\]D\. Hendrycks, C\. Burns, S\. Kadavath, A\. Arora, S\. Basart, E\. Tang, D\. Song, and J\. Steinhardt\(2021\)Measuring mathematical problem solving with the math dataset\.arXiv preprint arXiv:2103\.03874\.Cited by:[§IV\-A1](https://arxiv.org/html/2611.17788#S4.SS1.SSS1.p1.1)\.
- \[48\]Y\. Wang, X\. Ma, G\. Zhang, Y\. Ni, A\. Chandra, S\. Guo, W\. Ren, A\. Arulraj, X\. He, Z\. Jiang,et al\.\(2024\)Mmlu\-pro: a more robust and challenging multi\-task language understanding benchmark\.Advances in Neural Information Processing Systems37,pp\. 95266–95290\.Cited by:[§IV\-A1](https://arxiv.org/html/2611.17788#S4.SS1.SSS1.p1.1)\.
- \[49\]D\. Rein, B\. L\. Hou, A\. C\. Stickland, J\. Petty, R\. Y\. Pang, J\. Dirani, J\. Michael, and S\. R\. Bowman\(2024\)Gpqa: a graduate\-level google\-proof q&a benchmark\.InFirst Conference on Language Modeling,Cited by:[§IV\-A1](https://arxiv.org/html/2611.17788#S4.SS1.SSS1.p1.1)\.
- \[50\]D\. Dua, Y\. Wang, P\. Dasigi, G\. Stanovsky, S\. Singh, and M\. Gardner\(2019\)DROP: a reading comprehension benchmark requiring discrete reasoning over paragraphs\.arXiv preprint arXiv:1903\.00161\.Cited by:[§IV\-A1](https://arxiv.org/html/2611.17788#S4.SS1.SSS1.p1.1)\.
- \[51\]Z\. Sprague, X\. Ye, K\. Bostrom, S\. Chaudhuri, and G\. Durrett\(2023\)Musr: testing the limits of chain\-of\-thought with multistep soft reasoning\.arXiv preprint arXiv:2310\.16049\.Cited by:[§IV\-A1](https://arxiv.org/html/2611.17788#S4.SS1.SSS1.p1.1)\.
- \[52\]S\. Yao, J\. Zhao, D\. Yu, N\. Du, I\. Shafran, K\. Narasimhan, and Y\. Cao\(2023\)React: synergizing reasoning and acting in language models\.InInternational Conference on Learning Representations \(ICLR\),Cited by:[§IV\-A2](https://arxiv.org/html/2611.17788#S4.SS1.SSS2.p1.1)\.
- \[53\]O\. Press, M\. Zhang, S\. Min, L\. Schmidt, N\. A\. Smith, and M\. Lewis\(2022\)Measuring and narrowing the compositionality gap in language models\.arXiv preprint arXiv:2210\.03350\.Cited by:[§IV\-A2](https://arxiv.org/html/2611.17788#S4.SS1.SSS2.p1.1)\.
- \[54\]J\. Zhang, J\. Xiang, Z\. Yu, F\. Teng, X\. Chen, J\. Chen, M\. Zhuge, X\. Cheng, S\. Hong, J\. Wang,et al\.\(2024\)Aflow: automating agentic workflow generation\.arXiv preprint arXiv:2410\.10762\.Cited by:[§IV\-A2](https://arxiv.org/html/2611.17788#S4.SS1.SSS2.p1.1)\.
- \[55\]X\. Chen, R\. Aksitov, U\. Alon, J\. Ren, K\. Xiao, P\. Yin, S\. Prakash, C\. Sutton, X\. Wang, and D\. Zhou\(2023\)Universal self\-consistency for large language model generation\.arXiv preprint arXiv:2311\.17311\.Cited by:[§IV\-A2](https://arxiv.org/html/2611.17788#S4.SS1.SSS2.p1.1)\.
- \[56\]X\. Wang and D\. Zhou\(2024\)Chain\-of\-thought reasoning without prompting\.Advances in Neural Information Processing Systems37,pp\. 66383–66409\.Cited by:[§IV\-A2](https://arxiv.org/html/2611.17788#S4.SS1.SSS2.p1.1)\.
- \[57\]T\. Zhang, A\. Madaan, L\. Gao, S\. Zheng, S\. Mishra, Y\. Yang, N\. Tandon, and U\. Alon\(2024\)In\-context principle learning from mistakes\.arXiv preprint arXiv:2402\.05403\.Cited by:[§IV\-A2](https://arxiv.org/html/2611.17788#S4.SS1.SSS2.p1.1)\.
- \[58\]D\. Lee, J\. Hong, D\. Kim, and J\. Kim\(2025\)Training\-free llm verification via recycling few\-shot examples\.arXiv preprint arXiv:2506\.17251\.Cited by:[§IV\-A2](https://arxiv.org/html/2611.17788#S4.SS1.SSS2.p1.1)\.
- \[59\]R\. Jagerman, H\. Zhuang, Z\. Qin, X\. Wang, and M\. Bendersky\(2023\)Query expansion by prompting large language models\.arXiv preprint arXiv:2305\.03653\.Cited by:[§IV\-A2](https://arxiv.org/html/2611.17788#S4.SS1.SSS2.p1.1)\.
- \[60\]I\. Baek, J\. Lee, J\. Yang, and H\. Lee\(2025\)Crafting the path: robust query rewriting for information retrieval\.IEEE Access\.Cited by:[§IV\-A2](https://arxiv.org/html/2611.17788#S4.SS1.SSS2.p1.1)\.
- \[61\]R\. Rafailov, A\. Sharma, E\. Mitchell, C\. D\. Manning, S\. Ermon, and C\. Finn\(2023\)Direct preference optimization: your language model is secretly a reward model\.Advances in neural information processing systems36,pp\. 53728–53741\.Cited by:[§IV\-A2](https://arxiv.org/html/2611.17788#S4.SS1.SSS2.p1.1)\.
- \[62\]X\. Ye, C\. Xu, C\. Zhang, Z\. Du, J\. Xu, G\. Wang, and Z\. Dong\(2025\)Q\-prm: adaptive query rewriting for retrieval\-augmented generation via step\-level process supervision\.InFindings of the Association for Computational Linguistics: EMNLP 2025,pp\. 15113–15128\.Cited by:[§IV\-A2](https://arxiv.org/html/2611.17788#S4.SS1.SSS2.p1.1)\.
- \[63\]H\. Xu, Y\. Chen, Y\. Du, N\. Shao, W\. Yanggang, H\. Li, and Z\. Yang\(2022\)Gps: genetic prompt search for efficient few\-shot learning\.InProceedings of the 2022 Conference on Empirical Methods in Natural Language Processing,pp\. 8162–8171\.Cited by:[TABLE IV](https://arxiv.org/html/2611.17788#S4.T4.5.1.3.1)\.
- \[64\]L\. Wang, N\. Yang, X\. Huang, B\. Jiao, L\. Yang, D\. Jiang, R\. Majumder, and F\. Wei\(2022\)Text embeddings by weakly\-supervised contrastive pre\-training\.arXiv preprint arXiv:2212\.03533\.Cited by:[§IV\-A4](https://arxiv.org/html/2611.17788#S4.SS1.SSS4.p1.1)\.
- \[65\]J\. Johnson, M\. Douze, and H\. Jégou\(2019\)Billion\-scale similarity search with gpus\.IEEE Transactions on Big Data7\(3\),pp\. 535–547\.Cited by:[§IV\-A4](https://arxiv.org/html/2611.17788#S4.SS1.SSS4.p1.1)\.
- \[66\]J\. Kennedy and R\. Eberhart\(1995\)Particle swarm optimization\.InProceedings of ICNN’95\-international conference on neural networks,Vol\.4,pp\. 1942–1948\.Cited by:[TABLE V](https://arxiv.org/html/2611.17788#S4.T5.5.2.1)\.
- \[67\]A\. Lambora, K\. Gupta, and K\. Chopra\(2019\)Genetic algorithm\-a literature review\.In2019 international conference on machine learning, big data, cloud and parallel computing \(COMITCon\),pp\. 380–384\.Cited by:[TABLE V](https://arxiv.org/html/2611.17788#S4.T5.5.3.1)\.
- \[68\]S\. Kirkpatrick, C\. D\. Gelatt Jr, and M\. P\. Vecchi\(1983\)Optimization by simulated annealing\.science220\(4598\),pp\. 671–680\.Cited by:[TABLE V](https://arxiv.org/html/2611.17788#S4.T5.5.4.1)\.
- \[69\]M\. Ghaemi and M\. Feizi\-Derakhshi\(2014\)Forest optimization algorithm\.Expert systems with applications41\(15\),pp\. 6676–6687\.Cited by:[TABLE V](https://arxiv.org/html/2611.17788#S4.T5.5.5.1)\.
- \[70\]R\. V\. Rao, V\. J\. Savsani, and D\. P\. Vakharia\(2011\)Teaching–learning\-based optimization: a novel method for constrained mechanical design optimization problems\.Computer\-aided design43\(3\),pp\. 303–315\.Cited by:[TABLE V](https://arxiv.org/html/2611.17788#S4.T5.5.6.1)\.
- \[71\]Z\. W\. Geem, J\. H\. Kim, and G\. V\. Loganathan\(2001\)A new heuristic optimization algorithm: harmony search\.simulation76\(2\),pp\. 60–68\.Cited by:[TABLE V](https://arxiv.org/html/2611.17788#S4.T5.5.7.1)\.Similar Articles
In-Context Optimization for Retrieval-Augmented Generation: A Gradient-Descent Perspective
This paper studies retrieval-augmented generation as an in-context optimization process, showing that linear self-attention can implement gradient descent on a unified RAG objective. It proposes a lightweight method for frozen RAG LLMs that predicts context-conditioned updates, improving performance across multiple QA benchmarks.
GuidedRAG: Semantic Steering of Retrieval-Augmented Generation
GuidedRAG is a research paper proposing a novel RAG extension that adds a semantics-based selection stage before retrieval, improving retrieval relevance and reducing overhead across diverse RAG variants.
LatentRAG: Latent Reasoning and Retrieval for Efficient Agentic RAG
LatentRAG is a novel framework that shifts reasoning and retrieval for agentic RAG into continuous latent space, reducing inference latency by approximately 90% while maintaining performance comparable to explicit methods.
ScalableRAG: High-Quality RAG at Zero Ingestion Cost
This paper introduces ScalableRAG, a retrieval-augmented generation method that achieves high accuracy without any ingestion costs (no vector database or knowledge graph) by using regex-based set creation and aggregative reasoning. It outperforms baselines on multiple datasets and also presents a limited-ingestion variant for further accuracy improvements.
RAGA: Reading-And-Graph-building-Agent for Autonomous Knowledge Graph Construction and Retrieval-Augmented Generation
RAGA is an LLM-driven autonomous agent that constructs knowledge graphs via a read-search-verify-construct cognitive loop and integrates hybrid symbolic-vector retrieval for retrieval-augmented generation, with experimental gains on scientific QA datasets.