Decoding by Contrasting Knowledge: Enhancing Large Language Model Confidence on Edited Facts
Paper · 2025 · Baolong Bi, Shenghua Liu, Lingrui Mei et al.
Summary
A factual update can change what a language system is likely to say without changing the answer it actually gives. An instruction that supplies a replacement fact may push the new answer close to the top of the predictions, while the old answer remains just ahead. Baolong Bi and colleagues study this failure of in-context editing, which supplies a fact in the prompt and leaves the system’s learned parameters intact. By examining the scores and vocabulary ranks of the tokens that begin competing answers, they show how the same intervention can make the replacement much more likely and still leave the original answer in front. The paper calls these failures stubborn knowledge. Its analysis concerns large language models.
The authors propose Decoding by Contrasting Knowledge, or DeCK, to change how the answer is generated. At each step, the same system predicts what comes next with the edit in its context and with the question alone. DeCK strengthens the scores of tokens related to the edit, sets aside candidates that remain implausible in the edited context, and then discounts the remaining candidates according to how strongly the question alone predicts them. Both contexts receive the same generated token before the next comparison. The decoder can therefore look for the influence of the edit while holding the answer written so far fixed.
On MQuAKE-HARD, with the relevant edit available directly, Llama3-8B-Instruct goes from 14.3% accuracy with IKE, an in-context editing baseline, to 45.7% with IKE and DeCK. The authors report a relative gain of 219%. With the full collection of edits available for retrieval, adding DeCK improves MeLLo in every reported comparison. The corresponding IKE results are mixed. The paper also finds that a stronger contrast can reduce accuracy and that the extra prediction stream brings generation latency to roughly 1.6X that of ordinary decoding. The evidence is strongest for a specific use: helping a supplied edit influence the answers to questions that depend on it.
Deep dive: Decoding by Contrasting Knowledge: Enhancing Large Language Model Confidence on Edited Facts
Decoding by Contrasting Knowledge helps language systems follow edited facts by comparing predictions with and without the update. · about 33 minutes to read
The problem and its context
Updating a fact and following its consequences
The paper starts from a maintenance problem. A system can continue to answer queries after facts in the world have changed. Its learned parameters still reflect the information available during training, so a plausible answer can carry an obsolete association. Repeating training from scratch would be an expensive way to address individual changes. The paper places knowledge editing between retraining and leaving the association as it was. An edit specifies a particular fact to introduce or replace and asks whether the system behaves in accordance with that change.
A fact in the paper’s formulation has a subject, a relation and an answer. The subject might be a country, the relation an office and the answer the person who holds it. An edit can explicitly replace the officeholder. An indirect question can then ask for the officeholder’s spouse. To answer under the edit, the system has to use the replacement officeholder in the first part of the reasoning and retrieve the spouse associated with that person in the next. An answer that repeats the newly supplied name in response to a direct question has passed a narrower test. The indirect question checks whether that name can also serve as the starting point for another inference.
The distinction matters because the edit and the final answer can contain different names. A method could be good at getting the supplied name into the text and still perform poorly when a different name is required at the end. A reasoning procedure can also reach the right relation and follow it from the wrong person. This is the kind of dependency that the paper’s main benchmark is designed to test. Its questions probe the consequences of editing facts, a form of multi-hop question answering.
The benchmark uses counterfactual replacements. It asks the system to accept a stated change for the purposes of the question and carry through its implications. This setup makes it possible to create a conflict between what the system would typically say and what it should say under the new premise. In that setting, accuracy measures adherence to the specified edit and successful use of the relevant relations. The connection to factual maintenance comes from this controlled conflict: an update can only change an answer if the system is able to depart from the association that guided it before.
Where earlier editing methods intervene
The paper distinguishes methods that change the system internally from methods that change what it reads at answer time. Internal editing can modify or add parameters, or use an auxiliary network alongside the original system. The paper uses ROME as its representative internal editing baseline. ROME addresses factual associations through an intervention in the trained system. In-context editing supplies the replacement in the input, so the underlying parameters can stay fixed. The paper situates these approaches within earlier work on locating and editing factual associations and memory-based editing.
In-context editing makes the contents of the prompt a central part of the task. An editor can supply the fact itself, demonstrations of how to use such facts, or relevant entries retrieved from a collection of edits. IKE uses contextual examples to demonstrate editing. MeLLo handles questions that require several steps by breaking them into subquestions and consulting the edit collection when it checks for contradictions. The paper also describes earlier efforts to improve retrieval, check for conflicts and guide reasoning. Each addresses a practical difficulty in bringing the appropriate knowledge to bear when a question arrives. Earlier work on editing after deployment also explored memory-assisted prompt editing.
DeCK addresses a difficulty that can remain after the relevant fact has reached the prompt. The replacement is available and can influence the scores, yet another answer can still be more likely. This separates the question of which information an editor supplies from the question of how strongly that information governs what gets written. Better retrieval can help with the first. The authors ask how decoding can help with the second. Their experiments accordingly include a setting that reduces the retrieval burden, as well as a setting that retains the complete edit collection.
This problem is related to hallucination and misinformation through the user’s need for accurate answers. The paper’s account of earlier work mentions efforts during training, such as curating data or grounding the system in knowledge. It also describes efforts at inference, including estimating confidence, retrieving information and editing facts. DeCK falls on the inference side, where a system’s predictions can be changed while it answers. The paper’s motivation draws on earlier discussions of hallucination and misinformation.
What the contrast compares
The paper also draws on decoding methods that compare predictions from different sources. The earlier Contrastive Decoding approach it describes uses a stronger system and a weaker one to guide fluent, coherent generation. DoLa compares predictions associated with earlier and later layers of a system to improve factual outputs. The related-work discussion mentions another approach that uses a system exposed to induced hallucinations as a point of comparison. In each case, the comparison is meant to reveal something that the leading prediction alone does not capture. DeCK takes its contrastive scoring and plausibility filtering from the line of work represented by Contrastive Decoding and DoLa.
For the editing problem, the natural comparison is between predictions that have access to the replacement fact and predictions that lack it. Both predictions come from the same trained system. The question stays the same, and during generation so does the answer prefix. A candidate that already looked highly likely from the question alone receives a different treatment from a candidate whose support comes mainly from the edited context. That comparison turns the presence of the edit into a source of evidence for choosing what to write next.
The baseline distribution comes with an important qualification. The paper calls it parametric because the question alone elicits associations available to the trained system, in the absence of explicit editing content. It is still a prediction conditioned on a question and, after generation starts, on a partial answer. It does not enumerate stored facts or identify the parameter responsible for an answer. Its value to the method is operational. It supplies a baseline against which the edited prediction can be weighed at the point of selection.
The method, step by step
Follow the competing answers before changing the decoder
The analysis starts with the ordinary prediction of a next token. A token is the unit the system chooses from its vocabulary at each generation step. A name or a word can span multiple tokens. The paper tracks the first token of an expected answer as a way to compare how strongly the system favors that answer at the first point where it could begin. This gives the authors a common observation point for the original association and the replacement.
Before converting its scores into probabilities, the system produces a numerical score for every vocabulary item. These scores are called logits. Higher logits give a candidate a higher rank, and the softmax transformation converts the whole set of scores into probabilities that sum to a common total. For a comparison at a single position, an increase in one token’s logit matters through its relationship to the scores of the other candidates. In the case of an edit, the central question is whether the replacement moves ahead of the candidates that it needs to beat.
The first inspection uses a question without the edit and a version with the edit. The authors record the score and rank of the answer’s initial token in each setting. In their aggregate analysis, the replacement’s scores rise after introducing the edit, and more replacements move into the highest ranks. Scores associated with the original answer often move much less or fall. The overall pattern suggests that the new prompt frequently succeeds by increasing support for the edited answer. It can do this even while the original association remains a strong competitor.
The authors inspect failures in which that rise falls short. In a Llama2-7B-Chat example shown in the paper, the edited response should begin with English and the original response with French. After the update, the old answer’s logit still leads by 0.516. The gap describes a particular competition at the beginning of an answer. It illustrates why a large shift in favor of the editing instruction can be invisible if the only recorded outcome is whether the final answer is correct. English and French serve as the competing responses in that example.
The proposed decoder addresses the case in which the new candidate is already credible, or can be made credible by strengthening its connection to the edit. The method first prepares two contexts. One includes the question and the editing guidance supplied by the in-context procedure. The other begins with the question alone. It then scores both contexts, enhances the edited scores, compares the predictions and writes the chosen token into both streams. The replacement fact stays available through the edited stream for the next iteration.
How DeCK generates an answer under an edit
The steps in order.
Write the two next-token predictions
The background equation gives the next-token probability in terms of the output scores and a temperature. It can be written as follows.
P(xₜ | x₍<t₎) = exp(hₜᵀ Wₓₜ / τ) / Σⱼ∈V exp(hₜᵀ Wⱼ / τ)
Here P is a conditional probability, xₜ is the candidate token at position t, and x₍<t₎ is the sequence of tokens preceding that position. The bar in the argument of P means that the probability is conditioned on that sequence. The hidden representation used for prediction is hₜ, and ᵀ denotes its transpose so that multiplying it by a vocabulary vector gives a scalar. Wₓₜ is the output vector for the candidate token. Wⱼ is the corresponding vector for a token indexed by j, and V is the full vocabulary. τ is the temperature that controls the sharpness of the probabilities. exp exponentiates each scaled score, and Σⱼ∈V adds the exponentiated scores over the vocabulary to obtain the normalizing denominator.
This equation explains why the decoder can intervene without changing the answer prompt itself. The prompt determines the representation that supplies the scores. A decoding procedure can then process those scores before making a selection. After selection, the generated token becomes part of the context for the next step. In the ordinary generation procedure described by the paper, this continues until the system produces an end-of-sequence token.
The paper formalizes the desired change in behavior independently of how a method achieves it.
zₑ = (xₑ, rₑ, yₑ)
zₑ is the edit descriptor. Its subscript e denotes the edit. The descriptor consists of a subject xₑ, a relation rₑ and the replacement answer yₑ. The parentheses group these elements as an ordered tuple.
fₑ(xₑ, rₑ) = yₑ, f_base(xₑ, rₑ) ≠ yₑ
fₑ represents the behavior after editing, and f_base represents the original behavior. The subject xₑ and relation rₑ describe the association being queried. The first equality requires the edited system to return yₑ. The inequality says that the original system did not already return the replacement for that association. In the multi-hop case the same commitment has to carry over to questions that depend on that association. The equation specifies the direct change, while the benchmark probes consequences downstream of it.
For clarity, the following notation uses v for a candidate that can be scored in either context. This makes explicit which vocabulary item is compared even when the positions in the two streams differ.
Pᴱ(v | xᴱ₍<m₎) = [softmax(ϕ(hᴱₘ))]ᵥ
Pᴱ is the distribution under editing guidance, and the superscript E denotes the edited stream. v is a vocabulary item and m is the prediction position in that stream. xᴱ₍<m₎ is its preceding token sequence, including the editing prompt. hᴱₘ is the hidden representation used for this prediction. ϕ is the output projection written in the paper’s simplified form, and softmax normalizes the vector of token scores. Square brackets with subscript v select the probability of that particular vocabulary item. The conditioning bar again marks the context for the prediction.
The parallel prediction, written in the same notation, is as follows.
Pᴮ(v | xᴮ₍<n₎) = [softmax(ϕ(hᴮₙ))]ᵥ
Pᴮ denotes the baseline distribution, with B marking the question-only stream. xᴮ₍<n₎ begins without editing content, and n is its current prediction position. hᴮₙ is the hidden representation for that position. The same projection ϕ and normalization softmax give a vocabulary distribution, and [ ]ᵥ again selects the probability for v. The conditioning bar has the same meaning as before. The added edit can make the edited prefix longer, so m and n refer to corresponding prediction steps rather than identical absolute positions.
Strengthen the signal before filtering candidates
The enhancement stage gives tokens related to the edit an additional route into consideration. The authors define a relevance score using similarity between token embeddings and a weight based on the edited descriptor. An embedding here is a vector representation of a token. The score looks for the best match to a member of the edited knowledge and then weights that match for the candidate under consideration. This is the use of word embeddings in the enhancement stage.
s(vᵢ, E) = maxₑⱼ∈E [sim(vᵢ, eⱼ) · ϕ(vᵢ)]
s is the relevance function, vᵢ is the vocabulary token at index i, and E represents the edited knowledge. An element of the edited knowledge is eⱼ, with j identifying that element. sim measures similarity between the embeddings for the candidate and that element. The paper gives cosine similarity as an example. ϕ(vᵢ) is a frequency-based weight for the candidate, and · denotes multiplication. maxₑⱼ∈E takes the maximum over the elements of the edit. The paper reuses ϕ here for the frequency weighting, distinct from the output projection written with the same letter above.
ϕ(vᵢ) = log(freq(vᵢ) + ϵ) · α
Here ϕ(vᵢ) is the weight assigned to token vᵢ. freq gives that token’s frequency in the edited descriptor, ϵ is a small positive constant added to avoid taking the logarithm of zero, log is the logarithm, and α scales the weight. The product sign · applies that scaling. The frequency in this formula concerns the descriptor for the current edit.
The next operation combines the original edited logits with the relevance scores. The vector of relevance scores has an entry for every vocabulary item, so each score can be combined with the logit for the corresponding candidate. The formula below uses ℓᴱ to make the input to the enhancement explicit.
ℓ̃ᴱ = Enh(ℓᴱ, s) = α · ℓᴱ + β · s
ℓᴱ is the vector of original logits from the edited stream, and ℓ̃ᴱ is the enhanced vector. Enh is the enhancement function. The argument s now denotes the vector formed by evaluating the relevance function over the vocabulary. α controls the contribution of the original logits and β controls the contribution of relevance. The paper also uses the letter α in the frequency function. Each · scales an entire vector, and + adds the corresponding entries. The superscript E indicates that the enhancement is applied to the edited prediction.
The method description first introduces enhancement using shorthand for a probability distribution and then defines the actual addition on logits. Expressing the conversion back to probabilities makes the distinction clear.
Pᴱ_Enh(v) = [softmax(ℓ̃ᴱ)]ᵥ
Pᴱ_Enh is the edited distribution after enhancement, v identifies the candidate, and ℓ̃ᴱ denotes the enhanced output scores. softmax converts those scores to probabilities. [ ]ᵥ selects the entry for v. The edited prefix is implicit in this equation and in the later contrast, so all the probabilities refer to the current generation step.
The paper motivates enhancement using a target distribution that gives more weight to tokens belonging to the edit. Its rule for assigning mass is the following.
Q(vᵢ) = { 1/m if vᵢ ∈ E
{ ϵ otherwise
Q is the target, vᵢ is vocabulary token i, and E is the edited knowledge. ∈ means membership. 1/m is the mass assigned to a member of the edit, with m serving as the denominator of the assignment to edit members. This use of m is local to the target and differs from the prediction-position index above. ϵ denotes a small positive mass for vocabulary entries outside the edit. The two cases express the authors’ intention to favor edit members while giving the rest some mass. With m interpreted as the number of edit members, the first case already accounts for the entire probability mass, so the positive mass in the other case would need normalization to produce a distribution. The displayed rule leaves that normalization implicit.
The appendix gives a divergence to compare the enhanced prediction with the target. It introduces their average first.
M = (P̃ + Q) / 2
M is the average distribution, P̃ is the enhanced prediction and Q is the target. The plus sign adds probabilities for corresponding tokens, and division by 2 gives the arithmetic mean.
KED(P̃ ∥ Q) = (1/2) Σᵢ₌₁ⁿ wᵢ [P̃(vᵢ) log(P̃(vᵢ)/M(vᵢ)) + Q(vᵢ) log(Q(vᵢ)/M(vᵢ))]
KED stands for Knowledge Enhancement Divergence. ∥ separates the distributions being compared. Σᵢ₌₁ⁿ adds tokenwise contributions across n vocabulary entries, starting at index 1. Here n counts the vocabulary entries and differs from the baseline prediction position. wᵢ is the weight of token vᵢ, which the appendix identifies with its semantic relevance score. P̃(vᵢ), Q(vᵢ) and M(vᵢ) are the probabilities for that token under the enhanced prediction, target and average respectively. Each logarithm compares a probability with the corresponding probability in the average. The plus sign combines the contributions from prediction and target, and 1/2 averages their contributions. The main description assumes that the weights are non-negative and sum to 1. It does not specify a transformation that would enforce those conditions when the weights are taken directly from the relevance function.
The role of this objective in the exposition is to explain why the authors want the edited distribution to assign greater probability to related vocabulary items. The executable step described in the method is the additive adjustment to the logits. The experimental setup gives no separate training stage for a new prediction network or a per-token optimization routine for the divergence. Thus the more direct description of generation is to compute the relevance adjustment and use the resulting edited probabilities in the contrast.
Filter, contrast and advance the same answer
The filter makes the enhancement stage consequential. If a candidate has very small probability in both streams, subtracting its log probability from the baseline stream could give it a spuriously strong contrastive score. DeCK permits a token to compete only if the enhanced edited prediction already assigns it enough probability relative to the current leader.
V_head = { v ∈ V : Pᴱ_Enh(v) ≥ λ · max_w∈V Pᴱ_Enh(w) }
V_head is the set of candidates that survive the filter, v is a candidate, and V is the full vocabulary. The colon in the set expression means “such that.” Pᴱ_Enh(v) is the candidate’s enhanced edited probability. max_w∈V finds the largest such probability over vocabulary items w. The coefficient λ gives the required fraction of that largest probability, and ≥ includes candidates whose probabilities equal or exceed the cutoff. The paper calls this an adaptive plausibility constraint because the cutoff is relative to the present prediction. The experiments set λ to 0.01.
Enhancement and filtering happen in that order. If the edit would otherwise have left its answer just outside the candidate set, the relevance adjustment can move it inside. The filter then allows the contrast to distinguish between candidates with reasonable edited probabilities. A candidate that remains outside the set is removed from contention for that position regardless of how weakly the baseline predicts it.
F(v) = { log Pᴱ_Enh(v) − γ · log Pᴮ(v) if v ∈ V_head
{ −∞ otherwise
F(v) is the contrastive score for token v. Pᴱ_Enh(v) is its probability under the enhanced edit, and Pᴮ(v) is its probability under the question-only stream with the current answer prefix. log is the logarithm. γ controls how much the baseline probability influences the contrast, and · multiplies the baseline log probability by that coefficient. V_head is the candidate set from the filter, and ∈ tests membership. −∞ represents a score whose softmax probability is zero. The main experimental setting uses γ equal to 0.2.
The subtraction works through relative scores. With the edited probability held fixed, a candidate that was less likely under the baseline receives a larger boost than a candidate with a high baseline probability. Its final standing still depends on its enhanced edited probability and on the other candidates. The two conditions in the formula therefore play different roles. The filter asks whether the edited context gives a token enough support to be plausible. Within the resulting set, the score rewards tokens whose candidacy depends more strongly on the edited context.
P̂ᴱ_Enh(v) = [softmax(F)]ᵥ
P̂ᴱ_Enh is the final next-token distribution for the edited answer. F represents the vector of contrastive scores over the vocabulary, including the scores of negative infinity for excluded entries. softmax normalizes those scores over the surviving candidates, and [ ]ᵥ selects the resulting probability of token v. The hat distinguishes the final prediction from Pᴱ_Enh, which is the prediction before the contrast.
After choosing a token from the final prediction, DeCK appends it to both sequences. Suppose the edited generation has just begun a reasoning step that refers to the replacement. At the next position, the question-only stream sees the same generated beginning of that step, even though it never received the editing instruction. This makes the baseline conditional on the exact text now being continued. If the baseline were allowed to generate its own answer, it could already be discussing something different by the next position. Comparing those scores would combine the effect of the edit with the effect of following different answer prefixes.
This is an inference procedure for a frozen system. In the experiments, IKE supplies demonstrations for multi-hop questions and uses prompts that elicit intermediate reasoning. For MeLLo, the decoder is used where the editor generates answers during its reasoning procedure. The contrast consumes the factual guidance supplied by the editor in each case. The authors also make their implementation available under the name DeCK. The prompting setup draws on chain-of-thought prompting.
Experiments and results
What was evaluated
The experiments use MQuAKE-3K and its derivatives MQuAKE-2002 and MQuAKE-HARD. All test questions that depend on edited knowledge. Their purpose is to check whether a stated replacement changes the answers that follow from it. The authors also construct STUBBORN subsets from MQuAKE-3K. These focus on edits for which ordinary in-context editing repeatedly fails across different questions about the same underlying change.
The main comparison uses Llama2-7B-Chat, Llama2-13B-Chat, Llama3-8B-Instruct and Mistral-7B-Instruct. It includes ROME as an internal editor, IKE as a prompt-based editor, and IKE with DeCK as the same editing approach with the contrastive decoder added. The full-memory comparison uses the Llama2 chat systems and includes MeLLo both with and without DeCK. ROME is run using the EasyEdit framework.
The main task metric is answer accuracy, reported in percent. The paper also uses token-level diagnostics, such as the rank and probability of the beginning of the edited answer. Accuracy describes the result on the question. Rank describes the number of vocabulary candidates ahead of a token in the next-token prediction. Probability describes the share of the prediction distribution assigned to that token. The diagnostics give context to the outcome metric because a method can raise the rank or probability of the desired token even on questions it still answers incorrectly.
The authors run the main benchmark under two ways of making edits available. In the direct-edit setting, they evaluate multi-hop questions containing 1,000 instances and set the edit-memory batch size to 1. Here the batch size describes how many instances supply edited facts for retrieval. This setting is meant to examine the ability to use the relevant change directly. The full-memory setting keeps the complete edit collection available and evaluates editing with retrieval. A method in the second setting has to make use of a larger pool of facts and examples, so its score reflects more than the strength of its decoder.
The paper’s run of IKE uses multi-hop question-answering demonstrations and prompts that encourage intermediate reasoning. This matters for interpreting the decoder comparison. The baseline already has a procedure for eliciting reasoning and supplying edit guidance. The question is what changes when the predictions used to generate that reasoning and its answers are combined differently. The stronger comparison for this purpose is IKE against IKE with DeCK under the same memory setting. ROME provides a comparison with a different style of editing.
Direct editing with the relevant fact available
Across the direct-edit results, IKE with DeCK has the highest accuracy reported for each system and dataset combination. On MQuAKE-3K, Llama2-7B-Chat reaches 85.4% with IKE and 91.3% with IKE and DeCK. With the same system on MQuAKE-2002, IKE reaches 85.1% and the addition of DeCK gives 89.4%. On MQuAKE-HARD, the corresponding accuracies are 88.9% and 98.6%. The pattern spans the benchmark variants, including the setting in which IKE was already particularly effective.
For Llama2-13B-Chat, the IKE accuracy on MQuAKE-3K is 63.8%, and the decoder brings it to 84.6%. On MQuAKE-2002, IKE achieves 64.1%, while IKE with DeCK reaches 84.4%. The change on MQuAKE-HARD is from 55.2% to 89.7%, reported by the authors as a 63% relative improvement. This system starts from lower ordinary IKE scores than the other Llama2 chat system, and the comparison shows that the decoder can help even when prompt-based editing is substantially less reliable at the outset. It is a comparison across particular trained systems, instead of an experiment in which only parameter count varies.
With Llama3-8B-Instruct, IKE achieves 31.6% on MQuAKE-3K and 32.5% on MQuAKE-2002. The corresponding scores with DeCK are 54.7% and 55.9%. Its MQuAKE-HARD result supplies the largest relative gain highlighted by the paper. The ROME result in that setting gives a second point of reference for reading the gain.
Llama3-8B-Instruct direct editing accuracy on MQuAKE-HARD
Adding DeCK gives IKE the highest accuracy in this comparison.
The numbers
| System or setting | accuracy % |
|---|---|
| ROME | 12.7 |
| IKE | 14.3 |
| IKE with DeCK (this paper) | 45.7 |
The reported 219% relative gain describes the change from the IKE result on MQuAKE-HARD. The absolute accuracy shown in the chart puts that gain in context. This is a substantial improvement from a low starting point, and the resulting accuracy remains well below the direct-edit accuracies of the Llama2 chat systems on that dataset. Both facts matter to a reader comparing different systems. A large proportional gain measures how far a method moved from its own baseline, while the final accuracy describes how often it succeeded under the task conditions.
For Mistral-7B-Instruct, IKE with DeCK reaches 46.7% on MQuAKE-3K, compared with 34.1% for IKE. Its MQuAKE-2002 score is 48.5%, compared with 35.6%. MQuAKE-HARD shows a more modest change, from 15.6% to 19.2%. ROME reaches 26.3% in that particular setting, which is higher than both IKE scores. As a consequence, the paper’s broad pattern of stronger IKE with DeCK needs this exception when comparing the enhanced editor with all baselines. The IKE-to-DeCK improvement holds in the direct-edit comparison, while the ranking of internal and prompt-based editing varies with the system and benchmark.
The authors report average direct-edit scores of 86% for IKE with Llama2-7B-Chat and 61% for IKE with Llama2-13B-Chat. They suggest that the larger system may have more strongly entrenched associations. They also suggest that differences in pretraining and instruction tuning may help explain the weaker IKE results from Llama3-8B-Instruct. These are interpretations of the performance pattern. The direct-edit data identify systems on which the prompt is less effective and the decoder can help. They do not supply an intervention that separates those explanations.
The full edit memory
The full-memory experiment asks a different practical question: how much does the same decoding intervention help when an editor must operate with the entire collection of edits available? The paired results for IKE are mostly improvements, with a consistent exception on MQuAKE-2002. On Llama2-7B-Chat, full-memory IKE goes from 20.7% to 22.4% on MQuAKE-3K and from 2.3% to 3.8% on MQuAKE-HARD. On MQuAKE-2002, it goes from 20.6% to 20.4%. With Llama2-13B-Chat, the MQuAKE-3K comparison is 19.4% to 20.6%, and the MQuAKE-HARD comparison is 2.7% to 3.5%. MQuAKE-2002 goes from 18.8% to 18.4%.
These results show why the direct-edit comparison and the full-memory comparison should be read separately. Even with the decoder improvement, the full-memory answer accuracies are low in some conditions. An answer in this setting depends on what guidance the editor produces from the collection and on how the system uses that guidance. DeCK changes the latter part of the procedure. The experiment gives the accuracy of the assembled editor, which is the relevant measurement for a system that actually has to retrieve and use edits.
MeLLo gains on every reported full-memory comparison. With Llama2-7B-Chat, the results move from 32.6% to 43.1% on MQuAKE-3K, from 40.8% to 45.8% on MQuAKE-2002 and from 5.1% to 5.8% on MQuAKE-HARD. With Llama2-13B-Chat, they move from 33.4% to 36.8% on MQuAKE-3K, from 35.9% to 38.2% on MQuAKE-2002 and from 3.9% to 6.2% on MQuAKE-HARD. The comparison below shows how the result can depend on the editor using the decoder, even with the same system, dataset and edit-memory setting.
Llama2-7B-Chat full-memory editing accuracy on MQuAKE-2002
MeLLo gains accuracy from DeCK in a setting where IKE loses accuracy.
The numbers
| System or setting | accuracy % |
|---|---|
| IKE | 20.6 |
| IKE with DeCK | 20.4 |
| MeLLo | 40.8 |
| MeLLo with DeCK (this paper) | 45.8 |
MeLLo’s use of subquestions gives the decoder a place to help before the final answer. If the correct edited response is needed for an intermediate step, generating it can change the information available for later steps. The authors interpret the consistent gains as evidence that a better basic editing decision can help an editor with a broader reasoning procedure. The measurements show the gains at the level of completed answers. They do not attribute a specific share of the improvement to any particular reasoning step.
The selected cases of stubborn knowledge
The STUBBORN analysis reorganizes questions around recurring IKE failures. An edit may be tested with different questions that depend on it. The authors group cases by the proportion of those questions on which the ordinary editor fails. For STUBBORN > 33%, that failure rate exceeds 33%, and for STUBBORN > 67%, it exceeds 67%. They construct the selections separately for the Llama2 chat systems, so a group identified as stubborn for one system describes its behavior under IKE.
On the Llama2-7B-Chat STUBBORN > 33% subset, IKE achieves 56.4% and IKE with DeCK achieves 72.3%. On STUBBORN > 67%, the corresponding accuracies are 37.8% and 55.9%. ROME reaches 17.7% and 19.3% on those respective subsets. Performance remains lower in the more selective failure group even after the decoder is added. The gains show that the method recovers some answers from that harder group.
The Llama2-13B-Chat subsets give a different ordering of the baselines. On STUBBORN > 33%, ROME achieves 42.5%, IKE achieves 38.9%, and IKE with DeCK achieves 70.1%. On STUBBORN > 67%, the same methods achieve 40.2%, 29.4% and 48.5%, respectively. The authors describe gains of up to 80% for IKE with the decoder on this system’s selected cases. DeCK’s advantage on these subsets is relevant to the paper’s motivation because the groups were constructed specifically around recurring errors by the prompt-based editor.
The construction also explains what the subset comparison measures. The low IKE scores are partly a feature of selection: examples qualify because IKE frequently fails for the associated edit. The informative result is the change obtained by giving that editor a different decoding rule on the same selected cases. The comparison with ROME provides another view of their difficulty, since the subsets were chosen by IKE behavior and ROME uses a different intervention.
What the ablations show
How strongly to discount the original prediction
The authors vary γ to see how much influence the question-only prediction should have. A weak coefficient lets most of the original ordering under the edited prompt carry through. A larger one gives the baseline distribution more leverage over the final comparison. The concern is especially acute when a candidate is only just plausible under the edited distribution and is very unlikely under the question-only distribution. Its gain from subtraction can become large enough to overwhelm a candidate that has stronger support from the edited context.
On MQuAKE-3K, Llama2-7B-Chat reaches 88.7% at γ equal to 0.1 and 91.3% at 0.2. At 0.5, its accuracy drops to 80.2%. On the same benchmark, Llama2-13B-Chat reaches 76.1% at 0.1, 84.6% at 0.2 and 48.5% at 0.5. The largest tested coefficient gives accuracy lower than ordinary IKE in the direct-edit results for both systems. A token can pass the plausibility check and still be overpromoted by the later contrast.
The middle setting is best among the settings the paper tests. The comparison supports the authors’ explanation that the decoder benefits from a restrained adjustment to the baseline prediction. It also shows that the presence of a filter does not settle the strength of that adjustment. Filtering decides who may compete. The coefficient influences the outcome of the competition after that decision. Accuracy at the tested settings establishes sensitivity to the strength of the contrast, while the ablation leaves the preferred value on other contexts and systems open.
The contribution of edit-signal enhancement
The component ablation keeps the contrastive decoder and compares versions with and without the enhancement stage. For Llama2-7B-Chat, the version without enhancement gives 89.1% on MQuAKE-3K and 87.3% on MQuAKE-2002. With enhancement, those accuracies are 91.3% and 89.4%. The comparison on MQuAKE-HARD shows the same ordering.
Effect of editing-signal enhancement on Llama2-7B-Chat accuracy on MQuAKE-HARD
The decoder achieves higher editing accuracy when it includes signal enhancement.
The numbers
| System or setting | accuracy % |
|---|---|
| DeCK without enhancement | 94.7 |
| DeCK with enhancement (this paper) | 98.6 |
This comparison separates the contribution of the enhancement step from the contribution of the decoder as a whole. In the tested setting, contrast without enhancement already exceeds ordinary IKE. Adding enhancement improves the result further on each benchmark variant. Improvement of the full system can therefore coexist with an independent contribution from the contrastive step.
The authors’ explanation rests on when the enhancement is applied. A replacement token cannot benefit from the contrast after the filter has rejected it. Giving edit-related candidates more support beforehand changes which tokens can survive and also changes their probabilities within that set. The accuracy ablation measures the combined consequence of those changes. It is consistent with the authors’ account of preventing premature exclusion, without counting how many additional answers were recovered specifically because a candidate crossed the threshold.
This is a narrower component test than an exhaustive account of the enhancement formula. The paper compares turning the stage on and off. It does not separately vary its frequency weighting, similarity measure and coefficients in the reported accuracy results. The ablation supports the value of the implemented stage in these comparisons, while the contribution of each element inside it remains unresolved.
Which tokens move closer to the top
The token-rank study follows candidates that did not lead under ordinary IKE. On MQuAKE-3K, the authors select edited knowledge whose initial token lies in the rank range 2-100 under the original in-context editor. They group those candidates by their earlier rank and compare the average ranks after adding DeCK. This choice asks whether the decoder can improve the position of a replacement that already has some support. It also distinguishes near misses from cases where many vocabulary entries initially outrank the answer.
For original ranks 6-10, the average ranks after DeCK are 4.3 for Llama2-7B-Chat and 2.2 for Llama2-13B-Chat. The paper reports average rank improvements of 3.6 and 4.9, respectively, for that group. Among tokens originally at ranks 51-100, the average ranks after DeCK are 6.1 and 5.4, with reported improvements of 61.3 and 72.7. These are changes in where a token stands in the vocabulary ranking. They are a different measurement from a change in the percentage of completed answers that are correct.
The averages show movement in groups that start far from the lead as well as those that start close to it. The result also leaves room for improvement within those groups. An average position near the front can include both tokens that become the leading choice and tokens that remain behind other candidates. Accordingly, the rank analysis helps explain how the decoder can change the choice set, while the answer accuracy measures how often the generation actually succeeds.
Because the groups are defined by the original IKE ranks, a lower number after DeCK has a simple reading: the decoder promoted the token relative to its original competitors. It need not imply that the original association’s logit fell inside the underlying system. The final distribution is the output of the enhancement, filter and contrast. The diagnostic shows a change in the ranking used for generation, which is the part of the process the authors designed DeCK to alter.
How probability and rank support the outcome evidence
The paper also plots probabilities for the beginning of the replacement answer on the Llama2-7B-Chat stubborn cases. Without DeCK, more of the probability observations are concentrated in the lower range. With DeCK, more observations occur in the higher range. This complements the rank analysis. A token can climb in rank because of modest changes among closely spaced candidates. Movement in probability shows more directly that the final distribution allocates greater mass to the intended beginning of the answer.
The earlier inspection of ICE and the later inspection of DeCK concern different comparisons. The earlier one measures what happens when the prompt acquires an edit. It shows that ordinary ICE can already make the replacement much more competitive. The later one asks what happens when predictions under that edit are processed by the proposed decoder. Read together, they support the paper’s account of a failure that occurs at the point of generation. A replacement can be accessible under the prompt and still lose when a selection is made. The decoder changes that selection by amplifying evidence associated with the edit.
The probability results help explain why the authors use the term confidence. They can measure how much probability is assigned to the next token and whether the intended answer moves ahead of alternatives. Confidence in this sense is a property of the prediction being used to generate text. The evaluation of correct answers supplies a separate result. It shows when greater support for the edit coincides with a correct answer under the benchmark’s premise.
Limitations
The limit the authors state
The paper explicitly identifies generation cost. DeCK maintains two active input sequences and needs next-token predictions for both. It reports latency of roughly 1.6X that of original decoding. Sharing the output token keeps the streams aligned, but each stream still conditions on its own prefix and requires its own prediction. Any deployment that depends on response time has to consider the accuracy results under that added cost.
The authors point to opportunities for optimization in the underlying architecture or for a cheaper form of the method. The paper does not report a measured result for such an optimization. Its measured cost relates to the procedure that produces the reported accuracy comparisons. The intervention operates at the stage of prediction and token selection, so its use also depends on having access to the information required by that decoder.
What the experimental setup leaves open
The evaluation is a test of counterfactual editing on MQuAKE and its derivatives. The replacements are given as premises, so the benchmark can score whether an answer follows them. A system serving real updates would also need a way to decide which edit should be trusted, when it applies and what to do if several edits conflict. DeCK’s contrast can make a supplied premise more influential. The comparison between prompts cannot independently establish whether the premise is true. The paper’s connection to misinformation is therefore a motivation for improving the use of edits, with a benchmark result limited to the edits and answers specified by the task.
The results also leave the behavior of unrelated facts open. The baseline prediction can give high probability to tokens that express knowledge the question still needs, including material that should remain valid after the edit. The contrast treats a candidate according to its probabilities under the two contexts. It has no separate factual classification that tells it which baseline contributions belong to the obsolete association and which belong to useful supporting knowledge. The multi-hop accuracy scores test whether enough of that supporting knowledge survives for the benchmark answers. They provide no general measurement of behavior on questions unrelated to the edit.
The STUBBORN groups are useful for diagnosing failures, and their definition limits how far the conclusions extend. They are selected for repeated failure by IKE on the system being tested. They depend on the questions used to express the edit and the prompt procedure used to apply it. The results show that DeCK improves performance on those selected cases. They do not establish a universal list of facts that are resistant to editing, or show that a fact placed in one system’s group would have the same status elsewhere.
A similar distinction applies to the paper’s explanations for variation among the systems. The Llama2 comparison changes the trained system, and the Llama3 comparison brings additional differences into play. The authors suggest roles for parameter count, pretraining and instruction tuning. None is isolated by a controlled experiment that holds the others fixed. The results directly establish differences in accuracy under the tested prompts and decoding rules. They leave the reasons those systems differ as hypotheses.
The first-token analysis is necessarily local. It shows whether the system is ready to begin the expected answer, and it is especially informative when the old and new responses start differently. Answer generation continues beyond that position. A token can move to the front while the rest of a name or a later reasoning step still goes wrong. The full-question measurements address the completed outcome, while the diagnostic supports an explanation for one stage in reaching it. Neither measurement establishes whether the stated probability is calibrated as a judgment of real-world truth.
The method’s portability also has two distinct meanings. A frozen system need not expose its parameters for modification. The decoder nonetheless needs access to both vocabulary distributions and control over which token is appended. Those requirements follow from the algorithm itself. Describing in-context editing as a black-box prompting method is compatible with the paper’s analysis of its output scores, but ordinary access to generated text alone supplies too little information to implement the contrast. The tests show integrations with IKE and MeLLo. Broad compatibility with other editors is a claim about the interface between guidance and decoding, supported empirically by those integrations.
Finally, the enhancement description gives a relevance rule, a target and a divergence, but leaves some mathematical and implementation details open. The target’s mass assignment requires normalization, and the link between raw relevance and the assumed non-negative normalized weights is unspecified. The paper describes adding semantic relevance to the edited logits and reports an ablation of that step. The evidence for its value comes from the implemented comparison. The formulas do not, on their own, explain how a divergence minimizer is calculated or how the enhancement coefficients should be chosen for other tasks.
What came after
The later papers that cite DeCK address several ways of influencing generated answers. Their titles identify the problems they pursue, while the citation relationship by itself gives limited evidence about how DeCK was used. In particular, a citation can connect an older method to a new problem without carrying over its scoring rule or its experimental setup. Each of these later papers can be placed in relation to the question DeCK posed: what should happen when a system’s existing predictions and a new requirement point towards different outputs?
HiddenGuard addresses fine-grained safe generation through a specialized representation router. Its stated focus is on routing representations during generation. DeCK, by comparison, gives a concrete example of controlling generation by comparing token probabilities under two different contexts. The common subject is intervention during generation, with a different target for that intervention. In DeCK, the relevant requirement is a stipulated fact that should influence an answer. HiddenGuard’s title places its intervention in safe generation. The citation identifies DeCK as relevant prior work, but leaves the specific role of its contrast inside HiddenGuard undetermined. HiddenGuard
a1 examines test-time scaling through environment-augmented generation. It connects to the question of how information available at answer time can change what a generator produces. DeCK studies a controlled case of that question, with a specified replacement fact in one context and the question alone in the other. The later work’s title foregrounds environment augmentation and the behavior of generation as test-time resources change. The citation situates DeCK near that inquiry without establishing that a1 subtracts baseline log probabilities or uses DeCK’s plausibility filter. a1
Orthogonal Representation Editing concerns the semantic entanglement of edits applied in batches. It brings the discussion back to factual editing and moves the emphasis toward relationships among edits in a representation. DeCK’s full-memory experiments also involve a collection of edits, but use it as a source of guidance for an in-context editor. The problem named by the later work is how to decouple edits in batch representation editing. This connects to the broader concern that an individual factual change can have consequences beyond the direct answer, while leaving its particular use of DeCK unspecified. Orthogonal Representation Editing
Cite
Cite as Baolong Bi, Shenghua Liu, Lingrui Mei, Yiwei Wang, Junfeng Fang, Pengliang Ji and Xueqi Cheng. 2025. Decoding by Contrasting Knowledge: Enhancing Large Language Model Confidence on Edited Facts. Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).
@inproceedings{bi2025decoding,
title = {{Decoding by Contrasting Knowledge: Enhancing Large Language Model Confidence on Edited Facts}},
author = {Baolong Bi, Shenghua Liu, Lingrui Mei, Yiwei Wang, Junfeng Fang, Pengliang Ji and Xueqi Cheng},
booktitle = {Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
year = {2025},
doi = {10.18653/v1/2025.acl-long.841},
url = {https://doi.org/10.18653/v1/2025.acl-long.841}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/bi-2025-decoding-contrasting-knowledge-enhancing-large/