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

Abstract: Large language models 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. Code is available at https://github.com/Stacy027/COIECD.

heading: 1 Introduction
text: Characterized by the massive knowledge internalized into the parameters (Petroni et al., 2019; Geva et al., 2021b; Roberts et al., 2020), Large language models (LLMs) have pioneered numerous breakthroughs across various domains (Vaswani et al., 2017; Devlin et al., 2018; Brown et al., 2020; Chung et al., 2022; Touvron et al., 2023). Meanwhile, LLMs struggle with less popular factual knowledge (Mallen et al., 2023), are fundamentally incapable of adapting over time (Lazaridou et al., 2021; Kasai et al., 2022) and prone to hallucinations (Shuster et al., 2021). These challenges necessitate the incorporation of non-parametric knowledge sources, through retrieval (Shi et al., 2023b) or application of tools (Schick et al., 2023). How-
*Corresponding authors
ever, it has given rise to a sharp dilemma: knowledge conflicts, defined by Longpre et al. (2021), where the non-parametric contextual knowledge conflicts with internal parametric knowledge. Prior works (Longpre et al., 2021; Chen et al., 2022; Li et al., 2023a; Zhou et al., 2023; Wang et al., 2023c) have flagged that when confronting conflicts, larger models have a greater tendency to ignore the given context when it contradicts with model’s parametric knowledge. As shown in the Figure 1, due to the model’s bias towards its parametric knowledge, it fails to ground its answer in the conflicting context.
Early attempts on knowledge conflict-resolving methods resort to fine-tuning a small-scale model like T5 (Raffel et al., 2020) by data augmentation, such as KAFT (Li et al., 2023a) and DisentQA (Neeman et al., 2023). Those fine-tuning methods bear the risk of undermining the intrinsic linguistic capabilities of the models (Dong et al., 2023). Another line of works employ various decoding strategies during inference. For instance, Contrastive Decoding (CD) (Li et al., 2023b; Wang et al., 2023a) 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
3903
(CAD) (Shi et al., 2023a), 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 InformationEntropy 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 (Kadavath et al., 2022) and their generations usually lie in a narrow and nearly flat entropy band (Arora et al., 2023), 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) (Kwiatkowski et al., 2019), SQuAD 1.1 (Rajpurkar et al., 2016), StrategyQA (Geva et al., 2021a), and Counterfacts (Longpre et al., 2021). 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:
• This study presents a contextual informationentropy constraint to discern knowledge conflicts, between parametric knowledge in LLMs and non-parametric contextual knowledge. The constraint has proven effective in realistic datasets, which are characterized by the unpredictability of conflicts.
• The paper develops tailored decoding strategies to solve knowledge conflicts based on the contextual information-entropy constraint. 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.

heading: 2 Related Work
text: When presented with an external context with conflicting knowledge, prior works (Longpre et al., 2021; Chen et al., 2022) 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 (Zhou et al., 2023), 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 (Li et al., 2023a) and DisentQA (Neeman et al., 2023). Wang et al. (2023c) 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 (Wang et al., 2023b) 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 (Li et al., 2023b) 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. Chuang et al. (2023) proposed contrastive layer decoding to enhance factuality, diverging from our focus. Most similar to our work is the CAD (Shi et al., 2023a) method. It broadly amplifies the contextual distribution for all words without considering the presence of conflicting contexts, a limitation our work aims to address.

heading: 3 Contextual Information-Entropy Constraint Decoding
text: 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 (Arora et al., 2023) and Locally Typical Set (Meister et al., 2023)2 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 (Li et al., 2023b), which represents the distribution discrepancy derived from the context. This object is then utilized
1The assumption is empirically validated by a comparison of distribution entropy between conflicting and non-conflicting contexts, as detailed in the Appendix D.
2The detailed definitions of these concepts are provided in Appendix B.
to variably adjust token distributions in accordance with the contextual information-entropy constraint.

