Query Optimization for Parametric Knowledge Refinement in Retrieval-Augmented Large Language Models

Youan Cong, Pritom Saha Akash, Cheng Wang, Kevin Chen–Chuan Chang

Abstract

We introduce the Extract-Refine-Retrieve-Read (ERRR) framework, a novel approach designed to bridge the pre-retrieval information gap in Retrieval-Augmented Generation (RAG) systems through query optimization tailored to meet the specific knowledge requirements of Large Language Models (LLMs). Unlike conventional query optimization techniques used in RAG, the ERRR framework begins by extracting parametric knowledge from LLMs, followed by using a specialized query optimizer for refining these queries. This process ensures the retrieval of only the most pertinent information essential for generating accurate responses. Moreover, to enhance flexibility and reduce computational costs, we propose a trainable scheme for our pipeline that utilizes a smaller, tunable model as the query optimizer, which is refined through knowledge distillation from a larger teacher model. Our evaluations on various question-answering (QA) datasets and with different retrieval systems show that ERRR consistently outperforms existing baselines, proving to be a versatile and cost-effective module for improving the utility and accuracy of RAG systems.

Introduction

Retrieval-Augmented Generation (RAG) is the industry standard for reducing hallucinations in Large Language Models (LLMs), but it often suffers from a pre-retrieval gap. This gap represents a mismatch between a user’s raw query and the specific information an LLM actually needs to generate a correct answer.

Standard RAG systems typically use the original query or a simple rewrite to search external databases. However, if the query is vague, the retriever may return irrelevant documents. Existing solutions like Rewrite-Retrieve-Read (RRR) attempt to fix this by rephrasing the query, but they often ignore the LLM's internal "parametric" knowledge—what the model already knows or assumes about the topic. Without accounting for this internal state, the system might retrieve redundant information or fail to verify the model's own misconceptions.

Methodology

The proposed ERRR framework addresses this by breaking the retrieval process into four distinct steps:

  1. Extract: The LLM generates a "pseudo-contextual document," essentially externalizing its internal parametric knowledge regarding the query.
  2. Refine: A specialized Query Optimizer evaluates both the original query and the extracted internal knowledge. It identifies missing pieces or facts requiring verification and generates optimized search queries.
  3. Retrieve: These refined queries are sent to external sources (e.g., Brave Search API or local vector databases).
  4. Read: The LLM "reader" synthesizes the retrieved documents and the original query to produce the final response.

To make this framework production-ready, we introduced a Trainable ERRR scheme. Using knowledge distillation, we trained a smaller, open-source model (T5-Large) to act as the Query Optimizer, mimicking the high-quality query generation of a larger teacher model while significantly reducing latency and API costs.

Comparison of architectural approaches: (i) Direct, (ii) Rewrite-Retrieve-Read, and (iii) the proposed Extract-Refine-Retrieve-Read (ERRR) framework.

Experimental Evaluation

The framework was evaluated on three diverse open-domain Question Answering (QA) benchmarks:

  • AmbigQA: Focuses on ambiguous questions requiring disambiguation.
  • PopQA: Targets "long-tail" knowledge where LLMs typically struggle.
  • HotpotQA: Requires multi-hop reasoning across multiple documents.

Evaluations were conducted using both web-based retrieval and local dense retrieval (WikiDPR).

Results and Discussion

ERRR consistently outperformed standard RAG and the previous state-of-the-art Rewrite-Retrieve-Read (RRR) across all benchmarks. The most significant insight is that internal knowledge acts as a compass; even if the initial extraction contains errors, the Refinement step can recognize uncertainty and generate queries specifically to validate or debunk those facts.

Performance metrics (Exact Match and F1 scores) across AmbigQA, PopQA, and HotPotQA datasets, comparing ERRR variants against standard baselines.

Key results include:

  • Superior Accuracy: Trainable ERRR achieved an Exact Match (EM) score of 0.4975 on AmbigQA, outperforming standard RAG (0.473) and Trainable RRR (0.460).
  • Efficiency and Cost: The distilled Trainable ERRR was approximately 50% cheaper and significantly faster than iterative frameworks like ReAct or Self-RAG, which require multiple expensive LLM calls.
  • Resilience: ERRR showed remarkable resilience when using local retrievers with limited corpora. By optimizing queries to align with the reader's specific needs, it filtered out irrelevant noise that often trips up standard models.

Conclusion

The ERRR framework effectively bridges the pre-retrieval gap by leveraging internal parametric knowledge to guide external search. While currently designed for single-turn interactions, it demonstrates a clear path toward more accurate and cost-effective RAG systems. Future work will focus on extending the framework to multi-turn conversations and utilizing reinforcement learning to further align the query optimizer with the reader's performance.

Summary updated

BibTeX
@misc{cong2024query,
  author = {Youan Cong and Pritom Saha Akash and Cheng Wang and Kevin Chen–Chuan Chang},
  title = {{Query Optimization for Parametric Knowledge Refinement in Retrieval-Augmented Large Language Models}},
  year = {2024},
  eprint = {2411.07820},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.07820},
}
Figure