Enterprise knowledge · Research feature

When Context Misleads: Intent-Guided Decoding for Robust Retrieval-Augmented Generation

A new framework improves AI's ability to balance accurate facts with strict context adherence in response generation.

Adapted from research by Haolin Jin, Pengyue Yang, Huaming Chen.

arXiv preprint revision · 2026-08-17 · Attribution & reuse
In this article
Editorial illustration of linked workflow.

Editor’s introduction

Researchers evaluated Intent-Guided Decoding (IGD) on three faithful and three factual-conflict question-answering benchmarks using five large language models. The study compared IGD against Direct RAG by assessing how well models adhere to context under strict or truth-seeking user prompts. IGD demonstrated improved factual recovery—up to 65.4 percentage points over Direct RAG on factual-conflict benchmarks—while maintaining or enhancing context-following behavior. The evaluation used normalized alias matching to measure accuracy, with strict mode assessing context alignment and truth mode assessing world knowledge alignment. Findings show IGD effectively arbitrates between retrieved context and model memory based on user intent, without altering the input context or prompt structure.

Introduction

Retrieval-augmented generation (RAG) has become a widely adopted paradigm for connecting large language models (LLMs) with external knowledge. By retrieving relevant evidence at inference time, retrieval-augmented generation extends the static parametric knowledge of LLMs with updatable non-parametric memory. This design improves performance on knowledge-intensive tasks such as open-domain question answering, where models require access to facts beyond their internal parametric knowledge.

However, the effectiveness of RAG depends not only on whether useful evidence is retrieved, but also on whether the model can ground the generation in the retrieved evidence appropriately. In practice, RAG systems may still generate statements that are unsupported by, or even contradictory to, the provided context. RAGTruth systematically annotates nearly 18K RAG responses, and finds that non-factual statements remain common under standard RAG pipelines. On the other hand, retrieval introduces a source-trust problem. Standard RAG pipelines often implicitly treat retrieved context as authoritative, which content may be false, adversarially corrupted, or inconsistent with stable world knowledge. FaithEval formalizes this issue as contextual faithfulness evaluation, and constructs 4.9K high-quality examples across unanswerable, inconsistent, and counterfactual settings, showing that even strong contemporary LLMs often fail to maintain an appropriate degree of faithfulness to given context. More broadly, situated faithfulness argues that models should dynamically calibrate their trust in external context against internal knowledge, rather than blindly following either source. These findings suggest that a central challenge in RAG is not only how to retrieve useful evidence, but also how to decide whether the retrieved evidence should dominate generation.

This issue exposes a fundamental trade-off between faithfulness and factuality in RAG generation. In some settings, the user explicitly expects the model to follow the provided context, for example when answering questions about a document, policy, or passage. In other settings, the user expects the model to use retrieved context only as auxiliary evidence and remain skeptical when that context is misleading or conflicts with world knowledge. A fixed RAG behavior is therefore insufficient: always trusting context may improve contextual faithfulness but can harm factual correctness under misleading retrieval. Conversely, always discounting retrieved context may recover factuality against corrupted evidence but undermine user intent in strict context-following scenarios. Practical RAG systems therefore require an intent-aware mechanism that can follow context when the user asks for contextual grounding, while resisting context when the user seeks factual robustness against unreliable retrieval.

Our method IGD introduces a novel decoding-time control layer for RAG, which shifts the focus from retrieving better evidence to arbitrating which knowledge source should steer generation. Unlike retrieval-centric methods that improve what or when to retrieve, IGD assumes retrieval has already occurred and addresses downstream conflict between retrieved context and parametric memory. Also, unlike context-faithfulness alignment methods that generally encourage stronger adherence to retrieved evidence, IGD performs bidirectional trust calibration. It adapts the source preference according to user intent. Moreover, unlike prompt-based confidence reasoning or multi-agent evidence aggregation, IGD performs lightweight logit arbitration during generation. Its token-level correction is activated only when the context and memory branches exhibit distributional conflict, enabling local, conservative and intent-aware intervention without retraining the model or replacing the retrieval pipeline.

