[Paper Review] PMET: Precise Model Editing in a Transformer
PMET proposes a precise model editing method for Transformers by simultaneously optimizing hidden states of both Multi-Head Self-Attention (MHSA) and Feed-Forward Network (FFN), while using only the optimized FFN hidden states to update FFN weights. This approach improves editing reliability and specificity, achieving state-of-the-art performance on counterfact and zsRE benchmarks by leveraging MHSA's role as a knowledge extractor without modifying its weights.
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.
Motivation & Objective
- To address the imprecise weight updates in existing model editing methods that rely on Transformer Layer (TL) hidden states containing irrelevant information from MHSA and residual connections.
- To investigate whether MHSA stores factual knowledge or only general knowledge extraction patterns, which would affect whether its weights should be updated.
- To improve model editing reliability and specificity by decoupling the optimization of MHSA and FFN hidden states while preserving MHSA's structural role.
- To achieve state-of-the-art performance in editing efficacy, generalization, and specificity without modifying MHSA weights.
- To provide a more robust and interpretable framework for editing LLMs by analyzing component-level hidden state dynamics.
Proposed method
- PMET simultaneously optimizes the hidden states of both MHSA and FFN components within a Transformer layer, treating them as separate optimization targets.
- It uses only the optimized FFN hidden states as target knowledge representations to perform precise, least-squares-based updates on the FFN weights, avoiding contamination from irrelevant MHSA or residual information.
- MHSA hidden states are optimized to expand the function space for FFN optimization, without updating MHSA weights, based on the insight that MHSA encodes general knowledge extraction patterns.
- The method employs a residual spreading strategy (square root spreading) to distribute the incremental weight update across critical layers, balancing reliability and model preservation.
- It introduces a novel loss function that jointly optimizes MHSA and FFN hidden states while maintaining the integrity of the residual connection flow.
- The approach avoids weight modification in MHSA, preserving its role as a knowledge extractor, and only updates FFN weights using clean, optimized representations from the FFN component.
Experimental results
Research questions
- RQ1Does MHSA store factual knowledge, or does it primarily encode general knowledge extraction patterns that remain stable across edits?
- RQ2Can optimizing MHSA hidden states without updating its weights improve the precision and reliability of FFN weight updates in model editing?
- RQ3How does the choice of residual spreading strategy (e.g., square root vs. even) affect the trade-off between editing reliability and model specificity?
- RQ4To what extent does decoupling MHSA and FFN hidden state optimization improve editing performance compared to methods that use full TL hidden states?
- RQ5What is the impact of using only optimized FFN hidden states for weight updates, as opposed to mixed or residual-influenced representations?
Key findings
- PMET achieves state-of-the-art performance on both the counterfact and zsRE benchmarks, outperforming existing methods in editing reliability and specificity.
- Ablation studies show that optimizing both MHSA and FFN hidden states improves reliability compared to optimizing only FFN hidden states, confirming the benefit of expanded function space.
- Updating MHSA weights alongside FFN weights slightly improves generalization but significantly harms specificity, indicating MHSA stores some factual knowledge and should not be updated.
- Even spreading of residual updates leads to better model retention (fluency and specificity) but drastically reduces efficacy and consistency, highlighting the risk of information loss.
- Square root spreading provides the best balance between preserving model integrity and maintaining update reliability, outperforming even spreading in all key metrics.
- The findings confirm that MHSA encodes general knowledge extraction patterns and stores a small amount of factual knowledge, justifying its exclusion from weight updates in PMET.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.