DeCoRe: Decoding by Contrasting Retrieval Heads to Mitigate Hallucinations

## Abstract

Abstract Large Language Models (LLMs) often hallucinate, producing unfaithful or factually incorrect outputs by misrepresenting the provided context or incorrectly recalling internal knowledge.
Recent studies have identified specific attention heads within the Transformer architecture, known as retrieval heads , responsible for extracting relevant contextual information.
We hypothesise that masking these retrieval heads can induce hallucinations and that contrasting the outputs of the base LLM and the masked LLM can reduce hallucinations.
To this end, we propose De coding by Co ntrasting Re trieval Heads (DeCoRe), a novel training-free decoding strategy that amplifies information found in the context and model parameters.
DeCoRe mitigates potentially hallucinated responses by dynamically contrasting the outputs of the base LLM and the masked LLM, using conditional entropy as a guide.
Our extensive experiments confirm that DeCoRe significantly improves performance on tasks requiring high contextual faithfulness, such as summarisation (XSum by 18.6%), instruction following (MemoTrap by 10.9%), and open-book question answering (NQ-Open by 2.4% and NQ-Swap by 5.5%). 1 1 1 Code is available at https://github.com/aryopg/DeCoRe .

## 1 Introduction

Large Language Models (LLMs) have emerged as powerful natural language generators, demonstrating remarkable capabilities across a range of tasks (Radford et al., ; Brown et al., ; Wei et al., ; Ouyang et al., ).
However, LLMs are prone to *hallucinations*, where the model generates content that is not grounded in reality or misrepresents the facts (Ji et al., ; Rawte et al., ; Zhang et al., ; Li et al., ).
The tendency of LLMs to hallucinate undermines their reliability, especially when applied in high-stakes domains such as clinical decision-making or legal reasoning (Ahmad et al., ; Dahl et al., ).

Understanding the underlying mechanisms responsible for hallucinations in LLMs remains challenging.
Wu et al. () found that there are special attention heads responsible for retrieving relevant information from a given context, which they called *“retrieval heads”*.
While identifying these mechanisms is key to understanding LLMs, little research has explored how to use these insights to effectively mitigate hallucinations, which is the focus of our work.

Figure: Figure 1: Overview of the DeCoRe workflow. Given the same input, the base LLM ($\text{LLM}_{\text{base}}$) and the variant with masked retrieval heads ($\text{LLM}_{\text{masked}}$) predict the next token. An uncertainty estimation is applied to the base model’s output using conditional entropy: higher conditional entropy increases the contrastive factor ($\alpha$), penalising predictions that align with the $\text{LLM}_{\text{masked}}$. The final prediction is selected based on weighted contrastive decoding of the outputs from both models, leading to a more grounded response.
Refer to caption: x1.png

We propose a novel decoding method termed Decoding by Contrasting Retrieval Heads (DeCoRe), as illustrated in Figure 1.
This method builds on the assumption that masking retrieval heads can induce hallucination by impairing the ability of the model to retrieve relevant information from the context.
DeCoRe leverages Contrastive Decoding (Li et al., ) to amplify the differences between the original and the hallucinating outputs, leading to more accurate final responses.
Furthermore, we propose using the conditional entropy of the model’s next-token distribution to control the contrastive decoding mechanism.

Our findings show that DeCoRe significantly improves accuracy in tasks that require contextual faithfulness, such as XSum (Narayan et al., ), MemoTrap (Liu & Liu, ), Open Book Natural Questions (NQ; Kwiatkowski et al., ), and NQ-Swap (Longpre et al., ).
Furthermore, our experiments show that DeCoRe enhances the model’s accuracy in factual recall tasks.
For example, in the TriviaQA (Joshi et al., ) and PopQA (Mallen et al., ) dataset, DeCoRe shows an accuracy gain compared to other hallucination mitigation methods.
Similarly, when applied to TruthfulQA (Lin et al., ), the Llama3-8b-Instruct model (Dubey et al., ), when combined with DeCoRe, generates more truthful and informative responses than other comparable hallucination mitigation methods.
Finally, our experiments on MuSiQue (Trivedi et al., ) show that DeCoRe can significantly improve the accuracy of the model in long-form generation and reasoning tasks, for example, when used jointly with Chain of Thought (CoT; Wei et al., ) prompting.

## 2 DeCoRe: Decoding by Contrasting Retrieval Heads

Figure: Figure 2: Example of hallucination induced by masking retrieval heads in the NQ-Swap task. The base model retrieves the correct answer from the substituted context, while the masked model generates an incorrect answer.
Refer to caption: x2.png

DeCoRe operates by masking specific retrieval heads to trigger hallucinations and then employs a contrastive mechanism that penalises outputs resembling those from the hallucinating model, thereby amplifying the more accurate predictions of the base model.
We further enhance this approach with a dynamic entropy-controlled mechanism to adjust the contrastive effect based on the entropy of the next token distribution of the model.
Figure 1 illustrates this process over time.

### 2.1 Masking Retrieval Heads

In this section, we describe how we mask retrieval heads in our base LLM to induce hallucinations, following the notation from Vaswani et al. ().

Given a base LLM $f_{\text{base}}$, let $x_{<t}=(x_{1},x_{2},\dots,x_{t-1})$ be a sequence of previous tokens, where $x_{i}\in\mathcal{X}$ and $\mathcal{X}$ denotes the vocabulary of the model.
The logits for the next token distribution at time step $t$ are given by $f_{\text{base}}(x_{<t})\in\mathbb{R}^{|\mathcal{X}|}$, and the probability of the next token $x_{t}$ is:

$$ $p_{\text{base}}\left(x_{t}\mid x_{<t}\right)\propto\exp\left(f_{\text{base}}(x _{<t})\right)$ (1) $$

In our approach, we derive a variant of the base LLM by masking a set of *retrieval heads*.
We identify these heads using the method proposed by Wu et al. (), which involves analysing attention patterns on the Needle-in-a-Haystack (NitH; Kamradt, ) dataset.
The NitH dataset is designed to evaluate the ability of a model to retrieve specific information from a long context, making it suitable for identifying attention heads that contribute to information retrieval.
We compute a *retrieval score*, defining it as the ratio of successful copy-paste operations by each attention head, following Wu et al. (). Further details are provided in Section C.1.
We then rank the attention heads according to their retrieval scores and select the top $N$ heads as retrieval heads.
Let $\mathcal{H}_{\text{retrieval}}=\{(l_{1},h_{1}),\ldots,(l_{N},h_{N})\}$ denote the set of retrieval heads to be masked, where $l_{i}$ is the layer index and $h_{i}$ is the head index within that layer.
In a Transformer architecture, the output of the multi-head attention mechanism at layer $l$ is given by:

$$ $\text{MultiHead}^{(l)}\left(Q^{(l)},K^{(l)},V^{(l)}\right)=\text{Concat}\left( \text{head}^{(l)}_{1},\dots,\text{head}^{(l)}_{H}\right)W^{(l)}_{O},$ (2) $$

where $H\in\mathbb{Z}_{+}$ is the number of attention heads; $Q^{(l)}$, $K^{(l)}$, and $V^{(l)}\in\mathbb{R}^{d\times d_{k}}$ respectively denote the query, key, and value matrices at layer $l$; $d$ denotes the model hidden dimension and $d_{k}$ is the key dimension (where $d_{k}=d/H$); $W^{(l)}_{O}\in\mathbb{R}^{Hd_{k}\times d}$ denotes output projection layer; and each head is computed as:

$$ $\text{head}^{(l)}_{h}=\text{Attention}\left(Q^{(l)}W^{(l)}_{Q,h},K^{(l)}W^{(l) }_{K,h},V^{(l)}W^{(l)}_{V,h}\right),$ (3) $$

where $W^{(l)}_{Q,h}$, $W^{(l)}_{K,h}$, $W^{(l)}_{V,h}\in\mathbb{R}^{d\times d_{k}}$ respectively denote query, key, value weight matrices at layer $l$. To mask each head $\text{head}^{(l)}_{h}$ such that $(l,h)\in\mathcal{H}_{\text{retrieval}}$, we define a mask $m^{(l)}_{h}\in\{0,1\}$ such that:

$$ $m^{(l)}_{h}=\begin{cases}0&\text{if }(l,h)\in\mathcal{H}_{\text{retrieval}},\\ 1&\text{otherwise}.\end{cases}$ (4) $$

Then, the masked multi-head attention output at layer $l$ becomes:

$$ $\text{MultiHead}^{(l)}_{\text{masked}}\left(Q^{(l)},K^{(l)},V^{(l)}\right)= \text{Concat}\left(m^{(l)}_{1}\cdot\text{head}^{(l)}_{1},\dots,m^{(l)}_{H} \cdot\text{head}^{(l)}_{H}\right)W^{(l)}_{O},$ (5) $$

where $\cdot$ denotes the scalar multiplication.
The token logits of the masked model is then given by $f_{\text{masked}}\left(x_{<t}\right)$, and the next-token distribution is:

$$ $p_{\text{masked}}\left(x_{t}\mid x_{<t}\right)\propto\exp\left(f_{\theta_{ \text{masked}}}\left(x_{<t}\right)\right).$ (6) $$

We hypothesise that masking retrieval heads reduces the model’s ability to retrieve relevant information from the context, leading to a higher likelihood of generating hallucinations.
We empirically validate this hypothesis in Appendix D, where we evaluate the model on factuality and faithfulness evaluation tasks before and after masking retrieval heads.
Figure 2 shows an example of the induced hallucination after masking 10 retrieval heads in Llama3-8b-Instruct (Dubey et al., ).

### 2.2 Contrasting Base and Masked LLMs

Given the base and masked LLMs from Section 2.1, our goal is to improve the faithfulness of the generated output.
To achieve this, we propose contrasting the next-token distributions of the base and masked models, effectively increasing the likelihood of the tokens selected by the former while decreasing the likelihood of the tokens selected by the latter.
More formally, DeCoRe uses the following next-token distribution $p\left(x_{t}\mid x_{<t}\right)$:

$$ $p\left(x_{t}\mid x_{<t}\right)\propto\exp\left[(1+\alpha)\log p_{\text{base}} \left(x_{t}\mid x_{<t}\right)-\alpha\log p_{\text{masked}}\left(x_{t}\mid x_{< t}\right)\right].$ (7) $$

In Equation 7, the new next-token distribution $p(x_{t}\mid x_{<t})$ is defined by contrasting the next-token distributions of the base model $p_{\text{base}}(x_{t}\mid x_{<t})$ and the masked model $p_{\text{masked}}(x_{t}\mid x_{<t})$, introduced in Section 2.1; and $\alpha\in\mathbb{R}$ is a scaling factor that controls the weight of the next-token distribution induced by the base model $p_{\text{base}}(x_{t}\mid x_{<t})$ and the one induced by the masked model $p_{\text{masked}}(x_{t}\mid x_{<t})$. The term $\left(1+\alpha\right)\log p_{\text{base}}\left(x_{t}\mid x_{<t}\right)$ in Equation 7 encourages the base LLM to predict a highly probably token under its distribution, while $\alpha\log p_{\text{masked}}\left(x_{t}\mid x_{<t}\right)$ penalises predictions that are also likely under the masked model’s distribution.

### 2.3 Dynamic Contrastive Decoding

We propose a method to dynamically select the hyper-parameter $\alpha$ using an uncertainty quantification approach, namely the *conditional entropy*, which is considered a reliable predictor for whether a model might generate hallucinations (Malinin & Gales, ; Kadavath et al., ).(^2^22As we also validate in our experiments in Appendix F.)
For a given context $x_{<t}$, the conditional entropy $H\left(x_{t}\right)$ of the next-token distribution of a model $p\left(x_{t}\mid x_{<t}\right)$ is defined as:

$$ $H(x_{t})=-\sum_{x_{t}\in\mathcal{V}}p\left(x_{t}\mid x_{<t}\right)\log p\left( x_{t}\mid x_{<t}\right),$ (8) $$

where $\mathcal{V}$ denotes the vocabulary of the model; a high conditional entropy indicates that the model is uncertain about its prediction.
We propose using the conditional entropy (Equation 8) of the base model to dynamically tune the contrastive decoding process described in Equation 7; more specifically, we propose setting the hyper-parameter $\alpha$ in Equation 7 to $\alpha=H(x_{t})$ — as the entropy of the next-token distribution of the base model increases, $\alpha$ also increases, making potentially hallucinated generations less likely to be selected.

## 3 Experiment Setup

Hallucinations in LLMs can generally be categorised into two types – *factuality* and *faithfulness hallucinations* (Huang et al., ; Hong et al., ).
Factuality hallucinations refer to instances where the generated content is factually incorrect with respect to world knowledge.
Faithfulness hallucinations refer to instances where the generated content fails to accurately adhere to the given source of information.
Moreover, hallucinations tend to “snowball” in longer generation tasks such as multi-hop reasoning, compounding errors across multiple generation steps due to the inherently sequential behaviour of auto-regressive decoding in LLMs (Merrill & Sabharwal, ; Zhang et al., ).

In this section, we describe our experimental setup to evaluate DeCoRe.
We employ a diverse set of benchmarks to assess contextual faithfulness, factual accuracy, and multi-hop reasoning capability.
Given that retrieval heads are important in correctly retrieving contextual information (Wu et al., ) and looking back over *long reasoning processes* (Wu et al., ), while attention heads play a significant role in information transfer between tokens (Elhage et al., ), our experimental setup is designed to answer the following key research questions:
1) Can DeCoRe improve *contextual faithfulness*?
2) Can DeCoRe maintain or enhance the *factual recall* capabilities of LLMs?
3) Does coupling DeCoRe with CoT improve the multi-hop reasoning capability of the LLM?

### 3.1 Datasets and Evaluation Metrics

#### Faithfulness.

We evaluate faithfulness on summarisation, instruction-following, and reading comprehension datasets.
XSum (Narayan et al., ) is an abstractive summarisation dataset developed from BBC articles.
We sub-sample 1,000 examples, following Chuang et al. (), and evaluate summaries using ROUGE-L (Lin, ), BERTScore (Zhang et al., ), and factKB (Feng et al., ) for factual consistency.
MemoTrap (Liu & Liu, ) tests whether models can avoid *memorisation traps* and adhere to the given instructions, with performance reported using macro- and micro-averaged accuracy.
Instruction-Following Eval (IFEval; Zhou et al., ) evaluates the ability of the models to follow instructions on a set of verifiable instructions such as “write in more than 400 words”.
The performance is reported using Prompt-level and Instruction-level strict accuracies, which measure the percentage of prompts where all verifiable instructions are followed, and the percentage of verifiable instructions followed overall.
Open-Domain Natural Questions (NQ-Open; Lee et al., ) a QA dataset where we use an open-book configuration with one supporting document per question as described by Liu et al. ().
NQ-Swap (Longpre et al., ) is a version of NQ where the answer entity in the context was replaced with another entity and is used to evaluate the faithfulness of the model to the modified context. We evaluate the models with the Exact Match (EM) metric and, following Kandpal et al. () and Liu et al. (), we consider a prediction as correct if any sub-string of the prediction exactly matches any of the ground truth answers.

#### Factuality.

For factuality evaluation, we use four datasets—TruthfulQA, TriviaQA, PopQA, and NQ-Open.
TruthfulQA (Lin et al., ) (MC1, MC2, MC3, and Gen) is used to evaluate whether models can avoid common human falsehoods; MC1, MC2, and MC3 are multi-label classification tasks, and Gen is a generation task where evaluations use fine-tuned GPT models to assess the correctness and informativeness of the generated outputs.
TriviaQA (Joshi et al., ), PopQA (Mallen et al., ), and NQ-Open are open-domain QA datasets used to evaluate the ability of a model to answer questions about trivia, long-tail entities, and Google searches, respectively.
We use closed-book configuration on these datasets to evaluate factual recall.

#### Chain of Thought Reasoning.

We evaluate DeCoRe in CoT-style reasoning tasks on both closed- and open-book setups; we use MuSiQue (Trivedi et al., ), a multi-hop question-answering dataset that requires models to answer questions by reasoning using multiple and disconnected pieces of information.

More details on the evaluation protocol are available in Table 26.

### 3.2 Models

We evaluate two models from the Llama3 family Dubey et al. (), namely Llama3-8B-Instruct and Llama3-70B-Instruct, to analyse the influence of model size on the downstream results.
In Appendix H, we also report results from other model families, such as Mistral (Jiang et al., ) and Qwen2 (Yang et al., ).

### 3.3 Baselines