Retrieval-augmented generation combines parametric language models (LM) with external evidence to improve knowledge intensive generation. Early and representative RAG systems differ in how they retrieve, encode, and consume evidence. Fusion-in-Decoder conditions generation on multiple retrieved passages and fuses evidence inside the decoder. Atlas jointly trains a retrieval-augmented model for few-shot knowledge intensive learning. In-Context RALM shows that LMs can benefit from retrieved documents inserted directly into the prompt. Recent work has made retrieval more adaptive, with most remaining retrieval-centric by improving the retriever or training retrieval-aware generators. FLARE retrieves during generation based on predicted future content, Self-RAG trains models to retrieve and critique the outputs using reflection tokens, and CRAG evaluates retrieval quality and corrects low-confidence retrieved evidence.

Other works study hallucination, contextual faithfulness, and knowledge conflict in RAG. RAGTruth provides a corpus to analyze hallucinations in RAG and shows that retrieved evidence does not eliminate unsupported generation. FaithEval evaluates whether models remain faithful under unanswerable, inconsistent, and counterfactual contexts. ClashEval studies conflicts between an LLM’s internal prior and external evidence, showing that models can adopt incorrect retrieved content even when their internal knowledge is correct. Context-DPO improves context faithfulness through preference optimization, while FaithfulRAG models fact-level conflicts between retrieved context and parametric knowledge to improve context-faithful generation. Work on situated faithfulness further argues that LLMs should calibrate trust in external context based on both contextual evidence and internal confidence. Our method shares this motivation of trust calibration, but targets a different control point. Instead of uniformly enforcing stronger adherence to retrieved context, IGD performs intent-aware source arbitration directly in the decoding distribution, allowing the model to favor either context or memory according to the prompt mode.

Token-Level Correction

IGD performs token-level source arbitration around the original user distribution, the goal is not to replace the distribution, but to gently adjust it when the context and memory branches disagree. This follows the general intuition of decoding time control, where generation is steered by modifying next token scores rather than updating model parameters.

Confidence Direction

This parameterization induces a intent consistent intervention direction: strict context following prompts start with a strong context prior, truth seeking prompts start with a memory prior, and the final direction can still change when one branch is substantially more confident than the other.

Reliability Scaling

The base coefficient determines the direction of intervention, IGD then rescales its magnitude by the reliability of the source being favored. This prevents confident but poorly supported context from exerting excessive influence, and similarly prevents unstable memory predictions from overriding context.

Evaluation Design

We evaluate IGD in retrieval-augmented short form answering questions. Each example consists of a question, a document-tagged context, and a prompt mode. We consider two prompt modes that represent different user intents. In strict mode, the model is instructed to answer strictly according to the provided context. In truth mode, the model is instructed to treat the context as potentially noisy or misleading and to prioritize the factually correct answer when context and world knowledge conflict. The two modes use the same question and context, only the user instruction changes. Direct RAG and IGD are evaluated under identical prompts, to isolate the effect of source arbitration during the decoding phase.

We organize the evaluation into two groups. The faithful group contains standard QA settings where the context supports the gold answer, to test whether IGD preserves the benefits of retrieval. The factual-conflict group contains examples where the context answer conflicts with the world answer, to test whether IGD follows the context in strict mode while recovering the world-knowledge answer in truth mode.

Benchmarks

