Each to Their Own: Exploring the Optimal Embedding in RAG

Shiting Chen, Zijian Zhao, Jinsong Chen

TL;DR

This paper tackles the instability of Retrieval-Augmented Generation (RAG) in mathematics, where different embedding models yield varying results. They propose "Confident RAG," which leverages multiple embedding models to generate answers and then selects the most confident one, achieving significant accuracy improvements.

What Problem Does This Paper Address?

Large Language Models (LLMs) show great promise for education, but they often struggle with complex reasoning, especially in mathematics, where precision is paramount. Retrieval-Augmented Generation (RAG) helps by grounding LLMs in external knowledge, but its effectiveness is hampered by the choice of a single embedding model. Different embedding models capture semantic nuances differently, leading to inconsistent retrieval quality and, consequently, unreliable LLM outputs for mathematical tasks. This paper aims to create a more robust and trustworthy RAG system for mathematics education by effectively combining the strengths of multiple embedding models.

Methods

The authors propose two novel RAG approaches:

  • Mixture-Embedding RAG: This method combines retrieved documents from multiple embedding models. It standardizes similarity scores using Z-scores to mitigate bias from different embedding model ranges and then selects the top-k chunks for the LLM.
  • Confident RAG: This approach is the core contribution. It involves using vanilla RAG with each of the multiple embedding models to generate an answer independently. Then, it uses various confidence metrics (like self-certainty and distributional perplexity) to score these generated answers. Finally, it selects the answer with the highest confidence score as the final output. This method aims to filter out less reliable generations by relying on the LLM's self-assessed certainty.

Datasets

  • Corpus: The study used two types of corpora:
  • Mathematics textbooks from OpenStax (covering calculus, algebra, and trigonometry).
  • Math QA items from the Gsm8k training dataset.
  • User Questions: The first 500 items from the test dataset of Gsm8k were used as user questions.

Key Insights and Ideas

  • Embedding Models are Specialists: Different embedding models have their own "prior domains" and excel at capturing specific types of semantic similarity, making a single choice suboptimal for diverse mathematical queries.
  • Mixture-Embedding RAG Falls Short: Simply combining retrieved documents from multiple embedding models didn't yield significant improvements and, in some cases, even decreased accuracy. This suggests that simply aggregating more information isn't always better and can sometimes introduce noise or confusion.
  • Confidence is Key for Reliability: The "aha moment" is that by generating multiple answers and selecting the most confident one, the system can effectively filter out errors. This is particularly crucial in mathematics where a single mistake can invalidate an entire solution.
  • Self-Certainty and Distributional Perplexity Shine: These two confidence metrics proved to be the most effective in identifying high-quality answers, showing a strong correlation with accuracy.
  • Optimal Number of Embeddings: The study found that using 3 embedding models often provided a good balance between diversity and computational cost, with diminishing returns beyond that.

Key Results

  • Vanilla RAG Improvement: Applying RAG to vanilla LLMs improved accuracy by an average of 5% across the tested LLMs.
  • Confident RAG Dominance: Confident RAG achieved average accuracy improvements of approximately 10% over vanilla LLMs and 5% over vanilla RAG.
  • Metric Performance: Self-certainty and Distributional Perplexity (DP) showed average improvements of about 9.9% and 9.7%, respectively, over vanilla LLM performance.
  • LLM Generalization: The improvements from Confident RAG were consistent across different LLMs (Qwen2.5-Math-7B, Llama-3.1-8B, and OLMo-2-1124-7B), indicating its generalizability.

Limitations and Future Work

  • Domain Specificity: The current experiments were limited to the GSM8K benchmark and mathematical textbooks. Future work should validate Confident RAG across diverse academic domains to test its robustness and generalizability.
  • System Integration: While the framework is validated, it hasn't been integrated into a complete, user-facing educational system. Future research should focus on building a functional AI math tutoring system incorporating Confident RAG to assess its usability and practical impact.
  • Agentic RAG Deployment: The authors suggest that Confident RAG provides a strong foundation for deploying fully autonomous Agentic RAG systems in educational settings. Future work could explore how agents can dynamically determine the optimal number of embedding models or initiate iterative refinement based on confidence scores.

Summary updated

Abstract

Recently, as Large Language Models (LLMs) have fundamentally impacted various fields, the methods for incorporating up-to-date information into LLMs or adding external knowledge to construct domain-specific models have garnered wide attention. Retrieval-Augmented Generation (RAG), serving as an inference-time scaling method, is notable for its low cost and minimal effort for parameter tuning. However, due to heterogeneous training data and model architecture, the variant embedding models used in RAG exhibit different benefits across various areas, often leading to different similarity calculation results and, consequently, varying response quality from LLMs. To address this problem, we propose and examine two approaches to enhance RAG by combining the benefits of multiple embedding models, named Mixture-Embedding RAG and Confident RAG. Mixture-Embedding RAG simply sorts and selects retrievals from multiple embedding models based on standardized similarity; however, it does not outperform vanilla RAG. In contrast, Confident RAG generates responses multiple times using different embedding models and then selects the responses with the highest confidence level, demonstrating average improvements of approximately 10% and 5% over vanilla LLMs and RAG, respectively. The consistent results across different LLMs and embedding models indicate that Confident RAG is an efficient plug-and-play approach for various domains. We will release our code upon publication.
BibTeX
@inproceedings{chen2026each,
  author = {Shiting Chen and Zijian Zhao and Jinsong Chen},
  title = {{Each to Their Own: Exploring the Optimal Embedding in RAG}},
  booktitle = {LLM Reasoning @ ICLR},
  year = {2026},
  url = {https://openreview.net/forum?id=ulWkul8wWm},
}
Figure