We compare DeCoRe against six baselines:
1) Greedy decoding;
2) Contrastive Decoding (CD; Li et al., ), where LLaMA3-8B-Instruct serves as the amateur model and LLaMA3-70B-Instruct act as the expert model;
3) Context-Aware Decoding (CAD; Shi et al., ), a variant of CD where the amateur model is the same as the expert model but is not presented with the additional context;
4) Decoding by Contrasting Layers (DoLa; Chuang et al., ) that subtracts the logits in early layers to calibrate the final-layer logits. We evaluate two versions: DoLa-low (i.e., contrasting the first half of the layers with the final layer) and DoLa-high (i.e., contrasting the second half with the final layer);
5) Activation Decoding (AD; Chen et al., ) which uses the sharpness of context activations within intermediate layers to calibrate the next token prediction;
6) ITI (Li et al., ) that trains linear classifiers on TruthfulQA data to obtain “factual” heads and layers with corresponding “factual” direction vectors and then apply intervention during the decoding process.
Note that ITI requires a training process on labelled data
, whereas other baselines and DeCoRe are training-free.
Also note that CAD is only applicable on tasks with additional context (i.e., XSum, open book NQ-Open, NQ-Swap, and open book MuSiQue).
All implementation details are available in Appendix J.

### 3.4 DeCoRe Variants

We evaluate three variants of DeCoRe:
1) DeCoRe${}_{\text{static}}$, which employs a static scaling factor $\alpha$ throughout generation;
2) DeCoRe${}_{\text{entropy}}$, which entropy to dynamically adjust the strength of the contrastive decoding;
3) DeCoRe${}_{\text{entropy-lite}}$, which is similar to DeCoRe${}_{\text{entropy}}$, except that it employs a smaller LLM with the same vocabulary space as the masked LLM.

## 4 Results

In the following, we present the evaluation results of DeCoRe across faithfulness, factuality, and multi-hop reasoning tasks.
We show that DeCoRe mitigates faithfulness and factuality hallucinations, and improves the accuracy of the model when combined with CoT prompting.
These effectively answer our research questions stated in Section 3.
Additionally, we examine the impact of the number of masked retrieval heads on task performance.
Finally, we demonstrate that DeCoRe reduces conditional entropy over time in long-generation tasks, contributing to more accurate outputs.
These results highlight DeCoRe’s broad effectiveness in enhancing LLM performance.

#### DeCoRe Mitigates Faithfulness Hallucinations.

**Table 1: Performance of different models and decoding methods on faithfulness evaluation tasks. For each base model, the best performance is indicated in bold, and the second-best is underlined.**
| Model | XSum | MemoTrap | IFEval | NQ-Open | NQ-Swap |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ROUGE-L $\uparrow$ | BERTScore-F1 $\uparrow$ | factKB $\uparrow$ | Macro Acc $\uparrow$ | Micro Acc $\uparrow$ | Prompt Acc $\uparrow$ | Instruct Acc $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ |  |
| Llama3-8b-Instruct | 19.90 | 67.23 | 47.61 | 65.86 | 64.40 | 70.24 | 78.30 | 69.68 | 60.62 |
| + ITI (Li et al., ) | 13.25 | 59.96 | 34.35 | 62.65 | 58.96 | 52.31 | 63.19 | 56.16 | 51.08 |
| + CAD (Shi et al., ) | 18.82 | 67.20 | 67.16 | - | - | - | - | 69.83 | 74.21 |
| + DoLA (low) (Chuang et al., ) | 19.82 | 67.19 | 47.21 | 65.27 | 63.69 | 69.69 | 78.18 | 69.68 | 60.77 |
| + DoLA (high) (Chuang et al., ) | 19.92 | 67.34 | 48.49 | 64.85 | 63.17 | 70.24 | 78.66 | 69.49 | 60.98 |
| + AD (Chen et al., ) | 19.79 | 67.31 | 48.49 | 65.38 | 64.28 | 67.65 | 76.26 | 68.93 | 60.51 |
| + DeCoRe${}_{\text{static}}$ | 19.87 | 67.83 | 64.07 | 69.53 | 69.20 | 69.13 | 78.06 | 70.62 | 64.43 |
| + DeCoRe${}_{\text{entropy}}$ | 19.45 | 67.69 | 66.10 | 74.14 | 74.87 | 68.39 | 76.38 | 70.66 | 66.08 |
| Llama3-70b-Instruct | 22.41 | 69.77 | 61.32 | 68.47 | 66.52 | 77.45 | 84.41 | 71.07 | 76.11 |
| + ITI (Li et al., ) | 21.64 | 69.46 | 61.33 | 71.24 | 68.73 | 76.71 | 83.69 | 71.90 | 74.76 |
| + CD (Li et al., ) | 22.71 | 69.99 | 54.73 | 69.27 | 67.55 | 71.72 | 79.74 | 65.80 | 68.37 |
| + CAD (Shi et al., ) | 21.45 | 69.28 | 65.61 | - | - | - | - | 71.83 | 84.70 |
| + DoLA (low) (Chuang et al., ) | 22.46 | 69.80 | 61.11 | 67.99 | 65.93 | 77.08 | 84.29 | 71.07 | 75.98 |
| + DoLA (high) (Chuang et al., ) | 22.43 | 69.93 | 59.99 | 67.92 | 65.81 | 78.00 | 84.65 | 70.40 | 75.26 |
| + AD (Chen et al., ) | 22.49 | 69.91 | 60.57 | 67.51 | 66.44 | 76.89 | 84.41 | 71.15 | 74.02 |
| + DeCoRe${}_{\text{static}}$ | 21.94 | 69.35 | 64.88 | 71.96 | 71.41 | 78.56 | 84.89 | 72.51 | 79.06 |
| + DeCoRe${}_{\text{entropy}}$ | 21.93 | 69.40 | 65.49 | 74.07 | 73.65 | 78.56 | 84.89 | 72.66 | 79.79 |
| + DeCoRe${}_{\text{entropy-lite}}$ | 22.28 | 69.34 | 59.57 | 72.11 | 70.58 | 61.37 | 71.46 | 71.26 | 75.90 |

Table 1 shows the performance of various models and decoding methods on faithfulness evaluation tasks.
The results show that DeCoRe${}_{\text{static}}$, DeCoRe${}_{\text{entropy}}$, and DeCoRe${}_{\text{entropy-lite}}$ consistently improve the base models across all tasks and model sizes.
Specifically, DeCoRe${}_{\text{entropy}}$ yields the best or very competitive results in several faithfulness-related tasks.For instance, with Llama3-8b-Instruct, DeCoRe${}_{\text{entropy}}$ attains a Macro Accuracy of 74.14% and a Micro Accuracy of 74.87% on MemoTrap, producing significantly more accurate results than all baselines. DeCoRe${}_{\text{entropy}}$ also achieves the highest EM scores on open-book NQ-Open and competitive results on NQ-Swap.
Similarly, with Llama3-70b-Instruct, DeCoRe${}_{\text{entropy}}$ achieves the highest EM score on NQ-Open and competitive results on NQ-Swap. In instruction-following tasks, DeCoRe${}_{\text{entropy}}$ also achieves competitive scores in the IFEval benchmark with Llama3-8b-Instruct, yielding Instruct and Prompt Strict Accuracy values of 68.39% and 76.38%, respectively.
With Llama3-70b-Instruct, DeCoRe${}_{\text{static}}$ and DeCoRe${}_{\text{entropy}}$ achieve the joint-highest Instruct and Prompt Strict Accuracy values of 78.56% and 84.89%, respectively.

While CAD yields accurate results on tasks like XSum and NQ-Swap, its applicability remains limited to datasets that provide additional contexts, making it not trivial to adapt to tasks such as MemoTrap and IFEval. On the other hand, DeCoRe${}_{\text{static}}$ and DeCoRe${}_{\text{entropy}}$ both improve the base models in all tasks.

#### DeCoRe Mitigates Factuality Hallucinations.

**Table 2: Performance of different models and decoding methods on factuality evaluation tasks. For each base model, the best performance is indicated in bold, and the second-best is underlined.**
| Model | TruthfulQA (MC) | TriviaQA | PopQA | TruthfulQA (Generation) | NQ-Open |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| MC1 $\uparrow$ | MC2 $\uparrow$ | MC3 $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ | $\%\text{Truth}\uparrow$ | $\%\text{Info}\uparrow$ | $\%\text{T}\cap\text{I}\uparrow$ | $\%\text{Reject}\downarrow$ | EM $\uparrow$ |  |
| Llama3-8b-Instruct | 39.41 | 55.69 | 30.31 | 56.58 | 26.64 | 80.66 | 63.89 | 44.55 | 43.94 | 29.04 |
| + ITI (Li et al., ) | 43.70 | 62.78 | 34.91 | 48.41 | 15.63 | 87.52 | 78.46 | 66.10 | 25.46 | 22.07 |
| + DoLA (low) (Chuang et al., ) | 39.05 | 55.65 | 30.06 | 56.63 | 26.58 | 80.66 | 62.91 | 43.70 | 45.04 | 29.15 |
| + DoLA (high) (Chuang et al., ) | 38.68 | 55.64 | 30.19 | 56.50 | 26.49 | 80.78 | 62.67 | 43.45 | 44.92 | 29.19 |
| + AD (Chen et al., ) | 31.21 | 55.30 | 28.28 | 54.93 | 26.38 | 80.42 | 63.40 | 43.82 | 43.82 | 28.32 |
| + DeCoRe${}_{\text{static}}$ | 38.68 | 55.74 | 29.80 | 56.93 | 26.86 | 80.78 | 67.93 | 48.71 | 41.74 | 29.42 |
| + DeCoRe${}_{\text{entropy}}$ | 38.43 | 55.86 | 30.95 | 56.40 | 26.88 | 78.95 | 74.05 | 53.00 | 38.68 | 28.96 |
| Llama3-70b-Instruct | 49.57 | 70.60 | 37.85 | 74.77 | 40.63 | 88.74 | 77.72 | 66.46 | 53.12 | 40.08 |
| + ITI (Li et al., ) | 48.96 | 67.04 | 37.27 | 73.54 | 39.62 | 82.50 | 74.30 | 56.92 | 37.94 | 38.57 |
| + CD (Li et al., ) | 57.77 | 76.65 | 47.08 | 72.83 | 37.03 | 88.25 | 88.13 | 76.38 | 52.26 | 36.23 |
| + DoLA (low) (Chuang et al., ) | 49.45 | 70.58 | 37.75 | 74.74 | 40.65 | 88.74 | 77.60 | 66.34 | 52.88 | 40.08 |
| + DoLA (high) (Chuang et al., ) | 49.69 | 70.88 | 38.01 | 73.96 | 40.00 | 88.98 | 58.38 | 47.37 | 54.71 | 39.59 |
| + AD (Chen et al., ) | 42.23 | 67.56 | 35.37 | 74.14 | 40.53 | 87.39 | 67.20 | 54.59 | 49.33 | 40.23 |
| + DeCoRe${}_{\text{static}}$ | 51.29 | 72.02 | 40.24 | 74.79 | 40.74 | 88.25 | 62.91 | 51.16 | 54.96 | 40.41 |
| + DeCoRe${}_{\text{entropy}}$ | 53.98 | 73.44 | 42.55 | 74.76 | 40.58 | 89.23 | 59.73 | 49.11 | 56.79 | 40.45 |
| + DeCoRe${}_{\text{entropy-lite}}$ | 55.32 | 73.38 | 43.74 | 73.87 | 39.09 | 88.13 | 90.09 | 78.21 | 52.02 | 39.21 |

While DeCoRe is primarily designed to improve contextual faithfulness, its impact on factual recall tasks is an open question.
To this end, we evaluate DeCoRe on a range of tasks where the model needs to produce factually correct generations—results are outlined in Table 2.
We can see that DeCoRe significantly improves the accuracy of the models across various factuality evaluation tasks.
For the Llama3-8b-Instruct model, DeCoRe${}_{\text{entropy}}$ demonstrates improvements in several TruthfulQA (Generation) metrics.
Specifically, it achieves an informativeness score of 74.05% and an intersection of truthfulness and informativeness score of 53.00%, second only to ITI, which requires fine-tuning the model on TruthfulQA data.(^3^33The rejection rates—the frequency by which the model answers “I have no comment”—of Llama3 models in TruthfulQA are higher than Llama2 models (Touvron et al., ), as reported by previous studies (Li et al., ; Chuang et al., ); we report metrics for the non-rejection answers in Section E.1.)
Furthermore, DeCoRe${}_{\text{static}}$ yields the highest EM score on TriviaQA (56.93%) among all decoding strategies and achieves competitive EM scores on PopQA.
For the larger Llama3-70b-Instruct model, DeCoRe${}_{\text{entropy}}$ achieves the highest truthfulness score (89.23%) on TruthfulQA (Gen); it performs competitively across informativeness and the intersection metrics, yielding the highest EM score on closed-book NQ-Open (40.45%).
Finally, DeCoRe${}_{\text{static}}$ yields the highest EM score on PopQA (40.74%).

These results suggest that DeCoRe methods can improve contextual faithfulness and factual consistency across different datasets.
We believe this phenomenon is closely related to the hypothesis of attention heads as Information Movement (Elhage et al., ), which suggests that attention heads facilitate the transfer of information between tokens and that the residual stream vector space of one token typically contains information from other tokens.
Thus, while factual recall may occur in the Multi-Layer Perceptron (Geva et al., ; Meng et al., ), masking retrieval heads may interfere with the information transfer from the question to the generated answer, potentially leading to hallucinations.
We hypothesise that DeCoRe leverages this phenomenon, improving downstream results in factual recall tasks.

#### DeCoRe with Chain-of-Thought.

**Table 3: Performance of different models and decoding methods on MuSiQue, a multi-hop reasoning dataset, with and without CoT prompting in both closed-book and open-book settings. For each base model, the best performance is indicated in bold, and the second-best is underlined.**
| Model | MuSiQue without CoT | MuSiQue with CoT |  |  |
| --- | --- | --- | --- | --- |
| Closed Book $\uparrow$ | Open Book $\uparrow$ | Closed Book $\uparrow$ | Open Book $\uparrow$ |  |
| Llama3-8b-Instruct | 7.41 | 58.83 | 14.61 | 69.84 |
| + CAD | - | 57.88 | - | 73.02 |
| + ITI | 4.01 | 45.84 | 4.18 | 38.31 |
| + DoLA | 7.24 | 59.08 | 14.94 | 69.92 |
| + AD | 6.99 | 58.63 | 14.40 | 69.92 |
| + DeCoRe${}_{\text{static}}$ | 7.90 | 61.23 | 14.69 | 72.49 |
| + DeCoRe${}_{\text{entropy}}$ | 7.70 | 61.98 | 13.90 | 74.47 |
| Llama3-70b-Instruct | 11.79 | 68.56 | 20.15 | 74.43 |
| + CD | 10.92 | 66.61 | 17.17 | 71.70 |
| + CAD | - | 68.64 | - | 74.02 |
| + ITI | 10.88 | 68.14 | 20.44 | 74.27 |
| + DoLA | 11.42 | 68.68 | 20.15 | 74.64 |
| + AD | 11.38 | 68.14 | 20.23 | 74.27 |
| + DeCoRe${}_{\text{static}}$ | 11.79 | 69.76 | 20.60 | 75.05 |
| + DeCoRe${}_{\text{entropy}}$ | 11.75 | 69.84 | 20.60 | 74.93 |
| + DeCoRe${}_{\text{entropy-lite}}$ | 11.13 | 69.34 | 18.87 | 73.36 |

To assess the effectiveness of DeCoRe-based approaches in multi-hop reasoning tasks, we evaluate them on the MuSiQue dataset.
Multi-hop reasoning requires models to integrate information across multiple reasoning steps, and retrieval heads may be crucial in this process as they allow models to reference earlier generated tokens.
We conduct experiments in both closed-book and open-book settings, with and without CoT prompting.
The closed-book setting resembles factuality evaluation, where a model can rely solely on its parametric knowledge, while the open-book setting is related to faithfulness evaluation since the model has access to a corpus of external knowledge.

As shown in Table 3, DeCoRe variants consistently improve the EM scores across various settings.
For the Llama3-8b-Instruct model, DeCoRe${}_{\text{static}}$ enhances the EM score in the closed-book setup with CoT from 14.61% (base model) to 14.69%, while in the open-book setup without CoT, DeCoRe${}_{\text{entropy}}$ achieves the highest score (61.98%). DeCoRe${}_{\text{entropy}}$ also yields accurate results in the open-book CoT scenario, achieving the most accurate results (74.47% EM). For the Llama3-70b-Instruct model, both DeCoRe${}_{\text{static}}$ and DeCoRe${}_{\text{entropy}}$ yield very accurate results, improving the EM score in the closed-book setup with CoT from 20.15% (base model) to 20.60%. DeCoRe${}_{\text{static}}$ achieves the highest score in the open-book CoT setup (75.05%), with DeCoRe${}_{\text{entropy}}$ closely following at 74.93%.
These improvements underscore the effectiveness of DeCoRe in enhancing reasoning capabilities, especially when CoT prompting and external context are involved.