heading: 3.1 Contextual Information-Entropy Constraint
text: We assume that if the contextual knowledge aligns with model’s parametric knowledge, then the context can be a coherent and natural generation of model in some way. In this setting, the characteristics of natural language generation hold true for the non-conflicting contexts. Given the observations that LLMs tend to be well-calibrated (Kadavath et al., 2022) and their generations usually lie in a narrow and nearly flat entropy band (Arora et al., 2023), we craft a contextual constraint to measure the changes of the distribution entropy and token information, using it as an indicator to discern knowledge conflicts on token-grained level.
We define the entropy of the genertated token yt by given the question x and generated history y<t following Arora et al. (2023) as
H(yt|x,y<t) = E yt∼p(·|y<t) − log p(yt|x,y<t) (1) For brevity, we use H1(yt) to represent the entropy of conditional distribution over question x and generated history y<t, and H2(yt) denotes the entropy conditioning by x, y<t, and assumed generation c.
H1(yt) = H(yt|x,y<t) (2) H2(yt) = H(yt|x, c,y<t) (3)
The Stable Entropy Hypothesis (Arora et al., 2023) proposes that natural language generations usually lie in a narrow and flat entropy band. When we posit that a non-conflicting context can arise as a natural generation of model, the entropy shift should adhere to the bound. Deviations from it may indicate a potential conflicting context. In such instances, it becomes crucial to precisely identify which specific tokens, reflecting the conflicts, are likely to cause the model to exceed its entropy bound during generation. To address this, we utilize the Locally Typical Set (Meister et al., 2023) to discern tokens by the following bound on information-entropy shift. The proofs are detailed in Appendix C.
Proposition 3.1 (Bound on information-entropy shift). The information content of a random variable is quantified as its negative logprobability (Meister et al., 2023). Let the information content of token yt be I(yt) = − log p(yt | x, c,y<t), and we define a information-entropy shift as: I(yt) − H1(yt). The following bound holds for a constant γ > 0:
∣∣I(yt)−H1(yt) ∣∣ < γ (4)
In words, the information-entropy shift can be bounded by some constant denoted as γ. That means, if the shift of a token adheres to this constraint, we can view it as a plausible candidate of non-conflicting contextual generation. Conversely, any violation of token indicate the potential conflicts with a high probability.
To formalize the bound into constraint of decoding, we follow a popular constraint paradigm in decoding techniques such as nucleus sampling (Holtzman et al., 2019) and CD (Li et al., 2023b). We employ the softmax function to normalize the information-entropy shift into distribution:
pδ(yt) = softmax(I(yt)−H1(yt)) (5)
Then we have an upper bound upδ and a lower bound lpδ to constrain the vocabulary subset when decoding as:
upδ = λmaxw pδ(w) (6)
lpδ =
{ l′pδ if ∑ I(pδ(yt) < l′pδ) > 1,
0 otherwise. (7)
where l′pδ = 1
λ min w pδ(w)
Here λ is a scaling factor in (0, 1] and I is an indicator function. Eq. 7 implies that the lower-bound probability lpδ takes the value in cases where multiple tokens exhibit probabilities pδ(yt) falling below the l′pδ . Otherwise, lpδ is set to 0, indicating that only a solitary token violates the lower bound. It reflects model’s high confidence with the absence of conflict for that token. Based on the bounds, the constraint subset C(y<t) ⊆ V is as follows:
C(y<t) = {y ∈ V : lpδ ≤ pδ(yt) ≤ upδ} (8)

heading: 3.2 Adaptive Decoding
text: Before employing distinct decoding strategies for the conflicting and non-conflicting tokens, initially, we define that
p1(yt) = p(yt|x,y<t) (9) p2(yt) = p(yt|x, c,y<t) (10)
Here the parametric knowledge is factored out from the model’s output distribution as p1, in accordance with Shi et al. (2023a). The output distribution p2 that incorporates context can be interpreted as context-aware knowledge, which integrates knowledge from both parameters and context. Then a contextual contrastive object g (Li et al., 2023b) is calculated to quantify the divergence between p1 and p2:
g(yt) = log p2(yt)− log p1(yt) (11)
which aims to refine the discrepancy brought by the context. It assumes that p1 has a stronger tendency to produce the outputs that adhere to parametric knowledge of the model. The g is to factor out the model’s inherent memory and favor the contextual knowledge.
Based on g, the decoding strategies are differentiated for tokens distinguished by the proposed contextual information-entropy constraint. For conflicting tokens, model is expected to prioritize contextual knowledge. To facilitate this, g is strategically employed to reinforce context-aware knowledge p2. For non-conflicting tokens, the model is encouraged to lean more heavily on parametric knowledge, rather than depending exclusively on context. This strategy stems from on the recognition of the potential limitations in contextual knowledge, which may not be comprehensive to fully address the query. Therefore, this paper emphasizes the importance of parametric knowledge p1, while still considering contextual factors. To achieve this,
the g is incorporated with it. Overall, the contextual information-entropy constraint is utilized with g on the output distribution π as:
log π(yt | x, c,y<t) (12)
= { log p1(yt) + α · g(yt) if yt ∈ C(y<t), log p2(yt) + α · g(yt) otherwise.
where α is a scaling weight to control the contextual impact. The final decoding strategy can be formalized as:
yt ∼ softmax[log π(yt | x, c,y<t)] (13)
In this way, COIECD strikes a balance between the two sources of knowledge to achieve a more effective and holistic decoding strategy.

heading: 4 Experiments

heading: 4.1 Experimental Setup
text: Datasets. We experiment with several public QA datasets, including NaturalQuestions (Kwiatkowski et al., 2019), SQuAD 1.1 (Rajpurkar et al., 2016) and StrategyQA (Geva et al., 2021a). Unlike prior research where all data consists of synthetic conflicts, we adopt the original datasets and view them as hybrid datasets consisting of both conflicting (Conf.) and non-conflicting (Non-Conf.) data. It can stimulate the unpredictability of conflict occurrences in a realistic setting. Then we adopt the posteriori judgement of the parametric knowledge in LLMs (Wang et al., 2023d) to identify the knowledge conflicts within the datasets in Sec 4.3.
Furthermore, we also incorporate the Counterfacts dataset (Longpre et al., 2021) to facilitate a more comprehensive analysis. Counterfacts exclusively consists of synthetic conflicting data, where all the original answers are replaced with other plausible entities in the contexts. The brief introductions and statistic for each dataset are provided in Appendix E. We apply the prompt instruction following Ren et al. (2023) to assess the QA abilities for all models.
Used LLMs. Our experiments are conducted on pre-trained language models, including autoregressive models: the LLaMA2 models (7B, 13B parameters) (Touvron et al., 2023), OPT models (6.7B, 13B parameters) (Zhang et al., 2022) and the encoder-decoder language model: FLAN-T5 (3B, 11B parameters) (Chung et al., 2022). The experimental results feature a representative outcome
for a single size in each model. Additional results, including a comparative analysis of GPT-3.5 and GPT-4 performance on these datasets, are detailed in Appendix J.
Baselines. We adopt four decoding methods as baselines: Regular Decoding, Self-Consistency (SC) (Wang et al., 2023b), Contrastive Decoding (CD) (Li et al., 2023b) and Context-Aware Decoding (CAD) (Shi et al., 2023a).3 CD and CAD are specialized in resolving knowledge conflicts, while SC is a general decoding strategy to strengthen the model performance. Regular Decoding employs a standard, greedy strategy, integrating both question and context as inputs. For SC, which necessitates multiple samples per question, 40 outputs are sampled with temperature t = 0.5, in according with Wang et al. (2023b). For other methods, the temperature t = 0 following prior works. All the decoding methods are evaluated in a zero-shot setting. The values of λ and α are set to 0.25 and 1, respectively. Detailed analyses sampling strategies are provided in Appendices G.
Metrics. Following previous works (Chen et al., 2017; Izacard and Grave, 2021; Sun et al., 2023), we use the Exact Match (EM) and F1 scores for evaluating the QA performance of LLMs. For the binary classification in StrategyQA, the accuracy is used as the metric.

heading: 4.2 Overall Performance
text: Table 1 presents the results on the QA datasets. Totally, COIECD exhibits consistent improvements over all baseline comparisons. The SC method yields results akin to the Regular with a slight increase. The performance of conflict-solving methods, namely CD and CAD, varies across models and datasets, showing inconsistent variations when compared to Regular. On the contrary, COIECD consistently achieves improvements in realistic datasets (NQ, SQuAD and StrategyQA) and maintains competitive performance in the synthetic Counterfacts dataset. The results conclusively demonstrate the consistent effectiveness and adaptability of COIECD across various datasets in different conflict scenarios.
The results on the Counterfacts dataset reveal that most methods exhibit performance enhance-
3For the issue of knowledge conflicts, CD adopts the object of difference between the output likelihood when inputs are presented with and without context. More detailed comparisons of those methods are described in the Appendix F.
ment. Upon closer examination, it becomes evident that the CAD’s advantages are primarily evident in counterfactual scenarios, outperforming other methods except FLAN-T5. Nonetheless, COIECD still demonstrates superior robustness, maintaining competitive performance across various models.

heading: 4.3 Performance on Conf. & Non-Conf. data.
text: As shown in the Table 2, since the CD and CAD specialize in resolving knowledge conflicts, they can handle the Conf. data well. However, in the Non-Conf. dataset, both of them demonstrate a significant decrease in performance, with reductions reaching up to -11.86 EM score on the SQuAD dataset. This finding highlights the inherent limitations of these methods, especially in scenarios with high knowledge consistency, where their application is particularly challenging.
The Regular shows the least efficacy in handling Conf. data compared to Non-Conf. data4, falling by nearly 50% on LLaMA2 model. This observation aligns with previous research, indicating that larger models are more prone to disregard context when it conflicts with the model’s parametric knowledge. Moreover, SC adopts the voting strategy from multiple generations. It naturally has better results on Non-Conf., but could not deal with the conflicts in Conf. By contrast, the proposed COIECD comprehensively considers the conflicts and non-conflicts
4This observation does not always apply to the OPT model. This limitation is attributed to the inherent scarcity of parametric knowledge within the model. (See Appendix E.2)
between the given contexts and LLMs. As a results, it obtains the best performance on Total. And it also has better results than CD and CAD whatever on Non-Conf., and Conf. in most datasets.
In summary, whether it’s SC, CD, or CAD, each is made for either Conf. or Non-Conf. scenarios, achieving comparatively better outcomes in one scenario while inevitably performing poorly in the other. In contrast, our adaptive decoding method considers both scenarios, achieving a trade-off that works well in all datasets.

heading: 4.4 Performance with Different Conflicting Data Proportions
text: We conduct further experiments aiming to understand how the presence of conflicts within data affects the performance of these methods, measured in terms of EM score. We establish two experimental scenarios: a real-world conflicting scenario composed of samples from conflicting and non-conflicting data in the NQ dataset, and a synthetic conflicting scenario sampled by the same non-conflicting data and the synthetic Counterfacts constructed on the NQ. As shown in Figure 4 and 5, we visualize the correlation among the proportion of conflicting data and the performance of different methods in two scenarios.
Performance degradation across conflict proportions. Both figures reveal a universal trend of performance deterioration for Regular as the conflict proportion escalates. The Regular and SC
0 20 40 60 80 100 The proportion of conflicts in Counterfacts(%)
62
64
66
68
70
72
E M
Regular COIECD CD CAD SC
Figure 5: Synthetic conflicts with Counterfacts
show the highest initial EM score at 0% conflicts but also demonstrate the most significant decline as conflicts increase. It suggests that those methods heavily rely on knowledge consistency with parameters and contexts. CAD exhibits the lowest performance across all levels of conflict, indicating that it may be specifically designed for datasets with maximal conflicts. The performance of COIECD declines at the slowest rate, suggesting it has the capability that mitigate the impact of conflicting data. Overall, COIECD appears to be more robust to conflicts compared to others.
Gap between realistic and synthetic scenarios. Upon closer inspection of Figure 4 and 5, we find that the performances of CAD and CD exhibit substantial variation with the increase of conflicts. In the synthetic scenario, they fall below that of Regular by a large margin when no conflict occurs, but rise gradually with increase of the proportion of
knowledge conflicts. This trend does not exist in the realistic data. Furthermore, the impact of conflicts on EM is more pronounced in the realistic scenario. This might be due to the nature of realistic conflicts being more challenging or nuanced compared to the synthetic ones. In conclusion, the capability of the decoding method cannot be only verified by the performance on the single counterfactual data. To address a more realistic scenario, the COIECD method emerges as the optimal choice.

heading: 4.5 Performance on Noisy Contexts
text: In this paper, the input contexts are regarded as high quality and containing the answer following the settings in (Longpre et al., 2021; Zhou et al., 2023; Shi et al., 2023a; Wang et al., 2023c). However, in realworld models like retrieval-augmented language models (RALMs), contextual knowledge can be of
low quality or noisy. Therefore, we also incorporate a prominent retrieval system DPR (Karpukhin et al., 2020) into our research on the NQ Open dataset5. One primary objectives of the RALM method is to ascertain whether a given question necessitates retrieval augmentation (Mallen et al., 2023; Jiang et al., 2023), which drives far from the our focus. Therefore, we conduct experiments amidst the conflicting data, where the model lacks the requisite knowledge to formulate an accurate response and necessitates retrieval augmentation.
In Table 3, the ’w/o reranker’ means the presence of noise, whereas the ’oracle reranker’ has the capability to filter out all the noise. It is evident that the noise in the context significantly impacts both the CAD and CD, resulting in performances considerably lower than Regular. SC still displays the performance comparable to Regular. In contrast, COIECD maintains a marginal superiority over Regular, a distinction that becomes more pronounced when the retriever is coupled with an oracle reranker. Moreover, in real-world scenarios characterized by potentially noisy contexts, we posit the challenge of mitigating noise presents a unique research concern, particularly focusing on other components of RALMs, such as retrievers and rerankers. Enhanced reranking of external context is observed to correlate with improved performance in the COIECD. Notably, our approach still demonstrates robustness even in the absence of reranker.

heading: 4.6 Analyses on Contextual Information-Entropy Constraint
text: In this section, we delve into the criticality of the contextual information-entropy constraints within the COIECD model, specifically focusing on the impacts of the lower and upper bounds in various stochastic sampling decoding contexts. Table 4 presents the experimental results on the NQ dataset
5We use a single document as the context input, which is top-scored passage retrieved by DPR from WikiText-103.
0.10 0.25 0.50 1.00
36
38
40
42
44
46
E M
= 0.5 = 1 = 1.5 = 2.5
Figure 7: EM score on LLaMA2-7B Model
with LLaMA2-13B model. We observe that the exclusion of the lower bound leads to a discernible decrement in both EM and F1 scores across diverse decoding strategies. It demonstrates the pivotal role of the lower bound in improving the faithfulness to the conflicting contexts. Although the upper bound is crucial for limiting the inclusion of low-probability, potentially irrelevant tokens, the lower bound’s contribution to steering the model distribution towards more context-faithful tokens is more pronounced. Furthermore, a detailed case study is presented in Appendix H.
Notably, COIECD consistently surpasses the performance of Regular. This superiority is sustained even in scenarios where one of the bounds is omitted, highlighting the overall effectiveness and robustness of the COIECD.

heading: 4.7 Discussion on Hyperparameters
text: As illustrated in Figure 6 and 7, we conduct experiments with various values of λ and α on NQ dataset. We find λ = 0.25 and α = 1 consistently provide robust improvements over Regular decoding. Therefore, we adopt this hyperparameter configuration across all experiments.
Furthermore, we evaluate the model performance under the setting of α = 0 as simply providing not providing the context during decoding in Appendix I, which highlight the significance of adding g(yt). The detailed results are evaluated with EM and F1 metrics in Table 7 - 10.

heading: 5 Conclusion
text: 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.

heading: 6 Limitations
text: • We only evaluate our decoding method on the tasks of QA. It would be interesting to apply our method to other context-intensive NLP tasks such as summarization (Maynez et al., 2020; Pagnoni et al., 2021).
• Similar to the limitations of CD and CAD, our method also requires twice the computational resources due to the necessity of performing two decoding operations, thus resulting in a cost equivalent to double that of Regular decoding.
• Given the shorter length of answers in QA tasks, our approach omits the entropy smoothing calculation within the constraint during the decoding process. This step is generally incorporated in open-ended text generation tasks, aligning with the stable entropy theory described by Arora et al. (2023). Although this adaptation is practical for QA, we recognize it as a limitation and propose it as an area for future research.

heading: Acknowledgments
text: This work was supported by the National Key R&D Program of China (No.2022ZD0160503) and Yunnan Provincial Major Science and Technology Special Plan Projects (No. 202202AD080004)

heading: A Analyses of the Performances of Existing Decoding Methods
text: We compare the performance of three baseline methods (introduced in Section 4.1) on LLaMA213B model: Regular takes the context and question as input with greedy decoding, and the other two methods are specialized in conflict-solving decoding strategies. We experiment on three subsets of NQ (Kwiatkowski et al., 2019): data without conflict(∼1K), data with all conflicts (∼3K), and random sampled data with half-ratio conflicts. The details of these datasets is introduced in Appendix. E and the detailed experimental results are illustrated in the NQ dataset of Table 1 and Figure 4. We use Exact Match (EM) as the major evaluation metric in the comparison.
In the table presented below, it is observed that when conflicts occur 100% of the time, both conflict-solving decoding methods address the issue more effectively than Regular. Notably, CAD exhibits a pronounced improvement, achieving a significant increase of up to 2.08 in the EM score. Nevertheless, when the ratio of conflict decreases, there is a discernible decrease in those methods’ efficacy. Especially, the performance of CAD noticeably deteriorates, trailing behind the Regular by a margin of 5.55.
B Information-Theoretic Properties of Language Models
B.1 Locally Typical Set
Meister et al. (2023) posit that the language modeling can be conceptualized as a discrete stochastic process and build its notion on the concept of typical set. Informally, the typical set, derived from information theory, is the set of all samples that we would expect when sampling from the language model distribution. But it relies on a stationary and ergodic language process which contradicts with the non-ergodic language process. So they define a more restrictive notion of typical set - termed as locally typical set - for the language process, from which each token generates in a natural and error-minimizing manner.
Definition B.1 (Locally Typical Set). Let Y = {Yt}∞t=1 be a discrete stochastic process under distribution p. The (T, ε)-locally typical set of Y is
the set of all sequences of length exactly T such that L(T )ε = { y = y0 · · ·yT | ∀1 ≤ t ≤ T, (14)
∣∣∣ log p(yt | y<t) + H(Yt | Y <t = y<t) ∣∣∣ < ε }
The relationship can be formalized as the following hypothesis, which has been verified empirically using data from human language process.
Hypothesis B.2. Samples y = y0 · · ·yT from a human language process with distribution p tend to belong to the process’s locally typical set L(T )ε for large enough T and some ε > 0. In words, this means that we should expect every word in natural-sounding sentences to be close to the expected information content under p, i.e., the conditional entropy given prior context.
The H represents the entropy rate of Y , which is equivalent to the standard definition of (Shannon) entropy H for a random variable Y . The locally typical set restricts the set of tokens to those for which each has an information context——measured by its negative log probability——close to the expected information content given prior context, i.e., the entropy of the distribution p(· | y<t).
B.2 Stable Entropy Hypothesis Arora et al. (2023) postulate that natural language generations usually lie in a narrow and nearly flat entropy band. In the empirical analyses, they observe that, the mean entropy of a language model remains stable over the length of the generation, which is defined as the stable entropy baseline6 in Eq.15. Under the context distribution at time t, an input x and vocabulary V , yt ∈ V:
µH(t;V) = Eyt∈V [ H(yt | x,y<t) ] . (15)
Then a stable entropy zone is defined as the zone around the stable entropy baseline that covers a major fraction of entropy of the model under the target distribution. They define it by standard deviation (σH(t;V)) around the stable entropy baseline as the stable entropy zone and posit the following hypothesis:
Hypothesis B.3. Decoding algorithms whose generation’s smoothed entropy stays mostly enclosed within the stable entropy zone will produce higher quality, coherent, less repetitive, and more "humanlike" text.
6Here we drop the smoothing step for brevity.

heading: C Detailed Proofs of Propositions
text: Assumption C.1. If a task-specific context c is contained by parametric knowledge (denoted as K) without triggering any conflicts in model p, then it also can be the natural generation of model.
if c ∈ K, then c ∈ ⋃ y ∼ p(· | x)
Here, ⋃ y indicates the sampling set of all natural generations by the model conditioning by the question x. Then we define the entropy of the model following Arora et al. (2023) as
H(yt|x,y<t) = E yt∼p(·|y<t) − log p(yt|x,y<t) (16) For brevity, we use H1(yt) to represent the entropy of conditional distribution over question x and generation y<t, and H2(yt) denotes the entropy conditioning by x, y<t, and assumed generation c.
H1(yt) = H(yt|x,y<t) (17) H2(yt) = H(yt|x, c,y<t) (18)
where H2(yt) denotes the entropy conditioning by previously generated tokens c and y<t, and H1(yt) represents the entropy of conditional distribution over generation y<t. Proposition C.2 (Bound on Entropy Shift). The entropy shift denoted as H2(yt)−H1(yt) is bounded within the width of the stable entropy zone.
Proof. Note that context c is the natural generation of a language model in the setting, both the entropy H1(yt) and H2(yt) should fall into a stable entropy zone around the mean entropy µH. Let β be the threshold of a certain standard deviation around the mean entropy. According to Eq. 15, it can be deduced that ∣∣H1(yt)−µH1 ∣∣ < β 2 , ∣∣H2(yt)−µH2 ∣∣ < β 2 (19)
Stable entropy baseline demonstrates that mean entropy of a model under the target context distribution remains stable. Since the length of context is limited, the mean entropy µH1 and µH2 can be equated if smoothed, denoted as µH. Considering inequalities in Eq.(19) jointly, we can obtain the bound on the entropy shift using the triangle inequality:
∣∣H2(yt)−H1(yt) ∣∣
= ∣∣(H2(yt)− µH ) − ( H1(yt)− µH )∣∣ < ∣∣H2(yt)− µH ∣∣+ ∣∣H1(yt)− µH ∣∣ < β (20)
■
Proposition C.3 (Bound on information-entropy shift). As the information content of a random variable is quantified as its negative log-probability. Let the information content I(yt) = − log p(yt | x, c,y<t), we denote the information-entropy shift as: I(yt) − H1(yt). The following bound holds for a constant:
∣∣I(yt)−H1(yt) ∣∣ < γ (21)
where γ > 0.
Proof. Locally typicality demonstrates that the information content of y should is quite close to a specific value of the entropy under model distribution p. It means that there exists a sufficiently small constant ϵ > 0:
∣∣I(yt)−H2(yt) ∣∣ < ϵ (22)
which bounds the information of y into a coherent and contextual generation. Applying triangle inequality on Eq.(20) and Eq.(22), the following inequality holds for a constant:
∣∣I(yt)−H1(yt) ∣∣
= ∣∣(I(yt)−H2(yt) ) + ( H2(yt)−H1(yt) )∣∣ < ∣∣I(yt)−H2(yt) ∣∣+ ∣∣H2(yt)−H1(yt) ∣∣
< β + ϵ = γ (23)
■

heading: D Empirical Study of Assumption C.1
text: In this section, we show that the distribution entropy of non-conflicting context remains more stable than the non-conflicting one. Then the assumption C.1 can be proved with the stable entropy hypothesis B.3.
To demonstrate our assumption, we follow a similar setup as Arora et al. (2023) in a text completion setup. We use the LLaMA2-13B model and NQ data. We sample 500 pieces of data from Conf. and Non-Conf. sub-datasets respectively, then compute the mean smoothed entropy at each step and calculate the standard deviation (std) for each generation. Figure 8 visualizes the std of smoothed entropy for conflicting and non-conflicting generation. The vertical axis, labeled ’Std of Smoothed Entropy’, represents the std of each step’s entropy in the generation. The horizontal axis represents the NQ samples from Conf. and Non-Conf. data. From the violin plot, it can be observed that the
entropy distribution for Conf. data exhibit a bimodal nature, suggesting that quite a few samples are characterized by large variances. Furthermore, the box line of Conf. is higher than the one of NonConf., which demonstrates that the Non-Conf. is more likely to be a natural generation of the model due to its more stable entropy levels. This is deduced by the stable entropy hypothesis, which posits that "generation’s smoothed entropy stays mostly enclosed within the stable entropy zone will produce higher quality, coherent, less repetitive, and more ’human-like’ text.".

heading: E Dataset Details
text: We use three realistic QA datasets (NaturalQuestions (Kwiatkowski et al., 2019), SQuAD 1.1 (Rajpurkar et al., 2016)), and StrategyQA (Geva et al., 2021a)) and one conflicting QA dataset (Counterfacts dataset (Longpre et al., 2021)) for evaluating our method.
NaturalQuestions consists of real-world information-seeking queries issued to the Google search engine and their corresponding long answers (gold evidence passage) and short answers (one or more entities). In our study, we employ the long answers as the input context and short answers as the ground truth, and conduct evaluations on the dev set.
The SQuAD 1.1 is a common QA benchmark. It includes questions posed by human annotators on a given Wikipedia paragraph, where the answer to each question is a segment of text (or span) from the paragraph. In our experiments, we conduct experiments on the dev for evaluation.
StrategyQA is a fact reasoning benchmark that necessitates the implicit question decomposition into reasoning steps. Built around Wikipedia terms, these questions are accompanied by multiple evidence paragraphs. The model is expected to provide a True or False answer. We concatenate question-relevant evidences to form the input context. We adopt the training set for evaluation, considering the volume of data.
Counterfacts is based on the NaturalQuestions (Kwiatkowski et al., 2019) dataset. To generate conflicting contextual knowledge, Longpre et al. (2021) first identify questions with named entity answers, find the supportive document for each question and then replace the gold answer entity in the document with a random entity.
E.1 Posteriori judgement We delineates the process of identifying instances of knowledge conflicts. The evaluation of these conflicts is based on the accuracy7 of the model’s responses when context is not provided. The scenarios are divided into two categories:
• Non-Conflicting (Non-Conf.): This category pertains to situations where the model is capable of accurately responding to a question without the need for its corresponding context. Such instances suggest that the model has internalized the context, thereby indicating a consistency between its parametric knowledge and the external contextual knowledge.
• Conflicting (Conf.): When the model fails to provide the true answer without the aid of context, indicating a conflict between its inherent parametric knowledge and the external contextual knowledge. Following Wang et al. (2023d), incorrect responses reflects the model does not possess the knowledge equipped by the external context, which has a discrepancy with the model’s parametric knowledge.
In this setting, the NQ, SQuAD and StrategyQA datasets can serve as suitable approximations of realistic scenarios where conflicts may not necessarily occur. Additionally, the synthetic dataset named Counterfacts, which is composed exclusively of conflicting data (Conf. data), serves as a unique
7Given the excessively rigid nature of EM for evaluation, an F1 score of 0.5 has been employed as a proxy for preliminary categorization.
case. This is because it contains randomly replaced answers that are not inherently known to the model, distinguishing it from the aforementioned datasets.
E.2 Data Statistic
As illustrated in Table 5, a discernible trend emerges wherein an escalation in the model’s parameters is accompanied by a corresponding increase in the percentage of non-conflicting data, signifying a greater degree of internalized knowledge within larger models. Notably, among this cohort of models, the OPT series models exhibit the lowest parametric knowledge, yet they demonstrate substantial enhancements across most datasets when the COIECD method is applied. It is also noteworthy to observe that even in the case of the popular LLaMA2 models, the proportion of non-conflicting data does not surpass 25% in the NQ and SQuAD datasets. This observation necessitate the further research for the inherent parametric knowledge enhancement of the model.

heading: F Baseline Methods
text: Contrastive Decoding (CD) In our experiments, we employ the distribution g(yt) with a certain threshold as a baseline decoding method, referred to as the CD (Li et al., 2023b) method. We modify the original object of CD (computes the distribution discrepancy between an small amateur model and an expert larger model) to simulate the form of g(yt).
CDoriginal = log pEXP(yt|x, y < t)− log pAMA(yt|x, y < t) CDmodify = log p(yt|x, y < t)− p(yt|y < t) = log g(yt)
The threshold is same as in the original CD method:
Vhead(y<t) ={ yt ∈ V : p(yt|y<t) ≥ 0.1 ·max
y p(y|y<t)
}
Here, we represent the input context as x. CD adopts the object of difference between the output likelihood when inputs are presented with and without input context. It enhances the influence of the context for high-probability words within a crude threshold. Therefore, it cannot obtain consistent improvement in performance, particularly with non-conflicting data.
And the Section 3.1 aims to explore a delicate constraint for output distribution to find out whether the context is in conflict. Then we propose a contextual information-entropy constraint on fine-grained token level based on the perspective of information theory.
C(y<t) = {y ∈ V : lps ≤ ps(yt) ≤ ups} (7)
Context-Aware Decoding (CAD) In CAD (Shi et al., 2023a) method, the output probability is a product-of-experts of the original output probability and PMI weighted by α as follow:
yt ∼ softmax[(1 + α) logitθ(yt | c,x,y<t) − α logitθ(yt | x,y<t)]
Since they set α = 1 for all models evaluated on the knowledge conflict datasets, this method can be regarded as an unconstrained (λ = 1 in C(y<t)) decoding method when α is set to 1. If so, CAD can be considered as a specific case of our approach.
Furthermore, CAD, as evidenced in their experimental evaluation, necessitates the different hyperparameter values (the adjustment level of CAD is 0.5 and 1) for realistic datasets and counterfacts. The absence of such specific adjustments results in a substantial decline in performance. This aspect of our findings underscores the superiority and robustness of our method.

heading: G Maximization v.s. Sampling Strategies
text: Recall that prior experiments are conducted based on greedy strategy that maximizes the distribution probability, except for SC with a fixed sampling strategy. We explore other strategies like sampling alternatives based on the same baselines. Table 6 represents the results on maximization-based strategies: greedy decoding, and stochastic sampling: nucleus (Holtzman et al., 2019), top-k (Fan et al., 2018), typical (Meister et al., 2023) on the NQ dataset of LLaMA2-13B.
We observe that COIECD consistently produces the higher EM and F1 score the than Regular irrespective of the choice of decoding strategy. In
contrast, both the CD and CAD exhibit a lack of stability in performance among diverse decoding strategies. Additionally, the result points to the significant value of beam search, particularly in relation to CD, in boosting performance. It can be attributed to the increasing search width, a feature of beam search which effectively eliminates disturbing tokens brought by contrastive object.

heading: H Case Study
text: As illustrated in Figure 9, we look closer into two cases of conflicting and non-conflicting one.
Lower-bound & Upper-bound violation. The conflicting case mainly shows the function of lower bound. For token yt, if pδ(yt) ≤ lpδ , it represents a sufficiently low information content I(yt) compared to the entropy H1(yt). This indicates that the generation (like Russia) may be overconfident and other informative gains (like Qatar) may be ignored, then the conflict occurs. The upper bound serves to filter some disturbing low-probability distribution, which plays a role in stochastic sampling decoding. In the non-conflicting case, if pδ(yt) ≥ upδ , the high information context represents a lower probability, indicating that the model is less certain about current token (like Germany). The decreased confidence might also be attributed to a potential conflict within the context.
No violation. In the non-conflicting case, it is observed that no tokens fall into the lower-violation zone. This can be attributed to the model’s pronounced confidence in a solitary high-probability token, identified as Russia. Such a high degree of confidence leads to the assignment of a zero value to lpδ . The rationale behind this assignment stems from the understanding that a heightened level of confidence effectively indicates the non-existence of any conflict.

heading: I Detailed Results on Hyperparameter Analysis
text: Here we display the detailed results about hyperparameter analysis on different sizes of LLaMA2 model with EM and F1 metrics.
The different values of alpha can measure the importance of adding g(yt) in Eq. 12 (§ 3.2). The results highlight the significance of adding g(yt). The performance declines dramatically when α equals 0. It’s under a decoding strategy where simply providing or not providing the context during decoding.

heading: J More Results
text: We present the experimental results of GPT-3.5 and GPT-4 in Table 11, as well as the results on the other size of LLaMA2, OPT and FLAN-T5 models in Table 12-14.
J.1 The performances of GPT-3.5 and GPT-4
In general, the GPT-4 model displays a modestly superior performance in comparison to the models utilized in our experiments, whereas GPT-3.5 attains a level of performance that aligns with our best results achieved by the LLaMA2-13B model.
J.2 The Performances of Models in Different Size
Owing to the constraints of experimental resources, we confined our model within the scope of a maximum parameter capacity of 13B for the experiments. In addition to the main results in experiment
section, additional outcomes are illustrated in the
Table 12-14.

heading: Future Work
text: Although this adaptation is practical for QA, we recognize it as a limitation and propose it as an area for future research