We evaluate on six QA benchmarks, grouped into three faithful QA benchmarks and three factual-conflict QA benchmarks, each contains 500 samples. The faithful group includes KILT-NQ, TriviaQA, and SQuAD. KILT-NQ is based on Natural Questions and the KILT Wikipedia corpus; TriviaQA contains trivia style open-domain questions with answer aliases and Wikipedia/web evidence; and SQuAD is a paragraph level reading comprehension dataset built from Wikipedia. For KILT-NQ and TriviaQA, we construct multi-document contexts by selecting an answer bearing passage and adding distractors; for SQuAD, we use the original paragraph as support and add distractor paragraphs from other examples. The factual-conflict group includes ConflictBank, NQ-Swap, and CounterFact. ConflictBank contains Wikidata-derived knowledge conflicts with generated misleading evidence; NQ-Swap is constructed from Natural Questions/MRQA by replacing the original answer in the context with a substituted answer; and CounterFact is adapted from the factual association editing benchmark in ROME. In these factual-conflict benchmarks, the original answer is treated as the world answer, while the misleading or substituted answer supported by the context is treated as the context answer. We apply alias cleaning and semantic filtering to remove ambiguous cases where the world and context answers are equivalent.

Models and Baselines

We evaluate five instruction-tuned LLMs: Qwen3-32B, Qwen2.5-14B-Instruct, Llama-3-8B-Instruct, Mistral-7B-Instruct-v0.3, and Phi-4 14B. These models cover different families and scales, allowing us to test whether IGD generalizes across models with different parametric knowledge and instruction-following behavior. Experiments were conducted on local GPU servers equipped with NVIDIA RTX A6000 GPU and two NVIDIA GeForce RTX 5090 GPUs.

We compare IGD with six baselines. Closed-book Q-only receives only the question and no context, it is a diagnostic reference for parametric knowledge rather than a context using RAG method. Direct RAG receives the same question, context, and prompt-mode instruction as IGD, but generates directly from the original prompt without source arbitration. We also include confidence reasoning baselines from situated faithfulness work: ExplicitSCR, which asks the model to explicitly reason about whether to trust the context or its internal knowledge, and three rule-based confidence reasoning variants, RCR-InternalEval, RCR-ContextEval, and RCR-InternalConf, which extract confidence or evaluation signals for internal and context-based answers and then select a final answer according to predefined rules. In addition, we compare with MADAM-RAG, a multi-agent RAG framework designed to aggregate and resolve conflicting retrieved evidence.

Evaluation Metrics

We evaluate the answer accuracy using normalized alias matching, following standard QA evaluation practice. For faithful benchmarks, predictions are always matched against gold answers. For factual-conflict benchmarks, the target depends on the prompt mode: strict mode reports context accuracy, while truth mode reports world accuracy.

Closed-Book Performance Reveals the Recoverable Parametric Signal

We first evaluate each model in the closed-book Q-only setting, where the model receives only the question without any retrieved context. It is important to interpret IGD because factual recovery from a misleading context is only possible when the underlying model can access the correct answer from its parametric memory, if the closed-book model cannot recover the world answer, the upper bound of any memory oriented correction is naturally limited.

The closed-book results in Table I show that the difficulty of the six benchmarks differs substantially. Among the faithful benchmarks, closed-book accuracy is generally low on KILT-NQ and SQuAD, indicating that these datasets rely heavily on the provided context. Across the five models, KILT-NQ closed-book accuracy remains around the mid 30% range, and SQuAD is even lower, mostly around 25-32%. This is expected: KILT-NQ is derived from open-domain queries grounded in Wikipedia evidence, while SQuAD questions are written against specific paragraphs and often require access to the original passage. In contrast, TriviaQA is substantially easier in the closed-book setting, with all models reaching above 60%, suggesting that many trivia-style answers are already encoded in the models’ parameters.

For the factual-conflict benchmarks, closed-book performance is much higher overall, especially on CounterFact and NQ-Swap. CounterFact is the easiest factual-conflict benchmark under closed-book evaluation: all models achieve between 73.0% and 92.8%, suggesting that many subject relation facts remain accessible from parametric memory. NQ-Swap is also highly recoverable for several models, with Qwen2.5-14B reaching 91.5% and Phi-4 reaching 60.0%. ConflictBank is more challenging, with closed-book accuracy ranging from 39.4% to 61.2%. Overall, Qwen2.5-14B-Instruct shows the strongest closed-book IA score, while Qwen3-32B also exhibits strong recoverability on the factual-conflict benchmarks. These diagnostics suggest that IGD is evaluated in a meaningful regime: the factual-conflict examples are difficult for Direct RAG because the context is misleading, but many of their correct answers are still recoverable from model memory.

