Editor’s introduction
The study evaluates a method called Conflict-Aware Representation Editing (CARE) designed to address knowledge conflicts in Retrieval-Augmented Generation (RAG) systems. CARE learns a latent editing direction from intermediate model representations linked to correct and erroneous outputs, then applies it during inference to reduce activation patterns associated with conflicts. The method shows improved accuracy on multiple question-answering benchmarks, especially when retrieved documents contain noise. Findings indicate CARE outperforms baseline approaches like retrieval-based methods and conflict-mitigation techniques under noisy conditions.
Introduction
Recent advances in Large Language Models (LLMs) have demonstrated their remarkable capabilities across a wide range of natural language processing tasks, driven by their ability to internalize extensive world knowledge through pretraining on large-scale textual corpora. Despite their impressive performance, LLMs suffer from limitations in reflecting up-to-date information beyond their static training cut-off, and are susceptible to errors and biases present in the training data. These challenges highlight the difficulty of fully encoding all knowledge within parametric models and underscore the necessity for real-time access to external information.
To address these limitations, Retrieval-Augmented Generation (RAG) has emerged as a widely adopted paradigm, in which external knowledge is retrieved and incorporated into the model’s response generation process. While RAG offers a promising solution for enhancing the recency and reliability of generated content, it still faces two challenges: (1) Knowledge Conflict: Retrieved documents may contradict the model’s parametric knowledge, leading to inconsistencies in the generated response. Such conflicts are known to induce hallucinations, wherein the model produces factually incorrect content. (2) Retrieval Noise: Due to inherent limitations of retrieval systems, retrieved passages may be irrelevant to the query. This not only hinders the model’s ability to accurately assess relevance, but also introduces interference when integrating retrieved content with internal knowledge.
In complex scenarios, reliable RAG requires mechanisms that regulate the interaction between parametric knowledge and information retrieved from external sources. Existing approaches that focus primarily on the retrieval stage can improve the quality of retrieved evidence, but they do not directly intervene in the model representations where retrieved and parametric knowledge are integrated. Moreover, methods that adaptively decide whether to use retrieval or adjust generation through contrastive decoding mainly operate at the retrieval-decision or output-distribution level, offering limited control over conflict-associated internal representations.
To validate the effectiveness of our approach, we perform comprehensive evaluations on four instruction-tuned LLMs: LLaMA-2-7B-Chat, LLaMA-2-13B-Chat, LLaMA-3.1-8B-Instruct, and Qwen-2.5-7B-Instruct, across five Question Answering (QA) benchmarks and two multi-hop QA datasets. CARE improves answer accuracy over retrieval-based, conflict-mitigation, and inference-time truthfulness baselines, suggesting that inference-time representation editing is an effective approach for improving robustness in noisy RAG scenarios.
Knowledge Conflict
LLMs can experience conflicts between their parametric knowledge and retrieved external information, which may lead to incorrect responses. To address knowledge conflicts, introduces a training method that explicitly separates answers based on parametric and contextual knowledge. A cited study proposes an instruction-based approach to distinguish between evidence originating from differing perspectives. focuses on identifying and removing outdated facts within LLMs to ensure compliance with up-to-date contextual information. CAD enhances the effect of relevant context by amplifying the difference in output probabilities with and without context. While effective, these approaches must also account for realistic scenarios where the retrieved information may be noisy or unreliable.
Representation Editing
Modifying the representation space of LLMs to adjust their knowledge or response behavior has recently gained significant attention. Knowledge Neurons and ROME identify and manipulate specific neurons associated with factual knowledge, injecting or overwriting information directly into the model. While effective for updating long-term knowledge in pretrained models, these methods are less suited for on-the-fly knowledge adjustment during inference. ITI detects and modifies representations in real-time by intervening on attention heads, and TruthX explores and adjusts truthfulness signals in both attention and feed-forward networks. IRCAN identifies context-sensitive neurons and adjusts their weights to encourage context-faithful generation. Building on this line of work, we leverage a trained autoencoder to extract knowledge-alignment signals from the representation space and apply them during inference time, mitigating conflicts between internal and retrieved knowledge.22 2 An extended discussion of related work on mechanistic interpretability and additional analysis comparing our approach with prior work are provided in Appendix A.
Methodology
We aim to mitigate knowledge conflicts in RAG scenarios and promote reliable, document-grounded response generation. We introduce a conflict-aware representation adjustment mechanism, enabling real-time modulation of internal representations. Specifically, we train an autoencoder to reconstruct a separable latent space from intermediate representations extracted from the model layers, capturing the differences between cases where correct and incorrect answers are generated. At inference time, this learned structure adjusts representations, thereby reducing representational distortion under knowledge conflict and guiding the model toward more accurate responses.
Datasets and Metrics
To comprehensively evaluate the effectiveness of CARE, we conduct experiments on seven QA datasets. For standard QA, we use Natural Questions (NQ), TriviaQA, PopQA, SQuAD, and NQ-SWAP. For multi-hop QA, where reasoning over multiple documents is required, we include HotpotQA and 2WikiMultiHopQA (2WIKI). We use NQ to train our method, a widely used open-domain QA benchmark consisting of questions extracted from real user search logs and covering a broad range of answer types. During training, we use only the training split of NQ55 5 Appendix E.2 analyzes a target-trained variant that learns the editing direction from each target dataset.; for evaluation, we use only the test split. We apply a preprocessing step to ensure no overlap between training and test samples. The remaining datasets are used to assess the generalizability of our method. For all datasets, we prioritize using the official test set; if unavailable, we fall back on the evaluation split. We randomly sample 600 examples from each dataset for evaluation. To measure the accuracy of generated responses, we report Exact Match (EM) and F1 scores66 6 EM and F1 are valid for assessing response correctness and evidence integration in RAG, while finer effects of knowledge conflicts are examined in §5.3.. Further details on the datasets are provided in Appendix C.1.
Baselines
To evaluate the generalizability of our approach, we consider our method using four instruction-tuned language models: LLaMA-2-7B-Chat, LLaMA-2-13B-Chat, LLaMA-3.1-8B-Instruct, and Qwen-2.5-7B-Instruct. We evaluate thirteen baselines, categorized into four groups: (1) Retrieval Usage: No Retrieval, With Retrieval; (2) RAG Methods: Self-RAG, LLMLingua, Selective-Context, SURE, CtrlA; (3) Inference-Time Truthfulness Methods: ITI, TruthX; (4) Conflict Resolution Methods: Opin, CAD, IRCAN, SPARE. However, several baselines are tied to specific backbone models or publicly released checkpoints, which makes a fully controlled comparison across all LLM backbones infeasible. Self-RAG is based on LLaMA-2-7B, while ITI and TruthX provide publicly available variants trained for LLaMA-2-7B-Chat. Similarly, CtrlA and SPARE are limited to their supported model settings. Therefore, we evaluate these baselines under their corresponding supported backbones and report them in LLaMA-2-7B-Chat. Further details on the baselines are provided in Appendix C.2.
Experimental Results
Existing RAG optimization and conflict-mitigation methods show uneven robustness across benchmarks. Methods such as LLMLingua and Selective-Context reduce redundant context through compression or selection, but do not directly address conflicts between retrieved evidence and parametric knowledge. SURE, Self-RAG, and CtrlA achieve strong results on specific datasets, yet their gains are less consistent across benchmarks, particularly in multi-hop settings. Likewise, conflict-mitigation methods such as CAD and IRCAN can degrade under noisy retrieval, while Opin shows strong performance on Qwen-2.5-7B-Instruct but substantially weaker results on LLaMA-based models. SPARE tends to favor parametric knowledge, and truthfulness-oriented methods such as TruthX and ITI also show limited robustness in noisy, conflict-prone RAG settings. Overall, these results suggest that existing retrieval-optimization and conflict-mitigation strategies do not consistently provide robust improvements across datasets and model families.
CARE improves average performance across noisy retrieval settings. CARE achieves the highest average performance across all model families. These results suggest that the learned representation-editing direction can provide gains across different LLM backbones. Although CARE is trained only on NQ, it also improves average performance on out-of-domain datasets, indicating that the learned editing direction is not limited to the training dataset. Notably, CARE consistently improves over the standard With Retrieval baseline across all models and datasets, including single-hop and multi-hop QA benchmarks. Since these improvements are statistically significant in most cases, the results demonstrate consistent conflict-mitigation benefits in noisy RAG settings.
Ablation Study
Finally, using a controlled dataset with identical output tokens, the two conditions remain distinguishable with an AUC of 0.93, indicating that the learned representations capture conflict-sensitive information beyond lexical differences. Detailed analysis is provided in Appendix E.5.
Conclusion
In this work, we proposed CARE, an inference-time representation editing method for improving the robustness of RAG under noisy knowledge conflict settings. CARE trains an autoencoder-based module to learn a latent editing direction from intermediate representations associated with correct and incorrect generations, and applies this direction to selected LLM layers during inference. Experimental results across multiple LLMs and QA benchmarks show that CARE improves answer accuracy over retrieval-based, conflict-mitigation, and inference-time truthfulness baselines, particularly under noisy retrieval conditions. These findings suggest that representation-level intervention is a promising direction for improving reliable, knowledge-grounded response generation in RAG systems.
Mechanistic Interpretability
Recent mechanistic interpretability work has leveraged sparse dictionary learning (SDL) and Sparse Autoencoders (SAEs) to decompose internal LLM representations into interpretable, monosemantic features. These approaches typically rely on overcomplete latent spaces and strong sparsity regularization to disentangle complex activation patterns. Building on this line of work, SPARE further demonstrated that SAE-derived latent features can be directly manipulated to steer knowledge-selection behaviors in LLMs, highlighting the controllability and interpretability enabled by sparse latent structures. Although CARE also employs an autoencoder architecture to analyze representation space, its purpose differs fundamentally from that of SAEs. Instead of pursuing unsupervised feature decomposition for interpretability, we utilize a compressed, dense latent space trained with supervised contrastive signals. This enables us to manipulate global directions associated with knowledge conflict, prioritizing the robustness and controllability of model behavior.
Datasets
We randomly sample 5,000 instances from the original training dataset for evaluation. The evaluation aims to identify negative samples by selecting instances with an F1 score of 0. When the NQ training dataset is used, evaluation with the LLaMA-3.1-8B-Instruct model yields 766 instances. We provide an analysis of performance under different training dataset sizes in Appendix E.8.
License
We are committed to ethical research practices and ensuring the reproducibility of our work. To this end, we present the licensing information for all datasets utilized in our experiments. These include Natural Questions (CC BY-SA 3.0), TriviaQA (Apache License 2.0), PopQA (MIT License), SQuAD (CC BY-SA 4.0), HotpotQA (CC BY-SA 4.0), 2WikiMultiHopQA (Apache License 2.0), and NQ-SWAP (MIT License). Our use of these datasets is in full compliance with their terms, as all aforementioned licenses expressly permit their application in academic research.
Implementation Details
To ensure reproducibility, we fix the random seed to 2024 for all experiments. The layer configurations used in our main experiments are as follows: for LLaMA-2-7B-Chat, we use layers 22, 23, 24, 25, and 26; for LLaMA-3.1-8B-Instruct, we utilize layers 3, 12, 18, 20, and 31; for LLaMA-2-13B-Chat, we select layers 5, 12, 24, 32, and 37; and for Qwen-2.5-7B-Instruct, we use layers 19, 21, 23, 24, and 27. The selection criterion (i.e., the plot of per-layer AUC scores) is provided in Appendix E.7. Training was conducted with LLaMA-3.1-8B-Instruct on an NVIDIA RTX A6000 48GB GPU, requiring less than 25 minutes per layer. Inference is conducted on a single GPU with a maximum input length of 2048 tokens and a maximum output length of 32 tokens1313 13 LLaMA-2-13B-Chat tends to generate overly long responses; therefore, we set the maximum output length to 64 tokens..
For the LLMLingua setting, we use LLaMA-2-7B 1414 14 meta-llama/Llama-2-7b-hf to compute perplexity and apply LongLLMLingua as the compressor with a compression ratio of 0.55. Selective-Context uses GPT-2 1515 15 openai-community/gpt2 to measure perplexity, with a compression ratio of 0.5.
Prompt Templates
We observe that the LLaMA-2-13B-Chat model tends to generate additional explanations beyond the desired answer. To mitigate this behavior, we append the instruction “Only give me the answer and do not output any other words.” at the end of the user prompt for this model.
Specialized Domain
To examine whether the conflict-aware directions learned from a single QA corpus (NQ) extend to domains requiring specialized expertise, we additionally evaluate CARE on PubMedQA and LegalBench without any domain-specific fine-tuning. PubMedQA is a biomedical research QA dataset whose possible answers are yes/no/maybe, reflecting the veracity of question statements grounded in scientific literature. We conduct evaluation under the MedRAG framework, retrieving from the MedCorp corpus and reporting the accuracy of model predictions. LegalBench comprises a variety of legal reasoning tasks. It is evaluated within the LRAGE framework, which performs retrieval over Pile-of-Law, a legal source provided therein. In these experiments, we utilize BM25 and LLaMA-3.1-8B-Instruct to retrieve the top 5 documents.
Analysis of CARE Design Choices
The encoder/decoder MLPs of CARE use the LeakyReLU activation function. When we remove all nonlinearities and replace the autoencoder with a purely linear one, the average performance drops sharply from 41.37 to 18.62. This suggests that simple linear projection is insufficient to capture the latent structure required to distinguish between knowledge conflict states. Thus, nonlinearity plays a crucial role in isolating and correcting conflict signals.
For layer selection, we first compute an AUC score for each layer and choose the layer with the highest score for intervention. If multiple layers share the highest score, we randomly select one among them. To validate the robustness of this choice, we compare our original layer selection with a variant that intervenes on the top 5 layers ranked by AUC (layers 18, 20, 28, 29, 31). The difference in average performance between the two settings is only 0.16, and the overall trends are very similar. This suggests that what matters is not the highly specialized functional role of a particular layer, but rather that each chosen layer provides a strong signal for distinguishing between conflict and non-conflict states.
Robustness against Lexical Differences
To examine whether the learned representation contains conflict-sensitive information beyond lexical differences in the generated responses, we conduct an additional controlled analysis using sample pairs with identical output tokens. Specifically, we construct 600 sample pairs extracted from NQ-SWAP, where the LLM’s final generated output tokens are strictly identical. These pairs are divided into two configurations. In the first half, the output tokens are identical, but the retrieved contexts differ. For instance, in both conditions, the model outputs the same parametric answer (e.g., “Paris”). However, in the Positive condition, the retrieved document supports this answer, whereas in the Negative condition, the retrieved document provides contradictory evidence. In the second half, the output tokens are identical, but the queries differ.
Effect of Training Dataset Size
Compared to our default setting of 766 training instances, reducing the data to 500 instances results in only a small performance drop. This suggests that CARE can learn a useful representation-editing direction from a relatively small number of training examples. Consequently, CARE can achieve significant conflict mitigation even in resource-constrained environments where data collection is costly. Conversely, increasing the training data to 1,500 instances yields an average improvement of 1.31 points across benchmarks. The largest gain is observed on PopQA, which contains many long-tail entity questions. One possible explanation is that additional training examples expose the autoencoder to a broader range of entity-level and context-dependent failure patterns, leading to a more effective editing direction. Overall, these results suggest that CARE is not overly sensitive to moderate reductions in training data and can further benefit from additional training examples.


