Table of Contents
Fetching ...

Decoding by Contrasting Knowledge: Enhancing LLMs' Confidence on Edited Facts

Baolong Bi, Shenghua Liu, Lingrui Mei, Yiwei Wang, Pengliang Ji, Xueqi Cheng

TL;DR

This work investigates why in-context editing (ICE) effectively updates knowledge in large language models while remaining a black-box process. It reveals that ICE primarily boosts the logits of edited knowledge with limited impact on parametric knowledge, leaving stubborn knowledge as a key obstacle. To address this, the authors introduce DeCK, a decoding strategy with an editing signal enhancement and a contrastive decoding step that contrasts ICE-enhanced distributions with the original parametric distributions and applies an adaptive plausibility constraint. Empirical results on MQuAKE datasets show that DeCK substantially improves editing performance across several models (e.g., up to 219% on HARD with LLaMA3-8B-instruct) and can be integrated with existing ICE methods without modifying model parameters. The work advances accountable and effective knowledge editing by turning ICE into a more robust, interpretable decoding-time mechanism, at the cost of modest latency increase due to dual-sequence decoding.

Abstract

The knowledge within large language models (LLMs) may become outdated quickly. While in-context editing (ICE) is currently the most effective method for knowledge editing (KE), it is constrained by the black-box modeling of LLMs and thus lacks interpretability. Our work aims to elucidate the superior performance of ICE on the KE by analyzing the impacts of in-context new knowledge on token-wise distributions. We observe that despite a significant boost in logits of the new knowledge, the performance of is still hindered by stubborn knowledge. Stubborn knowledge refers to as facts that have gained excessive confidence during pretraining, making it hard to edit effectively. To address this issue and further enhance the performance of ICE, we propose a novel approach termed $\textbf{De}$coding by $\textbf{C}$ontrasting $\textbf{K}$nowledge (DeCK). DeCK derives the distribution of the next token by contrasting the logits obtained from the newly edited knowledge guided by ICE with those from the unedited parametric knowledge. Our experiments consistently demonstrate that DeCK enhances the confidence of LLMs in edited facts. For instance, it improves the performance of LLaMA3-8B-instruct on MQuAKE by up to 219%, demonstrating its capability to strengthen ICE in the editing of stubborn knowledge. Our work paves the way to develop the both effective and accountable KE methods for LLMs. (The source code is available at: https://deck-llm.meirtz.com)

Decoding by Contrasting Knowledge: Enhancing LLMs' Confidence on Edited Facts

TL;DR

This work investigates why in-context editing (ICE) effectively updates knowledge in large language models while remaining a black-box process. It reveals that ICE primarily boosts the logits of edited knowledge with limited impact on parametric knowledge, leaving stubborn knowledge as a key obstacle. To address this, the authors introduce DeCK, a decoding strategy with an editing signal enhancement and a contrastive decoding step that contrasts ICE-enhanced distributions with the original parametric distributions and applies an adaptive plausibility constraint. Empirical results on MQuAKE datasets show that DeCK substantially improves editing performance across several models (e.g., up to 219% on HARD with LLaMA3-8B-instruct) and can be integrated with existing ICE methods without modifying model parameters. The work advances accountable and effective knowledge editing by turning ICE into a more robust, interpretable decoding-time mechanism, at the cost of modest latency increase due to dual-sequence decoding.

Abstract

The knowledge within large language models (LLMs) may become outdated quickly. While in-context editing (ICE) is currently the most effective method for knowledge editing (KE), it is constrained by the black-box modeling of LLMs and thus lacks interpretability. Our work aims to elucidate the superior performance of ICE on the KE by analyzing the impacts of in-context new knowledge on token-wise distributions. We observe that despite a significant boost in logits of the new knowledge, the performance of is still hindered by stubborn knowledge. Stubborn knowledge refers to as facts that have gained excessive confidence during pretraining, making it hard to edit effectively. To address this issue and further enhance the performance of ICE, we propose a novel approach termed coding by ontrasting nowledge (DeCK). DeCK derives the distribution of the next token by contrasting the logits obtained from the newly edited knowledge guided by ICE with those from the unedited parametric knowledge. Our experiments consistently demonstrate that DeCK enhances the confidence of LLMs in edited facts. For instance, it improves the performance of LLaMA3-8B-instruct on MQuAKE by up to 219%, demonstrating its capability to strengthen ICE in the editing of stubborn knowledge. Our work paves the way to develop the both effective and accountable KE methods for LLMs. (The source code is available at: https://deck-llm.meirtz.com)
Paper Structure (23 sections, 11 equations, 5 figures, 6 tables)

This paper contains 23 sections, 11 equations, 5 figures, 6 tables.

Figures (5)

  • Figure 1: Comparison between in-context editing (ICE) and our DeCK. DeCK successfully edits stubborn knowledge, whereas ICE handles only simple knowledge and fails with complex cases.
  • Figure 2: The changes of new knowledge and parametric knowledge before and after editing. We capture the first tokens of outputs to represent the corresponding knowledge and then record their original logits along with their ranks within the entire vocabulary.
  • Figure 3: Edit cases with changes in the first token for both parametric and new knowledge. We obtained the case results by conducting ICE in the LLaMA2-7B-chat model. '$\rightarrow$' indicates the knowledge change after incorporating editing prompts. 'logits' and 'rank' pertain to the first token of knowledge answer, reflecting the confidence of LLMs in the corresponding knowledge.
  • Figure 4: Illustration of DeCK enhancing ICE to edit the stubborn knowledge. During decoding, DeCK contrasts the enhanced ICE distribution with the original distribution to highlight new knowledge, inducing LLMs to generate edited facts using chain-of-though (CoT) wei2022chain during the reasoning process for answering input questions.
  • Figure 5: Probability Statistics of New Knowledge for LLaMA2-7B-chat on Stubborn Datasets. The probabilities are derived from softmax calculations.

Theorems & Definitions (1)

  • Definition 4.1: Knowledge Enhancement Divergence