Model editing techniques modify a minor proportion of knowledge in Large Language Models (LLMs) at a relatively low cost, which have demonstrated notable success. Existing methods assume Transformer Layer (TL) hidden states are values of key-value memories of the Feed-Forward Network (FFN). They usually optimize the TL hidden states to memorize target knowledge and use it to update the weights of the FFN in LLMs. However, the information flow of TL hidden states comes from three parts: Multi-Head Self-Attention (MHSA), FFN, and residual connections. Existing methods neglect the fact that the TL hidden states contains information not specifically required for FFN. Consequently, the performance of model editing decreases. To achieve more precise model editing, we analyze hidden states of MHSA and FFN, finding that MHSA encodes certain general knowledge extraction patterns. This implies that MHSA weights do not require updating when new knowledge is introduced. Based on above findings, we introduce PMET, which simultaneously optimizes Transformer Component (TC, namely MHSA and FFN) hidden states, while only using the optimized TC hidden states of FFN to precisely update FFN weights. Our experiments demonstrate that PMET exhibits state-of-the-art performance on both the COUNTERFACT and zsRE datasets. Our ablation experiments substantiate the effectiveness of our enhancements, further reinforcing the finding that the MHSA encodes certain general knowledge extraction patterns and indicating its storage of a small amount of factual knowledge. Our code is available at https://github.com/xpq-tech/PMET.
翻译:模型编辑技术以较低成本修改大型语言模型(LLMs)中的少量知识,并已取得显著成功。现有方法假设Transformer层(TL)隐藏状态是前馈网络(FFN)键值记忆的值,通常通过优化TL隐藏状态记忆目标知识,并据此更新LLM中FFN的权重。然而,TL隐藏状态的信息流来自三个部分:多头自注意力机制(MHSA)、FFN和残差连接。现有方法忽略了一个事实:TL隐藏状态包含并非FFN专门需要的信息,这导致模型编辑性能下降。为实现更精确的模型编辑,我们分析了MHSA和FFN的隐藏状态,发现MHSA编码了特定的通用知识提取模式。这意味着,当引入新知识时,无需更新MHSA权重。基于以上发现,我们提出PMET方法,该方法同时优化Transformer组件(TC,即MHSA和FFN)的隐藏状态,但仅利用优化后的FFN的TC隐藏状态精确更新FFN权重。实验表明,PMET在COUNTERFACT和zsRE数据集上均表现出最先进的性能。消融实验验证了我们改进的有效性,进一步强化了MHSA编码通用知识提取模式的发现,并表明其存储少量事实性知识。我们的代码已开源至https://github.com/xpq-tech/PMET。