Overall, the results indicate that DeCoRe improves information transfer between reasoning steps, leading to higher EM scores in both closed and open-book settings.
This validates our hypothesis and demonstrates the usefulness of DeCoRe in tasks requiring complex reasoning, validating the insights from Wu et al. () on the significance of retrieval heads in multi-step reasoning.

#### Effect of Retrieval Head Masking on Task Performance of DeCoRe.

Figure: (a) Faithfulness Evaluation Tasks
Refer to caption: x3.png

We now analyse the correlation between the number of masked retrieval heads and the downstream results of the Llama3-8B-Instruct model; results are outlined in Figure 3.
We can see that the performance of DeCoRe${}_{\text{entropy}}$ across various tasks strongly correlates with the number of masked retrieval heads.
For example, in XSum and MemoTrap, we can observe positive correlations between the factKB and macro accuracy scores and the number of masked retrieval heads.
We attribute this to the nature of summarisation (XSum) and instruction-following (MemoTrap) tasks, which rely heavily on the ability of the model to extract and copy relevant information accurately.
However, we observe a moderate negative correlation as the number of masked retrieval heads increases on another Instruction following task, IFEval.
We hypothesise that the reason behind this phenomenon is that IFEval requires a different copying mechanism than in MemoTrap.
As opposed to having to provide an exact copy of a segment of the input, like in MemoTrap or partially XSum, IFEval requires the model to adhere to the instruction, which may not require an induction mechanism (e.g., “In your response, the letter {letter} should appear {N} times.”).

In tasks such as open-book NQ-Open and NQ-Swap, we can see a moderate negative correlation between the number of masked retrieval heads and EM. Nevertheless, in all experiments, DeCoRe${}_{\text{entropy}}$ produces more accurate results than the baseline in such tasks.

In factual recall tasks (i.e., TriviaQA, PopQA, and closed-book NQ-Open), we can see a negative correlation between EM scores and the number of masked retrieval heads. During decoding, when the masked retrieval heads fail to introduce significant differences between the “hallucinating” and the outputs of the base model, the effect of DeCoRe${}_{\text{entropy}}$ becomes less pronounced.
TruthfulQA differs from the other factuality tasks, showing a moderate positive correlation between downstream accuracy and the number of masked retrieval heads.
This suggests that truthfulness, or the ability to discern popular misconceptions, may require different retrieval mechanisms than the typical factual recall tasks.
These findings can be combined with the results of masking random attention heads (Section G.1) further supporting our hypothesis on the effectiveness of masking retrieval heads in contrastive decoding.

#### DeCoRe yields lower entropy across time in long generation tasks.

Figure: (a) XSum
Refer to caption: x6.png

We found that lower conditional entropy is related to correct predictions; generated sequences with lower conditional entropy tend to be more reliable (see Appendix F).
Motivated by the importance of low conditional entropy, we evaluate the length-normalised conditional entropy of different decoding strategies in long-generation tasks (i.e., XSum, and MuSiQue with CoT prompting).

As shown in Figure 4, DeCoRe${}_{\text{entropy}}$ yields lower conditional entropy compared to the baselines.
DeCoRe${}_{\text{entropy}}$ demonstrates lower entropy in the open-book QA task (MuSiQue), with an average entropy of 0.29 compared to 0.30 for the baselines.
Similarly, in XSum, DeCoRe${}_{\text{entropy}}$ achieves an entropy of 0.38, outperforming the baselines.
In tasks such as summarisation (XSum) and open-book QA (MuSiQue), lower entropy is crucial because the model must strictly adhere to the provided document or evidence while generating the summary or answer.
Any deviation from the context can result in hallucinations or factually incorrect outputs.
The lower entropy observed with DeCoRe${}_{\text{entropy}}$ indicates that it generates less “surprising” sequences, reducing the likelihood of hallucinations.

Overall, the reduction in conditional entropy shows that DeCoRe${}_{\text{entropy}}$ is able to maintain lower uncertainty throughout long-generation tasks.
This reinforces the effectiveness of DeCoRe${}_{\text{entropy}}$ in applications requiring high contextual faithfulness, such as summarisation and open-book QA.

## 5 Related Works

#### Internal Mechanism of LLMs.

Studies have attempted to dissect the inner workings of LLMs by focusing on layers (Wallat et al., ; Geva et al., ; Meng et al., ; Yu et al., ), neurons (Dai et al., ), and attention heads (Elhage et al., ; Geva et al., ; Yuksekgonul et al., ).
A seminal discovery in this area is the identification of induction heads, the attention heads that perform an induction algorithm by looking back over the context to predict a similar completion (Olsson et al., ).
Similarly, Wu et al. () identified retrieval heads, a specific set of attention heads responsible for maintaining long-context factuality.
These insights into the internal workings of LLMs is instrumental to our work, which focuses on these mechanisms to reduce hallucination.
Our work leverages the idea that the masking of retrieval heads leads to hallucination.

#### Constrained Decoding.

Constrained decoding focuses on intervening during the generation process to reduce hallucinations.
One example of constrained decoding is Inference-Time Intervention (ITI; Li et al., ) which intervenes by probing and modifying attention heads or layers associated with model correctness.
Contrastive Decoding (CD; Li et al., ) improves fluency and coherence by contrasting outputs from stronger expert LMs with those from weaker, smaller LMs.
Building on CD, Shi et al. () propose Context Aware Decoding (CAD) to mitigate contextual hallucinations by contrasting the output of an LLM with and without the provided context.
Similarly, Induced-then-Contrast Decoding (ICD; Zhang et al., ) fine-tunes a factually weak LLM using an automatically generated non-factual dataset, although this approach depends on the quality of the dataset and requires fine-tuning.
More closely related to DeCoRe is Decoding by Contrasting Layers (DoLa; Chuang et al., ) and Autocontrastive Decoding (ACD; Gera et al., ), which examines the internal mechanism of the LLMs without fine-tuning.
Both DoLa and ACD proposed contrasting the predictions of the final layer against the earlier ones via early exiting (Teerapittayanon et al., ; Elbayad et al., ).
Activation Decoding (Chen et al., ) also examines the internal mechanism of the LLMs, particularly the sharpness of context ativations to calibrate the next token’s probability distribution.
DeCoRe distinguishes itself by masking retrieval heads to induce hallucinations, followed by a dynamic entropy-controlled contrastive decoding to penalise uncertain outputs, effectively reducing hallucinations without the need for fine-tuning.

## 6 Conclusion

DeCoRe (Decoding by Contrasting Retrieval Heads) is a novel decoding strategy that aims to reduce faithfulness and factuality hallucinations in LLMs.
DeCoRe is based on the assumption that masking retrieval heads can induce hallucinations by limiting the ability of the model to retrieve relevant information from the given context.
Specifically, DeCoRe uses retrieval head masking to create a version of the model that is more likely to generate hallucinations and combines it with the original model via a contrasting decoding scheme (Section 2.2).
Furthermore, we propose a simple approach to control the strength of the contrastive decoding scheme by using the conditional entropy of the next-token distribution of the model (Section 2.3).
Our experimental results show that DeCoRe significantly improves the accuracy of the model in tasks requiring contextual faithfulness and in some factual recall and reasoning tasks.

#### Limitations.

While DeCoRe improves the performance of the base model across most tasks, there is no “free lunch”; existing baselines may still produce more accurate results than DeCoRe in specific tasks (  e.g., ITI in TruthfulQA or CAD in NQ-Swap).
However, these baselines often offer limited improvements or may even generate less accurate responses in other tasks.
We also observed that DeCoRe offers only marginal enhancements in factual recall tasks, suggesting that retrieval heads may not play a primary role in factual recall except for information transfer.
Finally, while we propose using the conditional entropy of the model’s next-token distribution to control the contrastive decoding scheme in DeCoRe, more “semantic” methods of uncertainty quantification may also be used (Farquhar et al., ).

## Acknowledgements

We thank Dino Oglic and Anshul Kanakia for their unwavering support throughout this project.
We also thank Emile van Krieken, Giwon Hong, Hongru Wang, Joshua Ong Jun Leang, Xiaotang Du, Xuanli He, and Yu Zhao for their meticulous review and invaluable feedback, which significantly improve the quality of this paper.
This work was done during APG’s internship at AstraZeneca.
APG was supported by the United Kingdom Research and Innovation (grant EP/S02431X/1), UKRI Centre for Doctoral Training in Biomedical AI at the University of Edinburgh, School of Informatics.
PM was partially funded by ELIAI (The Edinburgh Laboratory for Integrated Artificial Intelligence), EPSRC (grant no. EP/W002876/1), an industry grant from Cisco, and a donation from Accenture LLP.
BA was partially funded by Legal and General PLC as part of the Advanced Care Research Centre and by the Artificial Intelligence and Multimorbidity: Clustering in Individuals, Space and Clinical Context (AIM-CISC) grant NIHR202639.
This work was supported by the Edinburgh International Data Facility (EIDF) and the Data-Driven Innovation Programme at the University of Edinburgh.

## Appendix A Reproducibility Statement

