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)
翻译:大语言模型(LLMs)中的知识可能会迅速过时。虽然上下文编辑(ICE)是目前知识编辑(KE)最有效的方法,但它受限于LLMs的黑盒建模,因此缺乏可解释性。我们的工作旨在通过分析上下文新知识对词元级分布的影响,阐明ICE在KE中的优越性能。我们观察到,尽管新知识的对数几率显著提升,但性能仍受到顽固知识的阻碍。顽固知识指在预训练过程中获得过度置信的事实,导致难以有效编辑。为解决这一问题并进一步提升ICE性能,我们提出了一种名为$\textbf{De}$coding by $\textbf{C}$ontrasting $\textbf{K}$nowledge(DeCK)的新方法。DeCK通过对比ICE引导下新编辑知识获得的对数几率与未编辑参数知识获得的对数几率,推导出下一个词元的分布。实验一致表明,DeCK增强了LLMs对已编辑事实的置信度。例如,它在MQuAKE上将LLaMA3-8B-instruct的性能提升了高达219%,展示了其在编辑顽固知识时强化ICE的能力。我们的工作为开发兼具有效性和可解释性的LLMs知识编辑方法铺平了道路。(源代码地址:https://deck-llm.meirtz.com)