Truth Prompting Alone Does Not Calibrate Context Trust

The additional baselines further clarify that this problem is not fully solved by answer-level reasoning or confidence-based source selection. ExplicitSCR and RCR variants are designed to improve situated faithfulness by reasoning over, or extracting confidence from, internal and context-based answers, while MADAM-RAG uses multi-agent aggregation to handle conflicting retrieved evidence. These methods often improve over Direct RAG on factual-conflict benchmarks, confirming that explicit source comparison is useful. However, their improvements are uneven: some variants recover more world answers but substantially reduce faithful QA accuracy, while others preserve context grounded performance but remain weak under misleading context. In contrast, IGD achieves the best IA score for every evaluated backbone in Table I. This suggests that the key difficulty is not only detecting whether context or memory is correct at the answer level, but also controlling how strongly each source should influence decoding. the desired behavior is not to simply suppress context, but to preserve context grounded accuracy on faithful examples while resisting misleading evidence in factual conflict cases.

Truth mode: recovering world answers under misleading context

The comparison with external baselines provides a more informative view of this trade-off. Confidence-reasoning and multi-agent baselines can be strong on individual factual-conflict columns, but they often sacrifice accuracy on faithful benchmarks. For instance, RCR-style methods may recover more world-knowledge answers on a particular conflict set, but their faithful accuracy drops sharply because they rely on a global answer-level source decision. Similarly, MADAM-RAG improves some conflict cases, but its aggregation strategy does not consistently preserve original context-grounded behavior.

The factual gains are large and systematic. Across all models, IGD improves every factual-conflict benchmark over Direct RAG, with the largest gain reaching 65.4 percentage points on Qwen3-32B CounterFact. Importantly, these gains do not come from discarding retrieval altogether. On faithful benchmarks, IGD remains close to Direct RAG, with moderate drops that are much smaller than the factual-conflict gains. This pattern suggests that token-level correction is more conservative than answer-level rerouting alone: it can weaken misleading context when necessary, while still preserving useful retrieved evidence when the context is correct.

Strict mode: preserving context-following intent

The results show that IGD preserves, and in many cases improves, strict context-following behavior. These strict prompt’s mode results are central to the claim that IGD balances factuality and faithfulness rather than optimizing only one side of the trade-off. A method that simply discounts retrieved context would improve truth mode factual accuracy but damage strict context following. In contrast, IGD uses the prompt mode to determine the direction of intervention: under truth-seeking prompts it can pull decoding toward memory, while under strict context-following prompts it preserves or strengthens context guided decoding.

Factuality and Faithfulness Trade-off

We further analyze how IGD balances factual recovery and context faithfulness through component ablations and hyperparameter sensitivity. This analysis is motivated by the central tension in RAG, stronger reliance on parametric memory can recover world answers but may undermine strict context following. We conduct ablations on Qwen2.5-14B-Instruct over the same six-benchmark suite used in the main experiments, reporting macro averaged results over the three faithful benchmarks and the three factual-conflict benchmarks. Table III ablates six core components of IGD: the answer level memory filter, token-level correction, activation gate, instruction-mode prior, reliability scaling, and memory ensemble, we choose these ablations because each component directly affects the trade-off rather than merely changing implementation details.

Conclusion

We presented Intent-Guided Decoding (IGD), a decoding-time framework for resolving the factuality and faithfulness trade-off in retrieval-augmented generation. Rather than treating retrieved context as either universally authoritative or inherently suspect, IGD performs intent-conditioned source arbitration across the user prompt, retrieved context, and parametric memory. Experiments on faithful and factual-conflict benchmarks show that IGD improves intent-aligned generation across multiple LLMs, while ablations confirm that its gains arise from coordinated routing, conflict activation, reliability scaling, and memory stabilization.