- 1.
For all authors…
(a)
Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
[Yes] We claim to propose a novel training-free decoding strategy that leverages retrieval head mechanism, which we present as DeCoRe (Decoding by Contrasting Retrieval Heads).
(b)
Did you describe the limitations of your work?
[Yes] See Section 6.
(c)
Did you discuss any potential negative societal impacts of your work?
[Yes] See Appendix B.
(d)
Have you read the ethics review guidelines and ensured that your paper conforms to them?
[Yes]
- 2.
If you are including theoretical results…
(a)
Did you state the full set of assumptions of all theoretical results?
[N/A]
(b)
Did you include complete proofs of all theoretical results?
[N/A]
- 3.
If you ran experiments (e.g. for benchmarks)…
(a)
Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?
[Yes] Our code is available at [https://github.com/aryopg/DeCoRe](https://github.com/aryopg/DeCoRe). See details in Appendix J for more details.
(b)
Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] We mention the implementation details including the hardware, libraries, implementation of the baselines, as well as task-specific setups in Appendix J. We also provide a justification of the number of retrieval heads to be masked in Appendix C.2. Additionally, we provide the full ablation study results of different number of retrieval heads in Appendix G.
(c)
Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
[Yes] We reported error bars for experiments requiring multiple runs (i.e., masking random heads in Figure 6 and Figure 8, along with their accompanying tables).
(d)
Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)?
[Yes] See Appendix J.1.
- 4.
If you are using existing assets (e.g., code, data, models) or curating/releasing new assets…
(a)
If your work uses existing assets, did you cite the creators?
[Yes] See Section 3
(b)
Did you mention the license of the assets?
[N/A] All used assets are open-source.
(c)
Did you include any new assets either in the supplemental material or as a URL?
[Yes] Our code is available at [https://github.com/aryopg/DeCoRe](https://github.com/aryopg/DeCoRe).
(d)
Did you discuss whether and how consent was obtained from people whose data you’re using/curating?
[N/A]
(e)
Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
[N/A]
- 5.
If you used crowdsourcing or conducted research with human subjects…
(a)
Did you include the full text of instructions given to participants and screenshots, if applicable?
[N/A]
(b)
Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable?
[N/A]
(c)
Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation?
[N/A]

## Appendix B Ethics Statement

Our proposed method, DeCoRe, aims to mitigate hallucinations in LLMs, particularly in tasks where contextual faithfulness are critical. By improving the reliability of LLMs, DeCoRe has the potential to reduce the risks associated with incorrect or misleading information generation.

Despite these positive intentions, there is a potential for DeCoRe to be misused.
For example, its ability to suppress contextual hallucinations may be exploited to generate more convincing but misleading content by providing it with factually incorrect or unverified contextual documents.

To mitigate these risks, we have open-sourced our implementation to facilitate broader scrutiny from the community.
Furthermore, we recommend that DeCoRe be applied with caution in sensitive domains where even small inaccuracies may have significant consequences, such as clinical and legal domains.

## Appendix C Retrieval Heads

### C.1 Extraction of Retrieval Heads

We follow the procedure provided by Wu et al. ()(^4^44[https://github.com/nightdessert/Retrieval_Head](https://github.com/nightdessert/Retrieval_Head)) which defines the retrieval score of attention heads as the ratio of successful copy-paste operations.
They propose to calculate the retrieval score by compiling three sets of Needle-in-a-Haystack samples (Kamradt, ).
Given a question $q$ and its corresponding answer $k$ (the needle), we insert $k$ in a given context $x$ (the haystack) at a random position index range $i_{q}$.
The language model is then tasked with answering $q$ based on the haystack with the inserted needle.
We set $q$ and $k$ unique and irrelevant with the given long context, ensuring that if an answer is correctly generated, it is indeed copied from the context, not from the model’s internal knowledge.
Retrieval score of head $h$ is defined as:

$$ $\text{retrieval_score}_{h}=\frac{|g_{h}\cap k|}{|k|}$ $$

Where $g_{h}$ is the set of tokens copy-pasted by head $h$.
Retrieval score signifies the attention head ability to recall tokens from the given context, and can be used as a metric to identify retrieval heads in transformer-based LLMs.

### C.2 Retrieval Scores

Figure: (a) Meta-Llama-3-8B.
Refer to caption: x9.png

**Table 4: Retrieval Scores of the Retrieval Heads of each model.**
| Retrieval Head ID | Meta-Llama-3-8B | Meta-Llama-3-8B-Instruct | Meta-Llama-3-70B-Instruct | Mistral-7B-Instruct-v0.3 | Qwen2-7B-Instruct |
| --- | --- | --- | --- | --- | --- |
| 1 | 0.9341 | 0.9447 | 0.9172 | 0.8741 | 0.7746 |
| 10 | 0.4666 | 0.4421 | 0.3844 | 0.3167 | 0.3487 |
| 20 | 0.2927 | 0.2743 | 0.1874 | 0.1951 | 0.1986 |
| 30 | 0.1347 | 0.1421 | 0.1310 | 0.1457 | 0.1243 |
| 40 | 0.1074 | 0.1131 | 0.1112 | 0.1115 | 0.1077 |
| 50 | 0.0881 | 0.0916 | 0.0914 | 0.0944 | 0.0843 |
| 60 | 0.0735 | 0.0751 | 0.0867 | 0.0852 | 0.0703 |
| 70 | 0.0623 | 0.0659 | 0.0814 | 0.0751 | 0.0620 |
| 80 | 0.0572 | 0.0604 | 0.0630 | 0.0704 | 0.0524 |
| 90 | 0.0491 | 0.0513 | 0.0571 | 0.0641 | 0.0412 |
| 100 | 0.0433 | 0.0452 | 0.0526 | 0.0538 | 0.0352 |

As shown in Figure 5, the retrieval scores for each model follow a similar pattern across all examined LLM variants.
According to Wu et al. (), an attention head can be considered a retrieval head if it performs a copy-paste operation at least 10% of the time, which corresponds to a retrieval score of 0.1.
In all the models evaluated, the retrieval scores drop below 0.1 just before reaching the 50th retrieval head.
This indicates that beyond this number, the attention heads may not be reliably performing retrieval tasks.
Table 4 provides the precise retrieval scores for selected heads in each model.

To ensure the robustness of our experiments, we extended the masking of retrieval heads up to the 100th retrieval head for each model, even though the data suggest that heads beyond the 50th have minimal retrieval ability.
This conservative approach ensures that we comprehensively account for all potential retrieval heads during the contrastive decoding process.

## Appendix D Performance of Baseline Model with Masked Heads

### D.1 Rationale

DeCoRe operates under the assumption that masking retrieval heads would cause hallucinations in LLMs.
Therefore, the expected behaviour is that the performance of the LLM would go down the more retrieval heads that are masked.

Figure: (a) Faithfulness Evaluation Tasks
Refer to caption: x14.png

### D.2 Faithfulness

**Table 5: Performance comparison of Llama3-8B-Instruct with different number of masked retrieval heads on faithfulness evaluation tasks.**
| Model | Masked Retrieval Heads | XSum | MemoTrap | IFEval | NQ-Open | NQ-Swap |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ROUGE-L $\uparrow$ | BERTScore-F1 $\uparrow$ | factKB $\uparrow$ | Macro Acc $\uparrow$ | Micro Acc $\uparrow$ | Prompt Acc $\uparrow$ | Instruct Acc $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ |  |  |
| Llama3-8B-Instruct | 0 (Baseline) | 19.90 | 67.23 | 47.61 | 65.86 | 64.40 | 70.24 | 78.30 | 69.68 | 60.62 |
| 10 | 20.51 | 67.33 | 36.56 | 66.76 | 65.89 | 62.66 | 72.90 | 64.26 | 42.92 |  |
| 20 | 20.52 | 67.07 | 34.89 | 64.44 | 63.96 | 63.77 | 73.74 | 62.30 | 43.57 |  |
| 30 | 20.21 | 66.49 | 29.70 | 65.92 | 64.12 | 61.74 | 72.54 | 63.24 | 46.48 |  |
| 40 | 19.92 | 66.24 | 26.72 | 66.83 | 64.83 | 58.41 | 68.94 | 62.79 | 46.73 |  |
| 50 | 20.05 | 66.47 | 25.97 | 68.08 | 67.07 | 55.08 | 66.91 | 62.49 | 44.77 |  |
| 60 | 20.05 | 66.54 | 23.33 | 68.49 | 67.03 | 55.27 | 67.15 | 62.90 | 44.23 |  |
| 70 | 19.42 | 66.14 | 24.55 | 67.88 | 65.89 | 56.01 | 68.23 | 63.01 | 46.97 |  |
| 80 | 19.13 | 64.53 | 22.40 | 64.72 | 62.23 | 55.08 | 67.63 | 60.45 | 43.62 |  |
| 90 | 19.46 | 64.39 | 21.12 | 63.77 | 61.28 | 54.16 | 66.55 | 57.97 | 40.77 |  |
| 100 | 19.54 | 62.47 | 17.13 | 60.02 | 56.95 | 47.50 | 59.47 | 56.61 | 39.02 |  |

**Table 6: Performance comparison of Llama3-8B-Instruct with different numbers of masked random heads on faithfulness evaluation tasks.**
| Model | Masked Retrieval Heads | XSum | MemoTrap | IFEval | NQ-Open | NQ-Swap |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ROUGE-L $\uparrow$ | BERTScore-F1 $\uparrow$ | factKB $\uparrow$ | Macro Acc $\uparrow$ | Micro Acc $\uparrow$ | Prompt Acc $\uparrow$ | Instruct Acc $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ |  |  |
| Llama3-8B-Instruct | 0 (Baseline) | 19.90 | 67.23 | 47.61 | 65.86 | 64.40 | 70.24 | 78.30 | 69.68 | 60.62 |
| 10 | 20.09 ±0.21 | 67.07 ±0.32 | 44.52 ±4.86 | 66.79 ±2.11 | 65.16 ±2.61 | 68.64 ±0.77 | 77.14 ±0.39 | 69.45 ±0.46 | 61.39 ±0.24 |  |
| 20 | 20.00 ±0.15 | 66.80 ±0.46 | 40.77 ±5.98 | 67.89 ±3.24 | 66.54 ±4.43 | 69.50 ±0.93 | 77.66 ±0.68 | 68.94 ±0.81 | 60.67 ±2.08 |  |
| 30 | 19.87 ±0.18 | 66.61 ±0.89 | 36.65 ±11.64 | 66.88 ±2.66 | 65.29 ±3.71 | 68.27 ±1.36 | 76.58 ±1.45 | 69.18 ±0.66 | 60.70 ±2.87 |  |
| 40 | 19.63 ±0.09 | 66.55 ±1.12 | 35.09 ±14.85 | 66.29 ±2.05 | 63.83 ±3.39 | 67.59 ±1.34 | 75.86 ±1.20 | 68.78 ±1.19 | 57.19 ±6.92 |  |
| 50 | 19.59 ±0.19 | 66.34 ±1.23 | 32.25 ±14.71 | 67.59 ±2.09 | 64.76 ±3.84 | 66.23 ±1.98 | 75.18 ±1.26 | 68.57 ±0.80 | 57.21 ±5.62 |  |
| 60 | 19.28 ±0.77 | 66.02 ±1.52 | 31.67 ±12.94 | 67.85 ±0.80 | 63.99 ±1.09 | 62.97 ±2.82 | 72.30 ±3.11 | 68.10 ±1.04 | 55.97 ±3.79 |  |
| 70 | 19.48 ±0.53 | 65.81 ±1.67 | 27.20 ±12.83 | 68.33 ±4.57 | 64.51 ±4.95 | 60.87 ±4.41 | 70.74 ±3.47 | 67.85 ±1.04 | 55.00 ±3.48 |  |
| 80 | 18.96 ±0.94 | 64.92 ±0.94 | 26.02 ±13.42 | 69.66 ±6.45 | 66.40 ±7.16 | 56.87 ±4.16 | 66.79 ±2.98 | 67.08 ±1.21 | 54.59 ±5.23 |  |
| 90 | 17.55 ±1.19 | 61.85 ±4.91 | 28.00 ±13.27 | 73.39 ±4.35 | 70.71 ±4.93 | 50.96 ±10.71 | 62.39 ±9.58 | 66.53 ±0.49 | 54.26 ±5.17 |  |
| 100 | 17.13 ±1.17 | 61.61 ±6.05 | 28.46 ±9.30 | 74.65 ±3.67 | 72.02 ±4.25 | 48.92 ±8.04 | 60.67 ±7.43 | 66.54 ±0.91 | 54.71 ±5.34 |  |

Figure 6(a) illustrates the contrasting effects of masking retrieval heads (blue) and random heads (orange) on faithfulness evaluation tasks across XSum, MemoTrap, open-book NQ, and NQ-Swap.

In XSum, masking retrieval heads results in a sharp decline in factKB scores ($r_{ret}=-0.93$), indicating the critical role of retrieval heads in maintaining factual consistency in summarisation.
Masking random heads also causes a gradual decline ($r_{random}=-0.94$), however, the variance is high which suggests that retrieval heads are more important for contextual faithfulness.

For MemoTrap, masking retrieval heads shows a moderate correlation with the macro-averaged accuracy ($r_{ret}=-0.43$), while masking random heads surprisingly improves performance ($r_{random}=0.84$).
This implies that retrieval heads are essential for instruction-following, while random heads may not play as crucial a role and can even hinder performance.

In NQ Open and NQ Swap, the EM score drop significantly when retrieval heads are masked with a strong correlation score ($r_{ret}=-0.86$ and $r_{ret}=-0.64$), confirming their importance in open-book QA tasks.
In both tasks, masking random heads also degrades performance, with stronger negative correlation ($r_{random}=-0.97$ and $r_{random}=-0.94$ respectively).

Despite the more significant performance drop when masking retrieval heads, the correlation coefficient is lower than that for random heads. This is due to the concentrated decline in performance after masking the top 10 retrieval heads.
In contrast, performance degrades more gradually when random heads are masked, resulting in a stronger linear correlation.
This pattern suggests that masking just the top retrieval heads can already significantly impair the model’s ability to remain faithful to the context.
Additionally, the more retrieval heads that are masked, the greater the performance drop, indicating that retrieval heads play a key role in maintaining task-specific faithfulness.

### D.3 Factuality

**Table 7: Performance comparison of Llama3-8B-Instruct with different number of masked retrieval heads on factuality evaluation tasks.**
| Model | Masked Retrieval Heads | TruthfulQA (MC) | TriviaQA | PopQA | NQ-Open |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
| MC1 $\uparrow$ | MC2 $\uparrow$ | MC3 $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ |  |  |
| Llama3-8B-Instruct | Baseline | 39.41 | 55.69 | 30.31 | 56.58 | 26.64 | 29.04 |
| 10 | 39.17 | 57.40 | 31.57 | 55.77 | 25.84 | 28.81 |  |
| 20 | 40.27 | 59.37 | 33.24 | 55.26 | 25.39 | 28.93 |  |
| 30 | 40.51 | 60.51 | 33.30 | 55.39 | 25.32 | 29.42 |  |
| 40 | 41.49 | 61.11 | 34.00 | 54.99 | 25.35 | 28.51 |  |
| 50 | 41.00 | 61.31 | 33.63 | 54.32 | 25.04 | 27.91 |  |
| 60 | 39.29 | 59.32 | 32.48 | 54.05 | 24.47 | 27.50 |  |
| 70 | 38.80 | 59.27 | 32.47 | 54.01 | 24.52 | 27.76 |  |
| 80 | 36.23 | 57.71 | 30.64 | 53.92 | 24.19 | 27.31 |  |
| 90 | 35.86 | 56.63 | 30.17 | 52.89 | 23.51 | 26.18 |  |
| 100 | 36.47 | 57.39 | 31.08 | 52.56 | 23.30 | 26.25 |  |

**Table 8: Performance comparison of Llama3-8B-Instruct with different numbers of masked random heads on factuality evaluation tasks.**
| Model | Masked Retrieval Heads | TruthfulQA (MC) | TriviaQA | PopQA | NQ-Open |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
| MC1 $\uparrow$ | MC2 $\uparrow$ | MC3 $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ |  |  |
| Llama3-8B-Instruct | Baseline | 39.41 | 55.69 | 30.31 | 56.58 | 21.10 | 29.04 |
| 10 | 38.84 ±0.71 | 55.79 ±0.53 | 30.38 ±0.46 | 56.17 ±0.03 | 25.96 ±0.18 | 29.27 ±0.10 |  |
| 20 | 38.51 ±0.35 | 56.09 ±2.21 | 30.34 ±0.86 | 55.75 ±0.33 | 25.63 ±0.25 | 28.89 ±0.46 |  |
| 30 | 37.58 ±1.12 | 56.47 ±2.30 | 30.21 ±1.01 | 54.84 ±0.58 | 25.52 ±0.16 | 28.03 ±0.20 |  |
| 40 | 37.37 ±0.57 | 57.00 ±1.94 | 30.24 ±0.51 | 54.14 ±0.65 | 25.24 ±0.15 | 27.51 ±0.61 |  |
| 50 | 37.17 ±1.56 | 56.70 ±2.36 | 29.85 ±1.58 | 53.17 ±1.22 | 25.07 ±0.22 | 26.61 ±1.14 |  |
| 60 | 35.86 ±1.41 | 55.37 ±0.82 | 28.87 ±0.80 | 52.43 ±1.77 | 24.54 ±0.54 | 26.26 ±1.14 |  |
| 70 | 34.68 ±0.31 | 53.87 ±1.16 | 27.63 ±0.66 | 51.79 ±1.59 | 24.50 ±0.58 | 25.70 ±1.07 |  |
| 80 | 33.05 ±2.36 | 53.12 ±2.02 | 26.56 ±2.03 | 48.11 ±5.82 | 24.52 ±1.01 | 24.36 ±1.83 |  |
| 90 | 30.80 ±2.20 | 49.78 ±2.91 | 24.79 ±1.56 | 47.39 ±5.68 | 24.14 ±0.98 | 24.05 ±2.03 |  |
| 100 | 30.07 ±0.90 | 49.78 ±1.74 | 24.44 ±0.76 | 47.04 ±5.17 | 24.05 ±0.76 | 23.96 ±1.84 |  |

Figure 6(b) shows the effect of masking retrieval heads (blue) and random heads (orange) on factual recall tasks across TruthfulQA, TriviaQA, PopQA, and NQ Closed.

In TruthfulQA, masking retrieval heads has a negligible effect on the MC2 score ($r_{ret}=-0.06$), while masking random heads shows a moderate negative correlation ($r_{random}=-0.80$).
This suggests that retrieval heads do not play a major role in answering truthful questions, and the decline in performance when masking random heads could be due to their broader influence on the model’s general predictive capabilities.

In contrast, for TriviaQA, PopQA, and NQ Closed, both masking retrieval heads and random heads result in significant performance drops, with strong negative correlations observed in all tasks.
The differences between masking the retrieval heads and random heads are not as stark as in faithfulness tasks.
For instance, in TriviaQA, masking retrieval heads leads to a performance decline ($r_{ret}=-0.98$), but masking random heads also has a similar effect ($r_{random}=-0.97$).
This similarity suggests that in factual recall tasks, retrieval heads may not be the only determining factor.

The overall observation from these tasks is that while masking retrieval heads does lower performance, it does not have as drastic an effect as observed in faithfulness hallucination tasks. The relatively similar progression of performance degradation between masking retrieval and random heads further reinforces the idea that factual recall tasks rely on a broader mechanism, even though the masking of retrieval heads does lead to a moderate drop in performance.

### D.4 Chain-of-Thought

**Table 9: Performance comparison of Llama3-8B-Instruct with different number of masked retrieval heads on MuSiQue, a multi-hop reasoning dataset, with and without CoT prompting in both closed-book and open-book settings.**
| Model | Masked Retrieval Heads | MuSiQue without CoT | MuSiQue with CoT |  |  |
| --- | --- | --- | --- | --- | --- |
| Closed Book | Open Book | Closed Book | Open Book |  |  |
| Llama3-8B-Instruct | Baseline | 7.41 | 58.83 | 14.61 | 69.84 |
| 10 | 6.99 | 51.47 | 14.56 | 59.87 |  |
| 20 | 6.91 | 49.52 | 15.06 | 57.92 |  |
| 30 | 6.74 | 46.96 | 12.16 | 50.48 |  |
| 40 | 6.33 | 47.41 | 11.54 | 48.70 |  |
| 50 | 6.29 | 46.67 | 13.24 | 47.37 |  |
| 60 | 6.33 | 46.01 | 10.72 | 41.79 |  |
| 70 | 6.41 | 46.46 | 11.38 | 43.65 |  |
| 80 | 6.41 | 44.81 | 8.98 | 32.19 |  |
| 90 | 5.54 | 41.25 | 7.24 | 27.06 |  |
| 100 | 5.63 | 38.85 | 7.32 | 23.34 |  |

**Table 10: Performance comparison of Llama3-8B-Instruct with different numbers of masked random heads on MuSiQue, a multi-hop reasoning dataset, with and without CoT prompting in both closed-book and open-book settings.**
| Model | Masked Random Heads | MuSiQue without CoT | MuSiQue with CoT |  |  |
| --- | --- | --- | --- | --- | --- |
| Closed Book | Open Book | Closed Book | Open Book |  |  |
| Llama3-8B-Instruct | Baseline | 7.41 | 58.83 | 14.61 | 69.84 |
| 10 | 7.09 ±0.24 | 59.25 ±0.53 | 14.63 ±0.35 | 69.70 ±1.81 |  |
| 20 | 7.17 ±0.10 | 58.67 ±0.68 | 14.44 ±0.68 | 67.94 ±0.81 |  |
| 30 | 6.90 ±0.19 | 57.23 ±1.32 | 14.09 ±1.30 | 67.19 ±2.42 |  |
| 40 | 6.61 ±0.02 | 55.83 ±2.82 | 13.57 ±1.09 | 64.27 ±4.28 |  |
| 50 | 6.08 ±0.41 | 55.65 ±3.12 | 12.84 ±1.10 | 64.87 ±2.34 |  |
| 60 | 5.76 ±0.77 | 54.64 ±3.36 | 12.49 ±1.06 | 63.65 ±2.38 |  |
| 70 | 5.43 ±0.80 | 53.28 ±3.66 | 11.20 ±1.34 | 61.40 ±3.96 |  |
| 80 | 5.27 ±0.77 | 52.19 ±2.95 | 10.22 ±0.49 | 55.98 ±3.28 |  |
| 90 | 5.46 ±0.72 | 49.25 ±4.41 | 8.14 ±1.92 | 46.59 ±8.97 |  |
| 100 | 5.25 ±0.46 | 48.34 ±5.71 | 7.43 ±2.04 | 44.79 ±9.19 |  |

The performance of the Llama3-8B-Instruct model with different numbers of masked retrieval heads on the MuSiQue dataset, both with and without Chain-of-Thought (CoT) prompting, is shown in Figure 6(c). The table compares the closed-book and open-book settings to assess the influence of CoT on model performance.
In the closed-book setting without CoT prompting, masking retrieval heads leads to a gradual performance decline, with scores decreasing from 7.41 (baseline) to 5.63 (with 100 masked heads).
This indicates that the model’s ability to reason through multiple hops is compromised as retrieval heads are removed.
The decline of performance in the open-book setting without CoT prompting further indicates the importance of retrieval heads in open-book QA tasks.

The inclusion of CoT prompts generally boosts performance in both closed-book and open-book settings.
Similar to the setup without CoT prompting, masking retrieval heads in the CoT setup decreases the performance gradually.
Interestingly, in the CoT + open-book setup, masking only the top 20 retrieval heads leads to a performance lower than without using CoT.
This suggests that retrieval heads are crucial for maintaining the model’s ability to chain reasoning steps across multiple hops, particularly when the reasoning steps have to be grounded in contextual knowledge.

## Appendix E Additional TruthfulQA Generation Evaluation

### E.1 Evaluation of Non-rejection Responses

**Table 11: TruthfulQA Generation Evaluation excluding the rejected instances. Notice the rate of rejection that is very high on the instruction-tuned Llama3-8b.**
| Model | %Reject $\downarrow$ | $\%\text{T}\cap\bar{\text{R}}\uparrow$ | $\%\text{I}\cap\bar{\text{R}}$ | $\%\text{T}\cap\text{I}\cap\bar{\text{R}}\uparrow$ |
| --- | --- | --- | --- | --- |
| Llama3-8b-Instruct | 43.94 | 65.50 | 94.54 | 60.04 |
| + ITI (Li et al., ) | 25.46 | 83.25 | 96.06 | 79.47 |
| + DoLA (low) (Chuang et al., ) | 45.04 | 64.81 | 94.65 | 59.69 |
| + DoLA (high) (Chuang et al., ) | 44.92 | 65.11 | 93.78 | 58.89 |
| + AD (Chen et al., ) | 43.82 | 65.14 | 94.55 | 59.69 |
| + DeCoRe static (Ours) | 41.74 | 67.02 | 95.38 | 62.39 |
| + DeCoRe entropy (Ours) | 38.68 | 65.87 | 95.61 | 61.48 |
| Llama3-70b-Instruct | 53.12 | 76.50 | 97.91 | 74.41 |
| + CD (Li et al., ) | 52.26 | 75.64 | 97.69 | 73.33 |
| + ITI (Li et al., ) | 37.94 | 71.79 | 98.82 | 70.81 |
| + DoLA (low) (Chuang et al., ) | 52.88 | 76.62 | 97.92 | 74.55 |
| + DoLA (high) (Chuang et al., ) | 54.71 | 76.22 | 97.30 | 73.51 |
| + AD (Chen et al., ) | 49.33 | 75.36 | 98.31 | 73.67 |
| + DeCoRe static (Ours) | 54.96 | 74.46 | 97.01 | 71.47 |
| + DeCoRe entropy (Ours) | 56.79 | 75.35 | 96.32 | 71.67 |
| + DeCoRe entropy-small amateur (Ours) | 52.02 | 75.77 | 97.70 | 73.47 |

As shown in Table 2, we can observe that the rejection rate of Llama3 models in the TruthfulQA task (i.e., the ratio of cases when the model answers with “I have no comment”) is relatively high, particularly when compared to Llama2 models (Touvron et al., ) reported by previous studies (Li et al., ; Chuang et al., ).
To get a better understanding of how the model performs, we also reported the evaluation metrics that are based only on non-rejection answers in Table 11.
This results can help us to roughly understand how the model would perform when it’s not rejecting to answer.
However, it is important to note that we cannot compare the performance of the decoding strategies to one another because the set of questions that are being answered are different depending on whether the decoding strategy choose to answer them or not.

### E.2 Evaluation Cost

The fine-tuning of two davinci-002 models (to measure truthfulness and informativeness) costs approximately $43. While each run of evaluation is approximately $0.8.

## Appendix F Correlation between Length-normalised Entropy and Correctness

### F.1 Rationale

One motivation to use the length-normalised entropy as a measure of how much information to contrast relies heavily on the premise that length-normalised entropy is a reliable proxy of answer correctness.
To verify this assumption, we conducted statistical tests (Student’s T-test (Student, ) and a Mann-Whitney U-test (Mann & Whitney, )) and to determine whether the length-normalised entropy of correct answers tends to be lower than that of incorrect answers.

Figure: (a) Density plot showing the distribution of length-normalised entropy for correct and incorrect answers across different models (DeCoRe, Baseline, and DoLa).
Refer to caption: x17.png

### F.2 Statistical Tests

The results of these statistical tests, as presented in Table F.2, show that the differences in entropy between correct and incorrect answers are statistically significant across all models, with low p-values for both tests.
The baseline model yields a T-test statistic of 11.75 and a p-value of $2.57\times 10^{-31}$, confirming that the entropy of correct answers is significantly lower. This trend holds for the DoLa and DeCoRe entropy models, with both tests indicating a strong separation between the entropy distributions of correct and incorrect answers.
The Mann-Whitney U-test results further corroborate this finding, providing consistent statistics and p-values below $10^{-24}$ for all models. These results validate the hypothesis that lower length-normalised entropy is a meaningful indicator of answer correctness, supporting its use in contrastive decoding through DeCoRe.

The accompanying Figure 7(a) illustrates the distribution of length-normalised entropy for correct and incorrect answers across models (DeCoRe, Baseline, and DoLa).
Correct answers (in blue) tend to have lower entropy, whereas incorrect answers (in orange) exhibit higher entropy.
This visualisation aligns with the statistical tests, highlighting the difference between correct and incorrect answers based on their entropy values.

Table: Table 12: Averaged Length-Normalised Predictive Entropy of the correct and incorrect answer by DeCoRe Entropy. All values are scaled by $10^{2}$. Lower values indicate less overall uncertainty. Generally, the length-normalised entropy of correct answers is lower than the incorrect ones, indicating the importance of the model’s certainty in generating a correct answer.

|  | MuSiQue (Closed) | MuSiQue (Open) |
| --- | --- | --- |
| Correct | 31.74 | 27.99 |
| Incorrect | 43.91 | 33.32 |

Table: Table 13: Results of the Student’s T-test and Mann-Whitney U-test comparing the length-normalised entropy of correct and incorrect answers across different models. The low p-values across all models confirm that correct answers generally have lower entropy compared to incorrect ones, validating the use of entropy as a proxy for answer correctness.

| Model | T-test | U-test |  |  |
| --- | --- | --- | --- | --- |
| Statistics | p-value | Statistics | p-value |  |
| Baseline | 11.75 | $2.57\times 10^{-31}$ | $4.31\times 10^{5}$ | $8.36\times 10^{-26}$ |
| DoLa | 12.52 | $3.51\times 10^{-35}$ | $4.28\times 10^{5}$ | $3.66\times 10^{-28}$ |
| DeCoRe entropy | 11.01 | $7.43\times 10^{-28}$ | $4.05\times 10^{5}$ | $3.43\times 10^{-24}$ |

### F.3 Regression

To further quantify the relationship between length-normalised entropy and answer correctness, we calculated the McFadden’s pseudo-$R^{2}$ (McFadden et al., ) for the logistic regression models fitted across the different setups (DeCoRe, Baseline, and DoLa).
As shown in the regression plots (Figure 7(b)), all three models demonstrate a high pseudo-$R^{2}$ value of 0.98, indicating a strong negative relationship between entropy and correctness.
This high pseudo-$R^{2}$ value suggests that the length-normalised entropy is highly predictive of answer correctness, further validating the use of entropy as a reliable proxy for contrasting model outputs.

## Appendix G Detailed Results of Masked Heads Ablation Study

### G.1 Effect of Random Head Masking on Task Performance of DeCoRe

Figure: (a) Faithfulness Evaluation Tasks
Refer to caption: x19.png

As shown in Figure 8, the performance of DeCoRe${}_{\text{entropy}}$ exhibits different patterns when masking random attention heads compared to the targeted masking of retrieval heads in Section 4.
A key observation is that the standard deviation is much larger across most tasks, indicating higher variability in performance when random heads are masked.
This variability indicates that DeCoRe${}_{\text{entropy}}$ cannot benefit only from masking any random attention heads.

In XSum, we still observe a positive correlation between the number of masked random heads and task performance, though the correlation ($r=0.89$) is weaker than that seen when masking retrieval heads.
This suggests that masking random heads can still improve contextual faithfulness in summarisation, though the impact is less pronounced especially when considering the highest possible performance achieved by masking random heads.

MemoTrap, which exhibits a strong positive correlation when masking retrieval heads, now shows a weak negative correlation ($r=-0.34$).
This shift implies that random masking does not improve the model’s instruction-following capabilities, and further suggests that the improvements seen were due to the targeted masking of retrieval heads.
This supports the idea that retrieval heads play a key role in tasks requiring the faithful execution of instructions.

Similar to the results of masking retrieval heads, random head masking exhibits a negative correlation on IFEval

Interestingly, Open Book NQ continues to show a strong negative correlation ($r=-0.82$), much like in the previous section.
This reinforces the idea that retrieval mechanisms when handling open-book QA tasks, where the model must balance contextual and parametric knowledge, differ from a simple induction mechanism.
In contrast, NQ-Swap and TruthfulQA show little to no correlation, indicating that masking random heads does not significantly impact performance on these tasks.

For factual recall tasks like TriviaQA, PopQA, and Closed Book NQ, the results are consistent with the previous section, showing strong negative correlations with increasing numbers of masked random heads.
As the performance trends of masking retrieval heads and random heads are similar, this may further support the hypothesis that factual recall is not predominantly handled by attention heads.
This finding aligns with previous studies (Geva et al., ; Meng et al., ), which suggest that factual recall is predominantly handled by the MLP layer within the Transformer model.

### G.2 Faithfulness

**Table 14: Ablation study of DeCoRe entropy on faithfulness hallucination tasks with varying numbers of masked retrieval heads.**
| Model | Masked Retrieval Heads | XSum | MemoTrap | IFEval | NQ-Open | NQ-Swap |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ROUGE-L $\uparrow$ | BERTScore-F1 $\uparrow$ | factKB $\uparrow$ | Macro Acc $\uparrow$ | Micro Acc $\uparrow$ | Prompt Acc $\uparrow$ | Instruct Acc $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ |  |  |
| Llama3-8B-Instruct | 0 (Baseline) | 19.90 | 67.23 | 47.61 | 65.86 | 64.40 | 70.24 | 78.30 | 69.68 | 60.62 |
| 10 | 19.45 | 67.08 | 57.50 | 68.81 | 66.60 | 68.39 | 76.38 | 70.66 | 66.08 |  |
| 20 | 19.61 | 67.18 | 57.53 | 69.39 | 68.37 | 67.10 | 75.54 | 70.24 | 65.55 |  |
| 30 | 19.62 | 67.48 | 59.75 | 70.14 | 70.50 | 62.11 | 72.30 | 70.17 | 65.15 |  |
| 40 | 19.70 | 67.42 | 60.65 | 70.46 | 71.09 | 62.29 | 72.42 | 69.83 | 64.96 |  |
| 50 | 19.37 | 67.15 | 62.88 | 71.27 | 71.68 | 61.92 | 72.06 | 69.94 | 64.75 |  |
| 60 | 19.40 | 67.18 | 64.27 | 71.59 | 71.76 | 58.60 | 69.54 | 69.57 | 64.41 |  |
| 70 | 19.51 | 67.30 | 61.32 | 71.90 | 71.80 | 56.93 | 68.94 | 68.51 | 61.53 |  |
| 80 | 19.40 | 67.57 | 64.67 | 72.52 | 72.75 | 59.15 | 70.14 | 68.55 | 62.75 |  |
| 90 | 19.45 | 67.69 | 66.10 | 74.14 | 74.87 | 59.89 | 70.74 | 68.66 | 62.64 |  |
| 100 | 19.37 | 67.59 | 64.78 | 73.53 | 73.97 | 60.81 | 70.98 | 69.57 | 63.93 |  |
| Llama3-70B-Instruct | 0 (Baseline) | 22.41 | 69.77 | 61.32 | 68.47 | 66.52 | 77.45 | 84.41 | 71.07 | 76.11 |
| 10 | 22.17 | 69.64 | 62.41 | 69.17 | 67.51 | 76.34 | 83.57 | 71.75 | 78.36 |  |
| 20 | 22.35 | 69.75 | 60.72 | 68.58 | 66.64 | 77.45 | 84.29 | 71.83 | 77.86 |  |
| 30 | 22.03 | 69.51 | 63.91 | 70.28 | 69.52 | 78.56 | 84.89 | 72.35 | 79.10 |  |
| 40 | 21.98 | 69.48 | 64.67 | 71.93 | 72.19 | 77.45 | 83.81 | 72.32 | 78.91 |  |
| 50 | 21.93 | 69.47 | 65.13 | 73.75 | 73.41 | 77.63 | 84.41 | 72.54 | 79.14 |  |
| 60 | 21.84 | 69.44 | 63.94 | 72.66 | 72.19 | 78.19 | 84.89 | 72.24 | 77.79 |  |
| 70 | 22.03 | 69.55 | 62.96 | 71.97 | 71.96 | 76.52 | 83.69 | 72.43 | 77.62 |  |
| 80 | 21.95 | 69.44 | 64.62 | 72.81 | 72.47 | 77.08 | 84.05 | 72.66 | 79.73 |  |
| 90 | 21.93 | 69.40 | 65.49 | 74.07 | 73.65 | 77.26 | 83.81 | 72.39 | 79.73 |  |
| 100 | 21.82 | 69.38 | 65.30 | 73.88 | 73.97 | 77.08 | 83.81 | 72.47 | 79.79 |  |

**Table 15: Ablation study of DeCoRe entropy on faithfulness hallucination tasks with varying numbers of masked random heads.**
| Model | Masked Random Heads | XSum | MemoTrap | IFEval | NQ-Open | NQ-Swap |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ROUGE-L $\uparrow$ | BERTScore-F1 $\uparrow$ | factKB $\uparrow$ | Macro Acc $\uparrow$ | Micro Acc $\uparrow$ | Prompt Acc $\uparrow$ | Instruct Acc $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ |  |  |
| Llama3-8B-Instruct | 0 (Baseline) | 19.90 | 67.23 | 47.61 | 65.86 | 64.40 | 70.24 | 78.30 | 69.68 | 60.62 |
| 10 | 20.02 ±0.12 | 67.43 ±0.31 | 51.39 ±5.67 | 69.38 ±2.70 | 68.08 ±2.75 | 68.52 ±0.75 | 76.82 ±0.82 | 69.27 ±0.24 | 59.65 ±0.47 |  |
| 20 | 20.09 ±0.26 | 67.64 ±0.37 | 54.13 ±5.85 | 68.22 ±4.61 | 66.68 ±5.76 | 65.31 ±1.49 | 74.46 ±0.95 | 69.30 ±0.66 | 59.49 ±1.93 |  |
| 30 | 20.06 ±0.11 | 67.78 ±0.53 | 56.00 ±7.34 | 69.29 ±3.91 | 68.77 ±4.88 | 64.76 ±1.87 | 74.26 ±1.63 | 69.11 ±0.49 | 58.91 ±2.61 |  |
| 40 | 20.07 ±0.23 | 67.76 ±0.54 | 56.78 ±9.68 | 71.09 ±0.71 | 70.72 ±1.56 | 64.94 ±1.34 | 74.38 ±1.39 | 69.23 ±0.60 | 61.23 ±5.48 |  |
| 50 | 20.08 ±0.36 | 67.89 ±0.50 | 57.37 ±8.45 | 69.69 ±2.14 | 69.07 ±3.18 | 64.08 ±1.99 | 73.78 ±1.80 | 69.13 ±0.53 | 61.33 ±4.92 |  |
| 60 | 20.09 ±0.47 | 67.99 ±0.61 | 57.87 ±6.37 | 70.52 ±1.89 | 70.17 ±1.18 | 60.51 ±2.63 | 70.78 ±1.92 | 69.23 ±0.56 | 62.23 ±2.77 |  |
| 70 | 19.83 ±0.47 | 67.96 ±0.54 | 60.16 ±6.49 | 70.96 ±2.19 | 70.76 ±1.90 | 60.14 ±0.21 | 70.90 ±0.42 | 69.19 ±0.33 | 62.03 ±3.23 |  |
| 80 | 19.71 ±0.44 | 67.85 ±0.49 | 60.00 ±5.13 | 69.47 ±1.68 | 68.94 ±0.94 | 58.96 ±1.44 | 69.46 ±1.23 | 68.76 ±0.36 | 60.89 ±5.05 |  |
| 90 | 19.75 ±0.34 | 67.78 ±0.52 | 59.04 ±4.80 | 66.91 ±2.68 | 66.63 ±3.58 | 59.64 ±1.20 | 69.94 ±0.45 | 68.59 ±0.59 | 59.62 ±5.86 |  |
| 100 | 19.68 ±0.45 | 67.82 ±0.50 | 59.03 ±3.41 | 67.27 ±2.01 | 66.76 ±2.80 | 59.02 ±1.23 | 69.62 ±1.08 | 68.15 ±0.76 | 59.27 ±5.37 |  |

Table 14 accompanies Figure 3 (top) and Table 15 accompanies Figure 8 (top).

In the case of masking retrieval heads in DeCoRe entropy (Table 14), the results show different trends depending on the type of the task.
In summarisation (XSum) and instruction following (MemoTrap) tasks, we can observe an increase in performance the more retrieval heads are masked.
This indicates the importance of retrieval heads in these tasks, similar to the findings mentioned in Appendix D.2.

However, the results show a different trend in open-book QA tasks (Open Book NQ-Open and NQ-Swap).
In both Open Book NQ-Open and NQ-Swap, we can observe an increase in performance starting from masking 10 retrieval heads, and gradually goes down.
In the case of Open Book NQ-Open, the performance is above the baseline variant until it drops below it when we mask 60 retrieval heads.
While in the case of NQ-Swap, the performance remains above the baseline model even after we mask 100 retrieval heads.
Albeit the differing trend, these open-book QA results are still in line with the previous findings in Appendix D.2, where the top 10 retrieval heads plays the most important role in the open-book QA tasks, with decreasing importance thereafter.

In contrast, we can observe massive standard deviation in the results of masking random heads in DeCoRe entropy shown in Table 15.
This variance suggests that randomly masking heads leads to inconsistent effects across tasks, implying that not all attention heads contribute equally to model performance.
The less predictable effects of masking random heads further highlights the specialised role of retrieval heads in DeCoRe, particularly in maintaining task-specific faithfulness.

### G.3 Factuality

**Table 16: Ablation study of DeCoRe entropy on factuality hallucination tasks with varying numbers of masked retrieval heads.**
| Model | Masked Retrieval Heads | TruthfulQA (MC) | TriviaQA | PopQA | NQ-Open |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
| MC1 $\uparrow$ | MC2 $\uparrow$ | MC3 $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ |  |  |
| Llama3-8B-Instruct | Baseline | 39.41 | 55.69 | 30.31 | 56.58 | 26.64 | 29.04 |
| 10 | 37.45 | 53.76 | 28.48 | 56.40 | 26.88 | 28.96 |  |
| 20 | 36.96 | 54.46 | 28.95 | 56.18 | 26.74 | 28.55 |  |
| 30 | 37.58 | 53.76 | 29.38 | 55.14 | 26.28 | 27.42 |  |
| 40 | 36.23 | 53.62 | 29.34 | 54.73 | 25.97 | 27.91 |  |
| 50 | 37.70 | 54.66 | 29.82 | 53.99 | 25.55 | 27.27 |  |
| 60 | 37.21 | 54.50 | 30.21 | 53.72 | 25.39 | 27.01 |  |
| 70 | 36.96 | 55.05 | 30.35 | 52.84 | 24.99 | 26.44 |  |
| 80 | 38.43 | 55.86 | 30.95 | 52.19 | 24.76 | 26.44 |  |
| 90 | 37.70 | 55.32 | 30.30 | 52.29 | 24.85 | 26.70 |  |
| 100 | 36.60 | 54.10 | 29.61 | 52.21 | 25.09 | 26.55 |  |
| Llama3-70B-Instruct | Baseline | 49.57 | 70.60 | 37.85 | 74.77 | 40.63 | 40.08 |
| 10 | 49.94 | 70.66 | 38.11 | 74.75 | 40.58 | 40.30 |  |
| 20 | 50.31 | 70.93 | 38.35 | 74.67 | 40.46 | 40.23 |  |
| 30 | 50.43 | 71.76 | 39.65 | 74.57 | 40.51 | 40.11 |  |
| 40 | 50.80 | 71.54 | 39.33 | 74.58 | 40.49 | 40.08 |  |
| 50 | 52.14 | 72.17 | 40.36 | 74.72 | 40.44 | 40.15 |  |
| 60 | 52.88 | 72.45 | 41.64 | 74.51 | 40.30 | 40.26 |  |
| 70 | 53.98 | 73.44 | 42.55 | 74.61 | 40.38 | 40.45 |  |
| 80 | 53.61 | 72.98 | 41.79 | 74.65 | 40.49 | 40.30 |  |
| 90 | 52.88 | 72.61 | 41.71 | 74.60 | 40.58 | 40.38 |  |
| 100 | 54.10 | 72.96 | 42.86 | 74.64 | 40.49 | 40.45 |  |

**Table 17: Ablation study of DeCoRe entropy on factuality hallucination tasks with varying numbers of masked random heads.**
| Model | Masked Random Heads | TruthfulQA (MC) | TriviaQA | PopQA | NQ-Open |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
| MC1 $\uparrow$ | MC2 $\uparrow$ | MC3 $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ |  |  |
| Llama3-8B-Instruct | Baseline | 39.41 | 55.69 | 30.31 | 56.58 | 26.64 | 29.04 |
| 10 | 38.92 ±0.53 | 56.15 ±0.78 | 30.22 ±0.28 | 55.38 ±0.45 | 25.96 ±0.18 | 28.70 ±0.57 |  |
| 20 | 39.25 ±0.62 | 56.55 ±2.07 | 30.93 ±0.85 | 54.68 ±0.68 | 25.63 ±0.25 | 28.02 ±0.53 |  |
| 30 | 39.41 ±1.28 | 56.43 ±2.33 | 31.10 ±1.26 | 54.15 ±0.73 | 25.52 ±0.16 | 27.86 ±0.32 |  |
| 40 | 38.84 ±0.75 | 55.32 ±1.85 | 30.39 ±1.03 | 53.58 ±0.59 | 25.27 ±0.17 | 27.16 ±0.33 |  |
| 50 | 38.76 ±0.35 | 54.97 ±1.43 | 30.37 ±1.05 | 53.38 ±0.80 | 25.07 ±0.22 | 27.16 ±0.31 |  |
| 60 | 38.31 ±0.65 | 54.45 ±0.82 | 29.89 ±0.92 | 53.04 ±0.72 | 24.54 ±0.54 | 27.12 ±0.26 |  |
| 70 | 38.68 ±0.92 | 55.31 ±0.98 | 30.74 ±1.26 | 52.79 ±0.60 | 24.50 ±0.58 | 26.78 ±0.13 |  |
| 80 | 37.58 ±0.65 | 55.19 ±1.65 | 30.05 ±0.45 | 52.52 ±0.84 | 24.52 ±1.01 | 26.87 ±0.21 |  |
| 90 | 38.39 ±2.22 | 56.48 ±3.06 | 30.82 ±2.20 | 52.13 ±0.28 | 24.14 ±0.98 | 26.74 ±0.33 |  |
| 100 | 38.23 ±2.70 | 56.66 ±3.77 | 31.03 ±2.72 | 51.60 ±0.35 | 24.05 ±0.76 | 26.43 ±0.51 |  |

Table 16 accompanies Figure 3 (bottom) and Table 17 accompanies Figure 8 (bottom).

As shown in Table 16, the results in TruthfulQA shows less clear correlation compared to other factuality evaluation tasks.
For closed-book QA tasks like TriviaQA, PopQA, and Closed Book NQ-Open, a negative correlation is observed between the number of masked retrieval heads and performance.
Similar negative correlations are observed when random heads are masked as shown in Table 17.
The similarity in the performance degradation across both retrieval and random heads indicates that other model mechanisms might be responsible for factual recall.

### G.4 Chain of Thought

**Table 18: Performance comparison across different number of masked retrieval heads on MuSiQue, a multi-hop reasoning dataset, with and without CoT prompting in both closed-book and open-book settings.**
| Model | Masked Retrieval Heads | MuSiQue without CoT | MuSiQue with CoT |  |  |
| --- | --- | --- | --- | --- | --- |
| Closed Book | Open Book | Closed Book | Open Book |  |  |
| Llama3-8B-Instruct | Baseline | 7.41 | 58.83 | 14.61 | 69.84 |
| 10 | 7.61 | 61.98 | 13.90 | 74.47 |  |
| 20 | 7.70 | 61.81 | 13.82 | 72.20 |  |
| 30 | 7.70 | 61.44 | 13.61 | 71.70 |  |
| 40 | 7.03 | 61.32 | 13.03 | 72.16 |  |
| 50 | 7.12 | 61.32 | 12.78 | 71.62 |  |
| 60 | 6.50 | 60.36 | 13.03 | 72.11 |  |
| 70 | 6.21 | 59.21 | 12.83 | 71.66 |  |
| 80 | 5.75 | 58.05 | 12.29 | 71.74 |  |
| 90 | 6.04 | 59.54 | 12.49 | 70.87 |  |
| 100 | 6.45 | 59.78 | 11.96 | 71.00 |  |
| Llama3-70B-Instruct | Baseline | 11.79 | 68.56 | 20.15 | 74.43 |
| 10 | 11.75 | 69.22 | 20.60 | 74.76 |  |
| 20 | 11.67 | 69.05 | 20.02 | 74.56 |  |
| 30 | 11.50 | 68.97 | 20.31 | 74.43 |  |
| 40 | 11.63 | 69.05 | 20.23 | 74.22 |  |
| 50 | 11.34 | 69.38 | 20.02 | 73.60 |  |
| 60 | 11.34 | 68.68 | 19.69 | 73.85 |  |
| 70 | 11.34 | 69.38 | 19.40 | 74.06 |  |
| 80 | 11.25 | 69.67 | 19.28 | 74.18 |  |
| 90 | 11.38 | 69.51 | 19.53 | 74.47 |  |
| 100 | 11.25 | 69.84 | 19.69 | 74.93 |  |

**Table 19: Performance comparison across different numbers of masked random heads on MuSiQue, a multi-hop reasoning dataset, with and without CoT prompting in both closed-book and open-book settings.**
| Model | Masked Random Heads | MuSiQue without CoT | MuSiQue with CoT |  |  |
| --- | --- | --- | --- | --- | --- |
| Closed Book | Open Book | Closed Book | Open Book |  |  |
| Llama3-8B-Instruct | Baseline | 7.41 | 58.83 | 14.61 | 69.84 |
| 10 | 6.63 ±0.17 | 59.21 ±0.91 | 13.57 ±0.91 | 69.40 ±1.09 |  |
| 20 | 6.87 ±0.14 | 59.72 ±0.70 | 13.07 ±0.90 | 70.18 ±0.44 |  |
| 30 | 6.65 ±0.44 | 59.95 ±0.77 | 12.61 ±0.91 | 70.43 ±1.47 |  |
| 40 | 6.22 ±0.42 | 60.52 ±1.69 | 12.29 ±0.40 | 70.28 ±2.53 |  |
| 50 | 6.50 ±0.26 | 60.60 ±1.46 | 12.26 ±0.15 | 69.41 ±1.44 |  |
| 60 | 6.36 ±0.31 | 60.31 ±1.49 | 11.81 ±0.58 | 68.89 ±0.95 |  |
| 70 | 6.32 ±0.06 | 61.03 ±0.97 | 12.05 ±1.06 | 69.78 ±1.56 |  |
| 80 | 6.45 ±0.54 | 61.32 ±0.50 | 11.64 ±0.66 | 70.05 ±1.08 |  |
| 90 | 6.55 ±0.46 | 61.45 ±1.38 | 11.65 ±0.57 | 70.20 ±2.17 |  |
| 100 | 6.34 ±0.27 | 61.76 ±0.90 | 11.72 ±0.27 | 70.29 ±2.36 |  |

Table 18 accompanies Table 3 to show the performance of DeCoRe entropy when masking retrieval heads across different setups of MuSiQue, a multi-hop reasoning dataset, with and without CoT prompting, in both closed-book and open-book settings.

In the closed-book without CoT setup, we can observe a negative correlation between the number of masked retrieval heads and the performance.
As more retrieval heads are masked, the performance gradually declines from the baseline across the Llama3-8B-Instruct and Llama3-70B-Instruct models, aligned with the findings in Appendix G.3.

In the open-book without CoT setup, there is also a negative correlation, but interestingly, the overall performance remains higher than the baseline model, which is aligned with the findings in Appendix G.2.

Interestingly the results in the closed-book with CoT setup are quite different, as masking retrieval heads does not lead to improved performance.
From the results of masking retrieval heads in the baseline model (Table 9), we expect the model to perform better as DeCoRe will contrast the incorrect predictions.
This may suggest that the complexity of factual recall in closed-book setup remains the same even though the model is prompted to generate intermediate reasoning steps.

Finally, the open-book with CoT setup shows an increase in performance when masking retrieval heads, even though the correlation remains negative.
This is consistent with the broader trend observed in the open-book QA setup, where the model benefits from masking retrieval heads but only up to a point.
Even with the negative correlation, the performance still remains higher than the baseline, indicating the utility of retrieval heads in CoT-assisted open-book tasks.

As shown in Table 19, the trend observed when masking random heads is less apparent in comparison to when masking retrieval heads.
This indicates that random heads may not be as critical in these tasks.

## Appendix H Ablation with Other LLM Families

### H.1 Faithfulness

**Table 20: Performance comparison of other model families (i.e., Mistral-7B-Instruct-v0.3 and Qwen2-7B-Instruct) with different decoding strategies on faithfulness evaluation tasks. For each base model, the best performance is indicated in bold, and the second-best is underlined.**
| Model | XSum | MemoTrap | IFEval | NQ-Open | NQ-Swap |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ROUGE-L $\uparrow$ | BERTScore-F1 $\uparrow$ | factKB $\uparrow$ | Macro Acc $\uparrow$ | Micro Acc $\uparrow$ | Prompt Acc $\uparrow$ | Instruct Acc $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ |  |
| Mistral-7B-Instruct-v0.3 | 16.53 | 65.30 | 65.53 | 76.63 | 75.11 | 51.02 | 60.91 | 66.86 | 65.17 |
| + CAD (Shi et al., ) | 14.71 | 63.55 | 69.90 | - | - | - | - | 65.54 | 76.11 |
| + DoLA (low) (Chuang et al., ) | 16.45 | 65.24 | 65.51 | 76.33 | 74.75 | 49.54 | 60.19 | 67.01 | 65.32 |
| + DoLA (high) (Chuang et al., ) | 16.44 | 65.23 | 65.70 | 76.47 | 74.91 | 49.72 | 60.19 | 66.97 | 65.21 |
| + AD (Chen et al., ) | 16.58 | 65.36 | 65.25 | 76.80 | 75.35 | 51.76 | 62.35 | 66.70 | 63.99 |
| + DeCoRe static (Ours) | 15.57 | 64.20 | 71.75 | 77.01 | 76.49 | 51.94 | 62.47 | 68.02 | 68.08 |
| + DeCoRe entropy (Ours) | 15.15 | 63.80 | 70.73 | 77.54 | 76.96 | 51.20 | 61.27 | 68.48 | 68.61 |
| Qwen2-7B-Instruct | 20.00 | 67.70 | 68.66 | 82.13 | 80.54 | 52.31 | 62.35 | 68.81 | 72.90 |
| + CAD (Shi et al., ) | 17.06 | 65.08 | 71.98 | - | - | - | - | 69.30 | 78.05 |
| + DoLA (low) (Chuang et al., ) | 19.57 | 67.47 | 65.05 | 82.76 | 81.76 | 54.16 | 65.35 | 68.32 | 72.88 |
| + DoLA (high) (Chuang et al., ) | 18.69 | 66.60 | 55.71 | 56.61 | 55.89 | 47.32 | 59.59 | 65.76 | 70.48 |
| + AD (Chen et al., ) | 19.58 | 67.66 | 66.42 | 81.37 | 80.03 | 51.76 | 62.35 | 68.14 | 72.29 |
| + DeCoRe static (Ours) | 18.78 | 66.82 | 75.21 | 82.50 | 81.02 | 58.04 | 67.51 | 70.13 | 75.64 |
| + DeCoRe entropy (Ours) | 17.09 | 64.79 | 76.90 | 83.80 | 82.04 | 54.90 | 64.03 | 70.58 | 75.31 |

Table 20 shows the performance of other model families (i.e., Mistral-7B-Instruct-v0.3 and Qwen2-7B-Instruct) evaluated across faithfulness tasks with different decoding strategies.
The results indicate that DeCoRe static and DeCoRe entropy outperform baseline models and other decoding strategies (DoLA) in most cases, demonstrating the effectiveness of DeCoRe in enhancing faithfulness evaluation tasks.

For Mistral-7B-Instruct-v0.3, both DeCoRe static and DeCoRe entropy perform competitively.
Specifically, DeCoRe entropy achieves the highest scores on XSum’s factKB, MemoTrap’s Macro Acc, Open-Book NQ-Open, and NQ-Swap, showing the strongest ability to generate factually consistent summaries, follow instructions, and handle contextually faithful QA.
DeCoRe static also improves performance significantly, underlining its utility in faithfulness tasks, even without dynamic entropy adjustments.

For Qwen2-7B-Instruct, DeCoRe entropy also leads in most tasks.
It shows top performance on XSum’s factKB, MemoTrap and Open-Book NQ-Open, indicating that it excels in generating factually consistent summary, following instruction, and answering complex QA questions.
DeCoRe static marginally surpasses DeCoRe entropy in NQ-Swap EM, suggesting that in some cases, static contrastive decoding may be sufficient for maintaining contextual faithfulness.

Overall, the trend observed across both model families confirms that DeCoRe, whether in static or entropy-controlled mode, provides significant improvements in maintaining contextual faithfulness regardless of the base model family, outperforming traditional decoding strategies like DoLA across summarisation, instruction-following, and QA tasks.

### H.2 Factuality

**Table 21: Performance comparison of other model families (i.e., Mistral-7B-Instruct-v0.3 and Qwen2-7B-Instruct) with different decoding strategies on factuality evaluation tasks. For each base model, the best performance is indicated in bold, and the second-best is underlined.**
| Model | TruthfulQA (MC) | TriviaQA | PopQA | TruthfulQA (Generation) | NQ-Open |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| MC1 $\uparrow$ | MC2 $\uparrow$ | MC3 $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ | $\%\text{Truth}\uparrow$ | $\%\text{Info}\uparrow$ | $\%\text{T}\cap\text{I}\uparrow$ | $\%\text{Reject}\downarrow$ | EM $\uparrow$ |  |
| Mistral-7B-Instruct-v0.3 | 50.31 | 65.62 | 38.29 | 59.99 | 26.65 | 80.54 | 97.06 | 77.60 | 26.07 | 31.49 |
| + DoLA (low) (Chuang et al., ) | 50.18 | 65.64 | 38.17 | 60.06 | 26.68 | 80.29 | 97.31 | 77.60 | 25.70 | 31.53 |
| + DoLA (high) (Chuang et al., ) | 50.18 | 65.61 | 38.18 | 60.03 | 26.68 | 80.54 | 97.06 | 77.60 | 25.70 | 31.53 |
| + AD (Chen et al., ) | 43.82 | 64.44 | 35.67 | 59.92 | 26.66 | 80.29 | 97.18 | 77.48 | 25.70 | 30.55 |
| + DeCoRe static (Ours) | 53.49 | 67.13 | 39.48 | 60.09 | 27.02 | 77.85 | 97.43 | 75.40 | 20.81 | 31.38 |
| + DeCoRe entropy (Ours) | 54.84 | 69.08 | 41.82 | 59.64 | 27.11 | 76.99 | 97.80 | 74.79 | 15.91 | 31.45 |
| Qwen2-7B-Instruct | 29.99 | 48.08 | 24.22 | 42.77 | 17.55 | 80.78 | 67.93 | 48.71 | 37.33 | 25.91 |
| + DoLA (low) (Chuang et al., ) | 30.11 | 49.11 | 25.09 | 40.57 | 15.85 | 84.58 | 65.36 | 50.06 | 41.74 | 23.84 |
| + DoLA (high) (Chuang et al., ) | 20.44 | 47.09 | 22.76 | 37.82 | 13.84 | 83.97 | 61.57 | 45.53 | 45.17 | 21.36 |
| + AD (Chen et al., ) | 30.85 | 49.71 | 25.33 | 42.13 | 18.19 | 78.09 | 79.68 | 57.83 | 26.31 | 24.41 |
| + DeCoRe static (Ours) | 31.09 | 48.23 | 25.20 | 42.50 | 17.71 | 79.31 | 69.28 | 48.59 | 37.33 | 26.06 |
| + DeCoRe entropy (Ours) | 34.52 | 51.79 | 27.30 | 41.30 | 17.15 | 76.87 | 76.74 | 53.61 | 26.81 | 25.05 |

Table 21 compares the performance of Mistral-7B-Instruct-v0.3 and Qwen2-7B-Instruct on factuality evaluation tasks using different decoding strategies.
For Mistral-7B-Instruct-v0.3, DeCoRe entropy delivers the best performance across multiple metrics, multiple choice metrics, the informativeness and rejection score on TruthfulQA, EM on TriviaQA and PopQA.
DeCoRe static also performs well, particularly in improving the EM scores for PopQA and TriviaQA, showing its utility in handling factual recall tasks effectively.

Qwen2-7B-Instruct shows a similar pattern. DeCoRe entropy outperforms both the baseline model and DoLA in multiple choice and generation metrics on TruthfulQA.
This highlights its superior capability in distinguishing truthful answers and minimising rejected outputs.

Overall, the trend across both model families confirms that DeCoRe, particularly DeCoRe entropy, significantly enhances the model’s performance beyond just contextual faithfulnes.

### H.3 Chain of Thought

**Table 22: Performance comparison of other model families (i.e., Mistral-7B-Instruct-v0.3 and Qwen2-7B-Instruct) with different decoding strategies on MuSiQue, a multi-hop reasoning task. For each base model, the best performance is indicated in bold, and the second-best is underlined.**
| Model | MuSiQue without CoT | MuSiQue with CoT |  |  |
| --- | --- | --- | --- | --- |
| Closed Book | Open Book | Closed Book | Open Book |  |
| Mistral-7B-Instruct-v0.3 | 7.61 | 58.01 | 11.17 | 59.70 |
| + CAD (Shi et al., ) | - | 50.10 | - | 63.55 |
| + DoLA (low) | 7.53 | 58.21 | 10.92 | 59.79 |
| + AD (Chen et al., ) | 7.53 | 59.00 | 11.34 | 61.69 |
| + DeCoRe static | 7.86 | 59.33 | 12.04 | 63.92 |
| + DeCoRe entropy | 7.57 | 62.72 | 11.21 | 65.12 |
| Qwen2-7B-Instruct | 6.54 | 63.01 | 8.23 | 60.57 |
| + CAD (Shi et al., ) | - | 64.58 | - | 66.41 |
| + DoLA (low) | 7.03 | 65.45 | 7.70 | 64.54 |
| + AD (Chen et al., ) | 5.71 | 65.29 | 8.44 | 65.70 |
| + DeCoRe static | 6.70 | 63.34 | 8.36 | 66.78 |
| + DeCoRe entropy | 6.16 | 66.49 | 8.23 | 67.98 |

Table 22 presents the performance of Mistral-7B-Instruct-v0.3 and Qwen2-7B-Instruct on the MuSiQue multi-hop reasoning task across different decoding strategies.
The most notable performance improvement for both models is observed in the open-book setup, particularly when coupled with CoT prompting which is also aligned with the results.

Without CoT, the open-book setup already shows strong performance, with DeCoRe entropy outperforming both DoLA and the baseline model. However, when CoT prompting is incorporated, the performance boost becomes even more apparent.
This confirms that DeCoRe further amplifies the effectiveness of CoT prompting across model families.

## Appendix I Ablation of DeCoRe static static {}_{\text{static}} start_FLOATSUBSCRIPT static end_FLOATSUBSCRIPT

Figure: (a) Faithfulness Evaluation Tasks
Refer to caption: x22.png

DeCoRe${}_{\text{static}}$ uses a hyperparameter $\alpha$ to control how much we want to contrast the prediction of the masked model from the base model, as shown in Equation 7.
We examine the various values of $\alpha$ and shows the results in Figure 9 across the faithfulness, factuality, and CoT reasoning evaluation tasks.

### I.1 Faithfulness

**Table 23: Performance of Llama3-8b-Instruct with DeCoRe${}_{\text{static}}$ on faithfulness evaluation tasks. For each base model, the best performance is indicated in bold, and the second-best is underlined.**
| $\alpha$ | XSum | MemoTrap | IFEval | NQ-Open | NQ-Swap |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ROUGE-L $\uparrow$ | BERTScore-F1 $\uparrow$ | factKB $\uparrow$ | Macro Acc $\uparrow$ | Micro Acc $\uparrow$ | Instruct Acc $\uparrow$ | Prompt Acc $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ |  |
| -0.5 | 20.16 | 66.42 | 28.17 | 63.52 | 60.65 | 76.98 | 68.58 | 68.17 | 55.75 |
| 0.0 | 19.90 | 67.23 | 47.61 | 65.86 | 64.40 | 70.24 | 78.30 | 69.68 | 60.62 |
| 0.5 | 19.87 | 67.83 | 64.07 | 69.53 | 69.20 | 69.13 | 78.06 | 70.62 | 64.43 |
| 1.0 | 19.41 | 67.83 | 67.46 | 69.71 | 70.22 | 73.74 | 63.59 | 70.73 | 64.88 |
| 2.0 | 18.38 | 67.19 | 64.02 | 71.28 | 71.84 | 70.74 | 59.70 | 69.64 | 63.02 |
| 4.0 | 16.65 | 65.26 | 52.61 | 70.77 | 71.09 | 51.56 | 37.52 | 62.86 | 54.83 |
| 8.0 | 13.05 | 55.65 | 31.34 | 70.68 | 70.97 | 35.01 | 20.70 | 43.24 | 39.97 |

As shown in Figure 9(a) and Table 23, for XSum, increasing $\alpha$ leads the highest factKB score up until $\alpha=1.0$.
MemoTrap tasks show a steady improvement in both Macro and Micro Accuracy as $\alpha$ increases, peaking at $\alpha=2.0$.
However, for IFEval, higher values of $\alpha$ lead to a drop in Instruct and Prompt Accuracy.
Similarly, for the Open book NQ-Open and NQ-Swap tasks, performance decreases for extreme values of $\alpha$.

### I.2 Factuality

**Table 24: Performance of Llama3-8b-Instruct with DeCoRe${}_{\text{static}}$ on factuality evaluation tasks. For each base model, the best performance is indicated in bold, and the second-best is underlined.**
| $\alpha$ | TruthfulQA (MC) | TriviaQA | PopQA | NQ-Open |  |  |
| --- | --- | --- | --- | --- | --- | --- |
| MC1 $\uparrow$ | MC2 $\uparrow$ | MC3 $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ | EM $\uparrow$ |  |
| -0.5 | 38.31 | 57.05 | 31.48 | 56.00 | 26.09 | 28.93 |
| 0.0 | 39.41 | 55.69 | 30.31 | 56.58 | 26.64 | 29.04 |
| 0.5 | 38.68 | 55.74 | 29.80 | 56.93 | 26.86 | 29.42 |
| 1.0 | 38.07 | 55.86 | 29.81 | 56.78 | 26.87 | 28.93 |
| 2.0 | 36.84 | 56.13 | 30.08 | 56.47 | 26.60 | 28.59 |
| 4.0 | 37.45 | 57.62 | 31.43 | 53.92 | 24.55 | 28.14 |
| 8.0 | 37.70 | 58.37 | 31.82 | 43.67 | 18.66 | 23.47 |

Figure 9(b) and Table 24 show that, for TruthfulQA, the MC2 score improves slightly at higher $\alpha$ values, with the best performance for MC2 at $\alpha=8.0$.
TriviaQA shows stable EM performance for lower $\alpha$, but it significantly drops when $\alpha$ increases beyond 4.0.
For PopQA and Closed-Book NQ-Open, performance declines as $\alpha$ increases, with the best scores occurring at lower $\alpha$.

### I.3 Chain of Thought

**Table 25: Performance of Llama3-8b-Instruct with DeCoRe${}_{\text{static}}$ on MuSiQue, a multi-hop reasoning dataset, with and without CoT prompting in both closed-book and open-book settings. For each base model, the best performance is indicated in bold, and the second-best is underlined.**
| $\alpha$ | MuSiQue without CoT | MuSiQue with CoT |  |  |
| --- | --- | --- | --- | --- |
| Closed Book $\uparrow$ | Open Book $\uparrow$ | Closed Book $\uparrow$ | Open Book $\uparrow$ |  |
| -0.5 | 6.95 | 55.94 | 14.56 | 66.32 |
| 0.0 | 11.79 | 68.56 | 20.15 | 74.43 |
| 0.5 | 11.79 | 69.76 | 20.60 | 75.05 |
| 1.0 | 8.27 | 62.27 | 14.19 | 72.07 |
| 2.0 | 7.12 | 60.57 | 11.67 | 70.09 |
| 4.0 | 4.18 | 52.92 | 7.36 | 58.46 |
| 8.0 | 2.52 | 33.88 | 5.01 | 31.36 |

As shown in Figure 9(c) and Table 25, the performance of Llama3-8b-Instruct on MuSiQue varies with the choice of $\alpha$ in both closed-book and open-book settings, with and without CoT prompting.
Without CoT, performance peaks at $\alpha=0.5$ in both settings, but rapidly declines for higher values of $\alpha$.
When CoT prompting is applied, accuracy improves across all settings, with the best results also observed at $\alpha=0.5$.
However, as $\alpha$ increases beyond 1.0, performance deteriorates sharply, particularly at extreme values such as $\alpha=4.0$ and $\alpha=8.0$.

Overall, these patterns show that some tasks may benefit from a high $\alpha$ value, while the others may require it to be more constrained, indicating that it is necessary to have a dynamic $\alpha$ value throughout the generation.

## Appendix J Implementation Details

### J.1 Hardware and Library

We run all the experiments with NVIDIA A100 80GB GPUs. Specifically, we use 1 GPU instance for LLMs with 7B and 8B parameters, and 2 GPUs for 70B parameters LLM.
We use the Huggingface Transformers libraries (Wolf et al., ) and custom LLM model python classes from Wu et al. () which contains the snippet to mask the attention heads.
Our code is available at [https://anonymous.4open.science/r/decore-4FB7](https://anonymous.4open.science/r/decore-4FB7).

### J.2 Baseline Implementation

We obtained the fine-tuned weights of ITI models of Llama3-8B-Instruct and Llama3-70B-Instruct from [https://huggingface.co/jujipotle/honest_llama3_8B_instruct](https://huggingface.co/jujipotle/honest_llama3_8B_instruct) and [https://huggingface.co/jujipotle/honest_llama3_70B_instruct](https://huggingface.co/jujipotle/honest_llama3_70B_instruct), respectively.
As the ITI modifications are already incorporated into the weights, we use them similarly to the baseline model with greedy decoding.
For DoLa generation, we use the Huggingface official implementation via the .generate(...) function. While for the multiple choice tasks which compare the generated probability distribution, we use the implementation provided by the official code repository ([https://github.com/voidism/DoLa](https://github.com/voidism/DoLa)).
We followed the original implementation of the Contrastive Decoding algorithm ([https://github.com/XiangLi1999/ContrastiveDecoding](https://github.com/XiangLi1999/ContrastiveDecoding)).
We followed the original implementation of the Activation Decoding algorithm ([https://github.com/hkust-nlp/Activation_Decoding](https://github.com/hkust-nlp/Activation_Decoding)).
We followed the original implementation of the Context Aware Decoding algorithm ([https://github.com/xhan77/context-aware-decoding](https://github.com/xhan77/context-aware-decoding)).

### J.3 Additional Experimental Setting Details

Table 26 outlines the additional experimental settings for each task, including the evaluation metrics, number of shots (In-Context Learning demonstrations), and corresponding prompt templates.
The prompt templates use double curly braces to denote input data placeholders.
In each task, we use the same set of examples across all inputs to maintain an equal setup.
We adopted examples from prior work and conducted a qualitative inspection (Gao et al., ; Chuang et al., ; Hong et al., ; Liu et al., ).
Specifically for the MuSiQue tasks, we noticed that three examples were not suitable for the intended tasks, as they did not adequately demonstrate multi-hop reasoning (see Table 27).

**Table 26: Additional experimental setting details for the tasks, including the number of shots and the prompt templates. The double curly braces “{{}}” signify input data.**
| Task | Metric | # of shots | Prompt Template |
| --- | --- | --- | --- |
| Faithfulness Hallucination |  |  |  |
| XSum | ROUGE-L<br>BERTScore<br>factKB | 0 | Generate a summary comprising of 1 sentence for the given article.\n\n<br>Article: ” + {{document}}\n\nSummary: |
| MemoTrap | Macro Accuracy<br>Micro Accuracy | 0 | {{question}} |
| IFEval | Instruction-level Strict Accuracy<br>Prompt-level Strict Accuracy | 0 | {{question}} |
| Open Book NQ-Open | EM | 1 | Write a high-quality answer for the given question using only the provided search results<br>(some of which might be irrelevant). Provide the answer in 5 words or less without any<br>explanation.\n\n<br>{{in-context learning demonstrations}}\n\n<br>Document [{{document_index}}] {{document}}\n<br>Question: {{question}}\n<br>Answer: |
| NQ-Swap | EM | 4 | Answer the following question based on the provided context:\n\n<br>{{in-context learning demonstrations}}\n\n<br>Context: {{context}}\n<br>Question: {{question}}\n<br>Answer: |
| Factuality Hallucination |  |  |  |
| Closed-Book NQ-Open | EM | 8 | Write a high-quality answer for the given question. Provide the answer in 5 words or less<br>without any explanation.\n\n<br>{{in-context learning demonstrations}}\n\n<br>Question: {{question}}\n<br>Answer: |
| TriviaQA | EM | 8 | Answer the given question.\n\n<br>{{in-context learning demonstrations}}\n\n<br>Question: {{question}}\n<br>Answer: |
| PopQA | EM | 8 | Answer the given question.\n\n<br>{{in-context learning demonstrations}}\n\n<br>Question: {{question}}\n<br>Answer: |
| TruthfulQA | MC1<br>MC2<br>MC3<br>GPT-Judge<br>GPT-Info | 6 | Interpret each question literally, and as a question about the real world;<br>carefully research each answer, without falling prey to any common myths;<br>and reply “I have no comment” unless you are completely certain of the answer.\n\n<br>{{in-context learning demonstrations}}\n\n<br>Q: {{question}}\n<br>A: |
| Reasoning |  |  |  |
| MuSiQue Direct | EM | 17 | Answer the following question.\n\n<br>{{in-context learning demonstrations}}\n\n<br>Q: {{question}}\n<br>Answer: |
| MuSiQue CoT | EM | 17 | Answer the following question by reasoning step-by-step.\n\n<br>{{in-context learning demonstrations}}\n\n<br>Q: {{question}}\n<br>Answer: |

**Table 27: Erroneous In-Context Learning Demonstrations of MuSiQue**
| Question | Answer | Reason of Removal |
| --- | --- | --- |
| What genre is the record label of the performer of So Long, See You Tomorrow associated with? | The performer of So Long, See You Tomorrow is Bombay Bicycle Club. The record label of Bombay Bicycle Club is Island Records. The genre of Island Records is jazz. So the answer is: jazz. | A record label does not have only one specific genre, as confirmed by a Wikipedia search of Island Records. |
| What is the genre of the record label of the band that performed on the Crush Tour? | The Crush Tour is performed by the band Bon Jovi. The record label of Bon Jovi is Island Records. The genre of Island Records is jazz. So the answer is: jazz. | A record label does not have only one specific genre, as confirmed by a Wikipedia search of Island Records. |
| Where is the crying stone found in the country in which Raphael Tuju holds citizenship? | Raphael Tuju is a citizen of Kenya. The crying stone in Kenya is found along the highway towards Kisumu. So the answer is: along the highway towards Kisumu. | The second passage already contains the answer as standalone evidence. It does not highlight the multi-hop reasoning. |

## Appendix K Long Generation Results

### K.1 Averaged Length-Normalised Conditional Entropy

**Table 28: Averaged Length-Normalised Conditional Entropy which signifies the averaged overall uncertainty of generated sequences per model. Lower values indicate less overall uncertainty. Bold indicates the lowest value.**
| Model | XSum | MuSiQue with CoT |  |
| --- | --- | --- | --- |
| Closed | Open |  |  |
| Llama3-8b-Instruct | 0.41 ±0.12 | 0.30 ±0.10 | 0.43 ±0.20 |
| + ITI | 0.65 ±0.21 | 0.46 ±0.18 | 0.72 ±0.28 |
| + DoLa | 0.41 ±0.12 | 0.30 ±0.10 | 0.43 ±0.20 |
| + DeCoRe entropy | 0.38 ±0.11 | 0.29 ±0.10 | 0.41 ±0.20 |

Table 28 accompanies Figure 4. Refer to Section 4 for the explanation.

### K.2 Qualitative Examples

#### XSum

Figure 10 presents a qualitative comparison between the baseline decoding and DeCoRe entropy generations in the XSum task.
Both decodings are generally accurate, but there are notable differences in the information included.
The entropy spikes when the model generates important or factual details such as the netting around the seal and the location.
While the baseline focuses on reporting the basic details of the event, DeCoRe adds additional, contextually relevant information, such as the reference to avoiding serious injury and infection.
This extra detail aligns with the facts presented in the original document (e.g., ”[…] the net would have eventually cut through his skin which could have resulted in septicaemia or other infections […]”).

Figure: Figure 10: Qualitative comparison of Baseline decoding vs DeCoRe Entropy generations in the XSum task, along with the entropy over time. Amber background indicates the entropy (darker shades indicate higher entropy). Notice that the entropy spikes nearing the important fact such as the details about the amount of netting and the location of the incident. Both generations are equally accurate, but DeCoRe occasionally includes additional, relevant details. For example, it mentions the rescue preventing serious injury and infection, which is consistent with the source document (i.e., “[…] the net would eventually have cut through his skin which could have resulted in septicaemia or other infections […]”).

#### TruthfulQA

Figure 11 compares the baseline decoding with DeCoRe entropy generations in the TruthfulQA task.
The amber background highlights the entropy value, with darker shades indicating higher uncertainty.
In this example, the baseline model declines to answer the question, providing an uninformative response: “I have no comment.”
In contrast, DeCoRe generates a much more detailed and accurate answer, correctly refuting the link between the MMR vaccine and autism while also mentioning the discrediting of Wakefield’s research.
The entropy spikes are observed near key facts, such as “autism” and “measles” and the follow-up that “subsequent investigations” discredited the study.

Figure: Figure 11: Qualitative comparison of Baseline decoding vs DeCoRe Entropy generations in the TruthfulQA task, along with the entropy over time. Amber background indicates the entropy (darker shades indicate higher entropy). Notice that the entropy spikes nearing the beginning of important facts such as the diagnoses (i.e., autism and measles) and the fact that the paper was discredited by subsequent studies. As noted in Table 2, DeCoRe is more likely to not reject answering the question compared to the baseline models.

#### MuSiQue

Figure 12 compares the baseline decoding with DeCoRe entropy generations in the MuSiQue task.
Amber shading indicates the entropy level, with darker shades indicating higher uncertainty.
Since MuSiQue is a question answering task, we can indicate the correct and incorrect answer by using green and red backgrounds, respectively.
Both decoding strategies show similar entropy spikes when generating the names “Gilroy” and “Robert,” suggesting uncertainty.
DeCoRe, however, correctly selects “Robert Ludlum,” the author of the original novel, while the baseline model incorrectly selects “Gilroy,” the screenplay writer.
This shows DeCoRe’s improved accuracy in selecting the right answer, particularly in cases where multiple plausible names are involved.

Figure: Figure 12: Qualitative comparison of the Baseline decoding vs DeCoRe Entropy generations in the MuSiQue task, along with the entropy over time. Amber background indicates the entropy (darker shades indicate higher entropy), while green and red background indicates the right and wrong answers, respectively. Entropy generally follow the same pattern for the similar generation. Notice that both models are more uncertain when generating “Gil” or “Robert”, which are the final answers. “Robert Ludlum” is the correct answer, while “Gilroy” was mentioned in the passage as the writer of the screen story, but not the original novel.

## Peer Reviews

confidence: 3
contribution: 2
initial_rating: 5
presentation: 3
questions: See weaknesses
soundness: 3
strengths: 1.	The paper is well-written.
2.	The research includes thorough experiments that effectively demonstrate the capability of DeCoRe in mitigating hallucinations across various tasks.
3.	The proposed method, DeCoRe, is training-free and useful for hallucination mitigation.
summary: The paper addresses the issue of hallucinations in Large Language Models (LLMs), where outputs may be unfaithful or factually incorrect. It identifies specific attention heads, called retrieval heads, within the Transformer architecture that are crucial for extracting relevant information. The authors hypothesize that masking these heads can induce hallucinations. To tackle this, they propose a novel decoding strategy named Decoding by Contrasting Retrieval Heads (DeCoRe), which does not require additional training. DeCoRe works by comparing outputs from the base LLM and a masked version to reduce hallucinations, guided by conditional entropy. Experiments show that DeCoRe significantly enhances performance in tasks demanding high contextual accuracy, such as summarization, instruction following, and open-book question answering, with notable improvements in various benchmarks.
weaknesses: 1.	The paper only provides evaluations on the effectiveness of mitigating hallucination. However, as a decoding method, it is also important to show the generated texts are coherent and fluent. Therefore, it is required to provide evidence to show this decoding method can generate text with high quality with low hallucination.
2.	It seems that in the experiments, many baselines can achieve better results than DeCoRe.
3.	The paper seems a combination of the existing findings, which applies the retrieval heads (Wu et al., 2024) to the Contrastive Decoding (Li et al., 2023) method, potentially limiting the originality of the contribution.

---

confidence: 4
contribution: 3
initial_rating: 5
presentation: 3
questions: n/a
soundness: 3
strengths: 1. The paper is clearly structured, making complex ideas accessible and easy to follow.

2. The paper introduces a novel decoding approach that contrasts outputs from the original and masked LLM, effectively reducing ungrounded content.

3. The paper  incorporates an entropy-controlled mechanism, allowing the method to adjust the level of contrast applied depending on the model’s uncertainty.
summary: This paper introduces a training-free decoding approach named DeCoRe for reducing hallucinations in LLMs. By identifying specific retrieval heads that influence the generation of grounded content, DeCoRe employs a masking strategy to induce hallucinations, then applies contrastive decoding to distinguish accurate from hallucinatory outputs. Experiments show improvements in contextual faithfulness on datasets like XSum and factual accuracy on tasks such as TriviaQA.
weaknesses: 1. The model's performance improvements are inconsistent across different datasets, and it fails to outperform baseline models in many settings (e.g., XSum, IFEval). This is inconsistent with the summary conclusions presented in the abstract.

2. The paper only compares a limited number of baselines, primarily focusing on contrastive methods, without evaluating against many related models.

3. The approach in this paper appears to be related to self-consistency and should better include a discussion on this topic, along with relevant baseline comparisons.

---

confidence: 4
contribution: 3
initial_rating: 5
presentation: 3
questions: Please see weaknesses, I am willing to reconsider my score.

Regarding CAD and MemoTrap, maybe I am missing something, but perhaps it’s possible to use the task as the additional context, e.g., for the task - “Write a quote that ends in the word "talk": Don't bark if you can't”, the additional context can be “Write a quote that ends in the word "talk".

Again, maybe I am missing something, but lines 330-331 state that DeCoRe has ‘competitive performance’ on NQ-Swap, but CAD outperforms DeCoRe by 8+ points. What gains do you consider substantial in the context of the experiments and the datasets in the paper?
soundness: 2
strengths: - The methodology of contrasting between a variant where retrieval heads are masked is interesting and has benefits over previous methods, for example in applicability.
- The experimental setting is thorough, comparing against six strong baselines on three tasks (reading comprehension, summarization, and instruction-following) with multiple datasets, including XSum, MemoTrap, IFEval NQ, PopQA, and TruthfulQA.
- The advancements on MemoTrap in comparison to the baselines are significant.
- The paper is overall well-written and easy to follow.
summary: The paper introduces DeCoRe, a decoding strategy for reducing hallucinations in LLMs. DeCoRe works by contrasting between a LLM (that can be augmented with additional context), and the same LLM where the attention heads that are responsible for extracting information from the context (i.e., retrieval heads) are masked, assuming masking these heads induces hallucinations and thus contrasting between the two distributions increase factuality. The weight given to each distribution can be controlled by a hyperparameter that estimates the model’s uncertainty using the entropy of the model. Experimental results show that DeCoRe significantly improves contextual faithfulness on multiple tasks including summarization and open-domain QA.
weaknesses: - It seems that in several experiments, the improvements from DeCoRe are either marginal or it even performs significantly worse than other methods. For example, as presented in Tab.1 CAD significantly outperforms DeCoRe on NQ-Swap whilst performing similarly on other benchmarks (within a one point margin). While I agree with the paper that DeCoRe has higher applicability I am not entirely sure that CAD cannot be used for MemoTrap (see questions).

- The paper also claims that DeCoRe can increase factuality (Tab.2) and multi-hop reasoning with CoT (Tab.3) but from looking at these tables, in most cases that DeCoRe is best-performing it is within a one-point margin to the second-best performing model (as stated in the paper, there are also cases where the baselines perform better). Additionally, in all experiments three DeCoRe variants are compared against the baselines, which can be a bit misleading. I believe the paper might benefit from an aggregated score for each method and error bars or statistical tests for the main claims. This can simplify understanding the significance of the main results.

- I believe the paper might benefit from a qualitative analysis that supports the main claims. For example, when is using conditional entropy beneficial and when does it hurt performance, and when does DeCoRe outperform the baselines?

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: Is there any difference in terms of generations from the proposed method vs others, e.g., fluency, length?

What is the smaller LM used for DeCoRe lite? 

What is the alpha value for DeCoRe static? How that is determined?

What is the computational cost for all compared methods, e.g., tflops?
soundness: 3
strengths: The paper is easy-to-follow with necessary background.

Given the wide range of LM applications, developing efficient and reliable hallucination mitigation methods is a very important research direction. 

The proposed method is a nice extension of contrastive decoding with recent attention head function insights.

The experiment design are mostly reasonable with several recent baselines to validate the effectiveness of the proposed method
summary: The paper proposes a new variant of contrastive decoding for reducing hallucinations in language models (LMs). At high level, contrastive decoding uses the difference between two LMs’ likelihood as the final decoding criteria. Typically, there is a baseLLM that generates a basic sequence of tokens which might contain hallucinations. To reduce the amount of hallucination, the probabilities of each generated token is then offset by the corresponding token probabilities from another weaker or corrupted LM which might contain more hallucinations. By using the offset to calibrate the sequence likelihood, the resulting decoding can potentially avoid undesirable failures from the second LM.

In this paper, the authors focus on building the corrupted LM leveraging the so-called retrieval attention heads found by recent work. Specifically, by masking those retrieval attention heads, the resulting corrupted LM is more likely to ignore context information, leading to more faithfulness issues (hallucinations).

Thus, the hypothesis is that using the token probability difference between the base LM and the corrupted LM can lead to better grounded responses.

Experiments are conducted on several representative datasets across different open source LMs (Llama 3 8B & 70B in main text), including long-form (summarization) and short-form (question answering) generation tasks.
Overall, the proposed method is found to be effective in making LMs more sensitive to provided context while not interfering with the LM’s parametric knowledge.
weaknesses: Although it is good to build upon recent attention head insights for contrastive decoding, the generalizability of those identified retrieval attention seems very limited. 

The improvement over baselines is at odds and not pronounced enough. For example, the proposed method does not provide consistent improvements over the base LM and CAD on fluency and coherence (lower ROUGE-L and BERTScore-F1). It is good to analyze the response difference to drive deeper understanding, e.g., does the proposed method lead to shorter and more concise generation? Typically, shorter answers are preferred by question answering datasets, e.g., NQ, TriviaQA.

As reported by the authors in Fig 3, masking more heads is not necessarily helpful. It is good to explore alternative attention selection strategies, e.g., randomly masking, selecting heads based on the required task solving capabilities (profiling using question answering datasets), or layer-based selection (e.g., balanced masking out across different layers).
That said, it might be interesting to see whether certain attention heads are more related to shorter vs longer context retrieval. 

There are some further improvements can be done for the experiment part:
Most of the datasets studied are of shorter input context. It is good to explore some datasets with longer context (e.g., retrieving more passages) and compare the method there. In addition to longer context, it is also good to explore more involving contexts, e.g., contextual conflicts [1].

It is good to report the robustness of those chosen hyperparameters. For example, can the proposed method benefit from different sampling temperatures and varying number of heads to be masked. As in-context examples are used for certain tasks, it is good to study the robustness of that decision, e..g, different set of shot and less or more examples.

[1] Wang et al., Resolving Knowledge Conflicts in Large Language Models

Meta-review: The paper introduces a variant of contrastive decoding to mitigate hallucinations in language models. The proposed DeCoRe identifies specific retrieval heads that influence the generation of grounded content and uses a masking strategy to induce hallucinations. It then applies contrastive decoding to differentiate accurate outputs from hallucinatory ones. Experiments demonstrate improved contextual faithfulness on datasets like XSum and enhanced factual accuracy on tasks such as TriviaQA.

Pros:
1. The paper is clearly structured, making complex ideas accessible and easy to follow.
2. Experimental results demonstrate the capability of DeCoRe in mitigating hallucinations across various tasks.

Cons:
1. Limited Novelty. The paper seems a combination of the existing findings, which applies the retrieval heads (Wu et al., 2024) to the Contrastive Decoding (Li et al., 2023) method, potentially limiting the originality of the contribution.
2. Effectiveness. The improvement over baselines is at odds and not pronounced enough. It seems that in the experiments, many baselines can achieve better results than DeCoRe. The model's performance improvements are inconsistent across different datasets.
3. Insufficient evaluation. The paper only provides evaluations on the effectiveness of mitigating hallucination. However, as a decoding method, it is also important to show the generated texts are coherent and fluent. Therefore, it is required to provide evidence to show this decoding method can generate text with high quality with low hallucination.

While the reviewers agree this paper is fairly well written and easy to follow, there are several major drawbacks that are not fully addressed. Therefore, I believe this paper needs another round of major revision before it can be published.

Decision: Reject