Manuscript Offprint

arXiv:2608.27661

Knowing Before Answering: Decoding Language Models for Reliable RAG

Syed Mahbubul Huq, Christopher Child, Tillman Weyde, Pranava Madhyastha

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

In Retrieval-Augmented Generation (RAG), retrieval may provide insufficient or conflicting information needed to answer a question. The system should not only know when to answer but also be able to identify cases in which the documents provided in RAG are insufficient or contain conflicting information. This can be framed as a three-way classification problem, where we use the model's internal signals to determine whether the provided information in the input can be classified as sufficient, insufficient, or conflicting. We create a controlled benchmark dataset that replicates a RAG setup with fictitious information and labels each instance as answerable, insufficient, or conflicting. We use hidden activations and attention-derived features as inputs to train a lightweight linear model to distinguish among the three classes. Across 16 language models spanning different architectures and a range of model sizes, our feature-based router consistently outperforms prompting-based baselines and the performance of specialised RAG-models. We further conduct analyses into the information dynamics of the models. We show that the most informative signals for the classification are available in the middle layers, with hidden activation states being more effective than attention values or the MLP-feature outputs in most of the tested models. Overall, our results suggest that language models internally encode whether retrieved evidence is sufficient to support answering, and that this signal can be decoded reliably for RAG triage.

1 Introduction

Retrieval-Augmented Generation (RAG) extends language models with external evidence at inference time, improving factuality and reducing hallucination (Lewis et al., 2020). But retrieval is imperfect. In practice, retrieved documents may lack the information needed to answer a question, or may contain mutually contradictory answers. Prior work shows that in these cases, models tend to generate unsupported or contradictory responses rather than acknowledging the limitations of the evidence (Niu et al., 2024; Joren et al., 2025).

Existing methods address this as a two-way problem that involves either answering the question or refusing to answer the question. These predominantly rely on prompting (Zhang et al., 2025b; Zhou et al., 2023), confidence-based abstention (Kadavath et al., 2022), retrieval-side relevance estimation (Yoran et al., 2024), or external entailment (Honovich et al., 2022). These approaches share two limitations: they operate on the output side of the model, and they collapse the problem to two classes, ignoring the distinct case where conflicting evidence is present. A model that confidently answers from contradictory documents is failing in a qualitatively different way from one that answers without any supporting evidence. We highlight here that this distinction is an important one, especially for downstream tasks, trust and system design.

Code and dataset are available at https://github.com/SyedHuq28/Knowing-Before-Answering-Decoding-Language-Models-for-Reliable-RAG.

In this work, we propose a three-way framing: for a given question and retrieved context, the evidence state is either Answer (sufficient, consistent evidence), Refuse (insufficient evidence), or Conflict (contradictory evidence). We then present a methodology that exploits encoded information present in internal representations for prediction. Specifically, we train a lightweight triage router (which is a logistic regression based prediction module) on activations extracted from a single hidden layer of the language model, using a controlled diagnostic benchmark that isolates evidence-state decisions under matched inputs. We evaluate across 16 transformer-based language models spanning 90M to 32B parameters, diverse architectures, and training regimes. The router consistently and substantially outperforms prompt-based and RAG-specialised baselines across almost all models, achieving up to 0.91 accuracy and reducing false answer rates by up to 75% relative to the strongest prompt-based competitor, with no additional tokens or inference cost.

Furthermore, we analyse where evidence-state information is linearly decodable from the model's internal representations. Layer probing experiments show that the most informative representations consistently emerge in the middle layers of the network, a pattern that holds across model families and sizes. Hidden-state patching confirms that targeted intervention at the best probe layer reliably reshapes downstream model behaviour.

Our core contributions in the paper are: (i) A three-way RAG triage formulation that explicitly distinguishes Answer, Refuse, and Conflict evidence states, with a controlled diagnostic benchmark designed to allow us to evaluate the decisions; (ii) A lightweight triage router that decodes evidence state from a single hidden layer, outperforming all prompt-based and RAG-specialised baselines across 16 models without additional inference cost; and (iii) An analysis of where evidence-state information is linearly decodable, together with hidden-state interventions that test its influence on downstream behaviour.

References (50)