NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Understanding the Impact of Confidence in Retrieval Augmented Generation: A Case Study in the Medical Domain

Shintaro Ozaki, Yuta Kato, Siyuan Feng, Masayo Tomita, Kazuki Hayashi, Wataru Hashimoto, Ryoma Obara, Masafumi Oyamada, Katsuhiko Hayashi, Hidetaka Kamigaito, Taro Watanabe

TL;DR

While Retrieval-Augmented Generation (RAG) is widely celebrated for boosting the accuracy of Large Language Models (LLMs), how does it affect a model's confidence? This paper systematically evaluates nine LLMs in the medical domain and discovers a stark divide: while capable models like Phi-3.5 and Qwen2.5 successfully calibrate their confidence based on document relevance, other popular models like Llama and Gemma struggle to integrate retrieved context effectively, occasionally leading to unwarranted overconfidence.

What Problem Does This Paper Address?

In high-stakes domains like healthcare, it isn't enough for an AI to be right; it also needs to "know what it knows." RAG is frequently used to mitigate hallucinations by injecting external, up-to-date knowledge into prompts. However, its impact on confidence calibration—the alignment between a model's predicted probability and its actual accuracy—remains poorly understood.

If an LLM receives a retrieved document, does it become blindly overconfident, or does it intelligently weigh the relevance of the text? The authors tackle this question to determine whether LLMs can truly act as reliable decision-support generators in critical medical applications.

Figure 1: The focus of our research is to analyze whether RAG improves the confidence of the model response.

Methods

The researchers designed a rigorous evaluation framework using force decoding. Instead of letting the models generate free-text answers (which introduces evaluation inconsistencies due to varying phrasing), they directly measured the log-probabilities (logits) assigned by the models to specific multiple-choice options (e.g., A, B, C, D).

To thoroughly test the models' discernment, they manipulated the inputs across three dimensions:

  1. Document Relevance Scenarios: Models were fed either the exact correct explanation (Ans1), a mix of the correct explanation and two irrelevant documents (Ans1-Oth2), or three entirely irrelevant documents (Oth3).
  2. Context Placement: To test for the notorious "Lost-in-the-Middle" phenomenon, documents were inserted at three different positions: before the question (Pre-Q), between the question and choices (Aft-Q), or after the choices (Aft-C).
  3. Metrics: The authors evaluated performance using Entropy (uncertainty), Best Probability (confidence), raw Accuracy, and Adaptive Calibration Error (ACE).
Figure 2: Prompts used in our research. Each prompt begins with a concatenated of the system prompt. Fol- lowing MIRAGE (Xiong et al., 2024), we design the templates to enable the calculation of probabilities.

Datasets

The study utilized two prominent multiple-choice medical QA datasets that explicitly include explanatory passages justifying the correct answers:

  • PubMedQA: 1,000 expert-annotated question-answer pairs with 3 choices (Yes/No/Maybe).
  • MedMCQA (Extract): A subset of 2,206 questions derived from Indian medical entrance exams, featuring 4 choices and detailed rationales.

Key Insights and Ideas

  • The "Ideal" vs. "Stagnant" Model Divide: Phi-3.5 and the Qwen2.5 family exhibited ideal calibration behavior. When given relevant documents, their uncertainty (entropy) plummeted. When given irrelevant documents, they successfully ignored them and relied on their internal knowledge. Conversely, Llama 2, Llama 3.1, and Gemma 2 models showed flat, rigid probability distributions, suggesting they struggled to dynamically process the context under this forced-choice setup.
  • Accuracy vs. Calibration Trade-off: The position of the retrieved document matters. Placing the context before the question (Pre-Q) yielded the highest raw accuracy. However, placing it after the choices (Aft-C) resulted in the lowest entropy and best-calibrated reliability.
  • RAG Cures Overconfidence (For Some): Without RAG, incorrect predictions often concentrated at high confidence levels (overconfidence). Introducing relevant documents helped capable models shift their probability mass appropriately, correcting this dangerous behavior.

Key Results

The quantitative results highlight the strong performance of specific architectures:

  • Dynamic Sensitivity: For Phi-3.5 on MedMCQA, the baseline entropy without RAG was 0.933. When provided with the correct document (Ans1), its entropy dropped sharply to 0.051, indicating a massive, well-placed surge in confidence. Qwen2.5-72B demonstrated a similar ideal drop from 0.819 to 0.444.
  • Calibration Errors: In the PubMedQA evaluations, Qwen2.5-14B achieved a remarkably low Adaptive Calibration Error (ACE) of 3.460 in the Aft-Q position with correct documents, compared to its baseline non-RAG error of 15.874.
  • The Llama Anomaly: In contrast, Llama 3.1-70B's entropy remained completely unchanged (1.35) across all RAG configurations on MedMCQA, demonstrating a strict adherence to its base instruction tuning that prevented it from leveraging the context to adjust its confidence.
Figure 3: The transition of experimental results using MedMCQA. The figure classifies correctly answered and incorrectly answered questions, illustrating how their distributions shift. This visualization corresponds to the Ans1 setting, with plots for all three conditions: Pre-Q, Aft-Q, and Aft-C.

Limitations and Future Work

The authors acknowledge several constraints in their study:

  • Domain Specificity: The evaluation was strictly confined to the medical domain. The dynamics of confidence calibration might differ in other technical fields like finance or law.
  • Basic RAG Architectures: The study focused entirely on standard prompt-injection RAG. It did not explore advanced, iterative RAG frameworks that feature active control mechanisms (e.g., Self-RAG or FLARE).
  • Forced Decoding Constraint: While force decoding ensures clean metric tracking, it does not perfectly mirror real-world conversational deployments where models generate free-text explanations alongside their answers.

Summary updated

BibTeX
@misc{ozaki2024understanding,
  author = {Shintaro Ozaki and Yuta Kato and Siyuan Feng and Masayo Tomita and Kazuki Hayashi and Wataru Hashimoto and Ryoma Obara and Masafumi Oyamada and Katsuhiko Hayashi and Hidetaka Kamigaito and Taro Watanabe},
  title = {{Understanding the Impact of Confidence in Retrieval Augmented Generation: A Case Study in the Medical Domain}},
  year = {2024},
  eprint = {2412.20309},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.20309},
}
Figure