Discerning and Resolving Knowledge Conflicts through Adaptive Decoding with Contextual Information-Entropy Constraint (2024)

Abstract: Large language models (LLMs) internalize enormous parametric knowledge during pre-training. Concurrently, realistic applications necessitate external contextual knowledge to aid models on the underlying tasks. This raises a crucial dilemma known as knowledge conflicts , where the contextual knowledge clashes with the parametric knowledge. However, existing decoding works are specialized in resolving knowledge conflicts and could inadvertently deteriorate performance in absence of conflicts. In this paper, we propose an adaptive decoding method, termed as contextual information-entropy constraint decoding (COIECD), to discern whether the knowledge conflicts occur and resolve them. It can improve the model’s faithfulness to conflicting context, and simultaneously maintain high performance among non-conflicting context. Our experiments show that COIECD exhibits strong performance and robustness over knowledge conflicts in realistic datasets.

## introduction characterized by the massive knowledge internalized into the parameters @xcite @xcite , large language models (llms) have pioneered numerous breakthroughs across various domains @xcite @xcite @xcite . meanwhile, llms struggle with less popular factual knowledge @xcite , are fundamentally incapable of adapting over time @xcite and prone to hallucinations @xcite . these challenges necessitate the incorporation of non-parametric knowledge sources, through retrieval @xcite or application of tools @xcite . how-figure 1 : the illustration of knowledge conflict. due to model's bias towards its outdated parametric knowledge, it fails to accurately ground answer in the latest context, which conflicts with the lm's knowledge. early attempts on knowledge conflict-resolving methods resort to fine-tuning a small-scale model like t5 @xcite ) by data augmentation, such as kaft @xcite and dis-entqa @xcite . those fine-tuning methods bear the risk of undermining the intrinsic linguistic capabilities of the models @xcite . another line of works employ various decoding strategies during inference. for instance, contrastive decoding (cd) @xcite leverages the discrepancy in contextual impact on the model's probability distribution of high-probability words for decoding. another representative method is context-aware decoding (cad) @xcite , which draws upon cd to amplifies the contextual distribution for all words. however, existing decoding methods could inadvertently deteriorate performance in absence of conflicts. as evidenced in the figure 2 , while these methods effectively mitigate over-reliance on parametric memory for knowledge conflicts, their performances deteriorate on the non-conflicting data derived from naturalquestions dataset. typically, these methods generally work under the experimental scenario where all contexts are presumed to be inherently conflicting, without considering the presence or absence of conflicts in realistic scenario. thus, we posit the core question lies in: how to discern knowledge conflicts between contexts and llms during inference. to this end, the paper proposes an adaptive decoding method, termed contextual information-entropy constraint decoding (coiecd), aimed at discerning knowledge conflicts and employing distinct strategies for conflicting and nonconflicting data. given the observations that llms tend to be well-calibrated @xcite and their generations usually lie in a narrow and nearly flat entropy band @xcite , we adopt an adaptive decoding strategy that only alleviates conflict when llms generate tokens violate an entropy-information constraint (band). to be specific, when discerning knowledge conflicts, it is important to consider whether llms have already aligned with contextual knowledge. if so, the en-tropy of contextual generation would not have a drastic change. therefore, we propose discerning the knowledge conflicts by measuring the changes of the distribution entropy at token level, and then employ tailored decoding strategies for conflicting and non-conflicting tokens. we benchmark coiecd on several popular context-specific question answering (qa) datasets, including naturalquestions (nq) @xcite , squad 1.1 @xcite , strategyqa @xcite , and counterfacts @xcite . over all tasks, coiecd achieves superior or competitive performance compared to the baselines, demonstrating the effectiveness and robustness of our method. to summarize, the highlights of the paper are as follows: experimental results demonstrate that our method significantly augments the model's faithfulness to conflicting contexts and exhibits enhanced performance and robustness varying across diverse datasets and models. ## related work when presented with an external context with conflicting knowledge, prior works @xcite have flagged that larger models have a greater tendency to ignore the conflicting context. existing approaches for improving model's faithfulness to the context, such as the prompting-based method @xcite , is limited to specific instruction-finetuned llms and do not universally apply. other methods resort to fine-tuning a small-scale model like t5 (raffel et al., 2020) by counterfactual contexts, such as kaft @xcite and disentqa @xcite . @xcite proposed an evaluation framework for simulating contextual knowledge conflicts and quantitatively evaluating to what extent llms achieve these goals. another line of works employ various decoding strategies during inference. sc @xcite proposed the idea that a complex qa problem typically admits multiple different ways of thinking leading to its unique correct answer. it acts as a general enhanced decoding strategy. cd @xcite adopted a contrastive object, which measures the discrepancy between two distributions to facilitate decoding. in addressing knowledge conflicts, this discrepancy is assessed based on the output probabilities with and without context. @xcite proposed contrastive layer decoding to enhance factuality, diverging from our focus. most similar to our work is the cad @xcite ) method. it broadly amplifies the contextual distribution for all words without considering the presence of conflicting contexts, a limitation our work aims to address. ## contextual information-entropy constraint decoding discerning conflicts ( §3.1). first, we argue that if a context has consistent knowledge with the model's parameters, this context could be a natural generation of the model. 1 it motives us to employ the theories of stable entropy hypothesis @xcite and locally typical set @xcite foot_1 to measure whether there are unnatural tokens (conflicting knowledge) in the contexts, which demonstrate that natural-sounding language should ideally be constrained within a specific range. based on these two theories, we introduce a novel decoding constraint termed the contextual information-entropy constraint which aims to identify the violation of token that results in less contextual generation attributed to knowledge conflicts, as shown in figure 3 . resolving conflicts ( §3.2). then we implement tailored decoding strategies, which cater to tokens identified as either conflicting or non-conflicting. for non-conflicting tokens, model is expected to refer to both parametric and contextual knowledge. for conflicting tokens, model should prioritize the contextual knowledge. to this end, we calculate a contextual contrastive object @xcite , which represents the distribution discrepancy derived from the context. this object is then utilized tokens fall in contextual information-entropy constraint on tokens: i(y|𝐜, 𝐱) -ℋ(y|x) conflicting tokens 𝒑 𝟏 (𝑦|𝒙) 𝒑 𝟐 (𝑦|𝒄, 𝒙) discern conflicts resolve conflicts token y: i(y|𝐜, 𝐱) -ℋ(y|x) upper violations lower violations upper violations no violations lower violations log( ) contextual contrastive object: 𝒈 = log𝑝!(y|𝐜, 𝐱) -log𝑝"(y|𝐱) add 𝒈 log( ) add 𝒈 russia qatar russia europe russia europe russia qatar conflicting case non-conflicting case to variably adjust token distributions in accordance with the contextual information-entropy constraint. ## conclusion the coiecd method is introduced to discern and resolve knowledge conflicts effectively. this method is evaluated on context-relevant qa tasks using both realistic and synthetic datasets. the findings indicate that coiecd maintains consistently high performance, irrespective of the presence or absence of knowledge conflicts within the data.