Manuscript Offprint

arXiv:2609.37574

MERGE: Multi-LLM Ensemble for Retrieval via Generative Enrichment

Tzu-I Ho, Yung-Yu Shih, Shang-Yu Su, Dongzhe Wang, Yun-Nung Chen

Abstract

Large Language Models (LLMs) are increasingly used to enrich user queries in information retrieval (IR) so that a standard retriever such as BM25 can bridge vocabulary gaps with the target corpus. Any single LLM, however, is limited by its training data and architectural biases, and its enrichment behavior depends on handcrafted prompts that must be re-engineered for each new model—an expensive and poorly scalable process. We present MERGE (Multi-LLM Ensemble for Retrieval via Generative Enrichment), a two-stage framework: three heterogeneous 7–8B open-source LLMs independently produce candidate expansions, and a larger LLM generatively synthesizes them into a single query. To make prompt engineering scalable across the ensemble, we integrate a task-grounded Automatic Prompt Optimization (APO) loop into both stages. Unlike APO methods that judge candidates with an LLM evaluator, our loop scores each candidate by its downstream retrieval performance and runs a small tournament between the current champion prompt and optimizer-proposed drafts, terminating once the champion survives two consecutive rounds; a history-augmented variant additionally feeds the recent tournament trajectory back to the optimizer. MERGE is retriever-agnostic and issues a single BM25 pass with no rank fusion, no supervised document expansion, and no re-indexing. On five BEIR benchmarks (NQ, SciFact, FiQA, Touché-2020, DB-Pedia), MERGE improves BM25 nDCG@10 over the original queries by +2.1 to +14.9 points and matches or outperforms strong LLM-based query-expansion baselines despite using only compact open-source models. Ablations confirm that the Stage-2 ensemble beats any single Stage-1 LLM, and that task-grounded APO converts large seed-prompt regressions into consistent gains without hand-tuning.

1 Introduction

Large Language Models (LLMs) have become central components of modern information retrieval (IR) pipelines (Zhu et al., 2023). For query-side enrichment in particular, methods such as Query2Doc (Wang et al., 2023a) and HyDE (Gao et al., 2023) use an LLM to generate pseudodocuments or hypothetical answers that clarify user intent and improve retrieval. The common thread is contextual query enrichment: an LLM rewrites the user query so that a downstream retriever—often a strong lexical retriever such as BM25—can more easily match it with relevant passages.

Two problems limit the practical impact of this line of work. First, LLMs inherit biases and blind spots from their training data and architecture (Bender et al., 2021), so a single model tends to produce enrichments with a distinctive but narrow style—missing rephrasings, hallucinating details, or overcommitting to a specific interpretation of an ambiguous query. Second, controlling enrichment behavior relies heavily on hand-crafted prompts, and prompts that work well for one model family (e.g., Qwen2.5) transfer poorly to another (e.g., Llama-3.3 or Mistral) without a further round of manual tuning. This burden grows with the number of LLMs one wishes to combine, making multi-LLM ensembles hard to scale and hard to justify on cost grounds.

We address both problems with MERGE (Multi-LLM Ensemble for Retrieval via Generative Enrichment). MERGE processes an input query x through two stages, illustrated in Figure 1:

• Generation. Multiple heterogeneous LLMs independently produce enriched query candidates y1,…,yny_{1}, \ldots, y_{n}, exposing diverse but complementary views of the user's intent. Each generator uses a prompt that has been automatically specialized to its own model.

∗^{*}The first two authors contributed equally.

†^{\dagger}Work done during an internship at Taiwan Rakuten Ichiba, Inc.

• Ensemble. An LLM generatively synthesizes {y1,…,yn}\{y_{1},\ldots,y_{n}\} into a single unified query expansion y^\hat{y}, filtering likely hallucinations and merging complementary information under an APO-tuned ensemble prompt.

MERGE embodies dual-level ensemble: horizontal ensemble across heterogeneous generators within Stage 1, and vertical ensemble across the specialized Stage-1 / Stage-2 pipeline (Dietterich, 2000). Compared to selection-based fusion (Jiang et al., 2023b; Tekin et al., 2024) it retains full generative flexibility; compared to single-stage LLM expansion (Wang et al., 2023a; Gao et al., 2023) it explicitly separates producing diverse candidates from synthesizing them.

To address the scalability concern above, we integrate a task-grounded Automatic Prompt Optimization (APO) loop into both stages of MERGE. Starting from hand-crafted seed prompts, our APO loop iteratively rewrites and evolves each generator's prompt and the ensemble prompt under a retrieval-driven objective; each LLM ultimately runs with a prompt specialized to itself rather than a one-size-fits-all template. Unlike prior APO methods that rely on an LLM judge, our loop scores each candidate prompt by its actual retrieval performance on a small labelled subset and feeds this numerical signal, together with the history of previously tried prompts, back into the optimizer LLM. As a result, adding a new LLM to the generation stage no longer requires manual prompt engineering, and improvements in one LLM's prompt do not silently degrade the ensemble's behavior. Since APO is applied once and reused, its optimization cost is amortized over all downstream retrieval runs.

We evaluate MERGE on five diverse BEIR benchmarks (Thakur et al., 2021)—NQ (Kwiatkowski et al., 2019), SciFact (Wadden et al., 2020), FiQA (Maia et al., 2018), Touché-2020 (Bondarenko et al., 2020), and DBPedia (Hasibi et al., 2017)—covering open-domain QA, scientific claim verification, financial opinion QA, argument retrieval, and entity retrieval. Our contributions are as follows:

• We propose MERGE, an IR-focused two-stage LLM ensemble that enriches user queries by combining heterogeneous multi-LLM generation with a generative ensemble step.

• We introduce a task-grounded APO loop that scores candidate prompts by their actual downstream retrieval performance rather than by an LLM judge, and apply it to both stages of MERGE. This turns per-LLM prompt engineering from a manual, non-scalable step into an automatic, model-specific optimization.

• MERGE is retriever-agnostic: its output is a plain-text query that can be fed to any retriever. Across five BEIR datasets, MERGE-enriched queries improve BM25 retrieval over the original queries on all five benchmarks and match or outperform strong LLM-based query-expansion baselines, with ablations that isolate the contributions of the ensemble stage and of APO. We adopt BM25 as the shared retrieval backbone in our experiments, matching the standard setup used in prior LLM-based query-expansion work, so that measured gains reflect how the query is manipulated rather than a jointly trained retriever.

References (12)