Elamur Research⌕
☰
home / papers / 2023 / PMET: Precise Model Editing in a Transformer

PMET: Precise Model Editing in a Transformer

Paper · 2023 · Xiaopeng Li; Shasha Li; Shezheng Song; Jing Yang; Jun Ma; and Jie Yu

Summary

Optimization-based editors such as ROME and MEMIT change facts stored in LLMs by treating FFN layers as key-value memories. They fit the full Transformer Layer (TL) hidden state to the new fact and use it as the target for the FFN weight update. That state, however, combines contributions from MHSA, the FFN and the residual stream, so the FFN update absorbs signal it does not need. The authors compare MHSA and FFN hidden states and argue that MHSA mainly acts as a knowledge extractor: it holds general extraction patterns and only a little factual knowledge, so its weights need not be edited. Their method, PMET, jointly optimizes the Transformer Component (TC) hidden states of MHSA and FFN. Only the optimized FFN component is then used to rewrite the FFN weights, and the residual is spread across critical layers by square-root spreading. Tested on GPT-J (6B) and GPT-NeoX (20B) with COUNTERFACT and zsRE, PMET reaches state-of-the-art overall results. This makes batch fact correction more precise and clarifies how attention and FFN divide their roles.

Key points

  • Reliability gains over the previous best method (MEMIT-style editing) average 3.3% on COUNTERFACT and 0.4% on zsRE. On GPT-NeoX (20B), PMET is notably stronger in reliability and consistency.
  • Ablations on GPT-J with batches of up to 10K edits support each design choice:
    • Dropping the MHSA hidden-state optimization lowers the overall score.
    • Also updating MHSA output weights slightly improves generalization but worsens specificity.
    • Even spreading instead of square-root spreading improves specificity but reduces generalization by as much as 14.4 points at 10K edits.
  • The overall score at 1K edits is 91.1, with efficacy 99.8, generalization 96.1 and specificity 80.1.
  • The authors acknowledge that edited models still cannot reason with the new facts, and they point to MQuAKE and RIPPLEEDITS as better future evaluations.
  • The paper was published at AAAI 2024, and the code is at github.com/xpq-tech/PMET.

Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.

 Institutions

 Fields, topics and concepts

Cite

Cite as Xiaopeng Li; Shasha Li; Shezheng Song; Jing Yang; Jun Ma; and Jie Yu. 2023. PMET: Precise Model Editing in a Transformer. arXiv:2308.08742.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.48550/arxiv.2308.08742 · arXiv 2308.08742

@misc{ma2023pmet,
  title = {{PMET: Precise Model Editing in a Transformer}},
  author = {Xiaopeng Li; Shasha Li; Shezheng Song; Jing Yang; Jun Ma; and Jie Yu},
  year = {2023},
  doi = {10.48550/arxiv.2308.08742},
  eprint = {2308.08742},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2308.08742}
}

References

33 references, 10 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

  1. Black, S.; Biderman, S.; Hallahan, E.; Anthony, Q.; Gao, L.; Golding, L.; He, H.; Leahy, C.; McDonell, K.; Phang, J.; Pieler, M.; Prashanth, U. S.; Purohit, S.; Reynolds, L.; Tow, J.; Wang, B.; and Weinbach, S. 2022. GPT-NeoX-20B: An Open-Source Autoregressive Language Model. In Proceedings of BigSc…
  2. Cao, B.; Lin, H.; Han, X.; Sun, L.; Yan, L.; Liao, M.; Xue, T.; and Xu, J. 2021. Knowledgeable or Educated Guess? Revisiting Language Models as Knowledge Bases. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on N…
  3. Cohen, R.; Biran, E.; Yoran, O.; Globerson, A.; and Geva, M. 2023. Evaluating the Ripple Effects of Knowledge Editing in Language Models. arXiv preprint arXiv:2307.12976. find
  4. De Cao, N.; Aziz, W.; and Titov, I. 2021. Editing Factual Knowledge in Language Models. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, 6491–6506. Online and Punta Cana, Dominican Republic: Association for Computational Linguistics. find
  5. Geva, M.; Bastings, J.; Filippova, K.; and Globerson, A. 2023. Dissecting Recall of Factual Associations in Auto-Regressive Language Models. arXiv:2304.14767. find
  6. Geva, M.; Caciularu, A.; Wang, K.; and Goldberg, Y. 2022. Transformer Feed-Forward Layers Build Predictions by Promoting Concepts in the Vocabulary Space. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, 30–45. Abu Dhabi, United Arab Emirates: Association fo…
  7. Geva, M.; Schuster, R.; Berant, J.; and Levy, O. 2021. Transformer Feed-Forward Layers Are Key-Value Memories. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, 5484–5495. Online and Punta Cana, Dominican Republic: Association for Computational Linguistics. find
  8. Hao, Y.; Dong, L.; Wei, F.; and Xu, K. 2021. Self-Attention Attribution: Interpreting Information Interactions Inside Transformer. Proceedings of the AAAI Conference on Artificial Intelligence, 35(14): 12963–12971. find
  9. Hassid, M.; Peng, H.; Rotem, D.; Kasai, J.; Montero, I.; Smith, N. A.; and Schwartz, R. 2022. How much does attention actually attend? Questioning the Importance of Attention in Pretrained Transformers. arXiv:2211.03495. find
  10. Heinzerling, B.; and Inui, K. 2021. Language Models as Knowledge Bases: On Entity Representations, Storage Capacity, and Paraphrased Queries. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, 1772–1791. Online: Association fo… find
  11. Hernandez, E.; Li, B. Z.; and Andreas, J. 2023. Inspecting and Editing Knowledge Representations in Language Models. arXiv:2304.00740.
  12. Ji, Z.; Lee, N.; Frieske, R.; Yu, T.; Su, D.; Xu, Y.; Ishii, E.; Bang, Y. J.; Madotto, A.; and Fung, P. 2023. Survey of Hallucination in Natural Language Generation. ACM Computing Surveys, 55(12): 1–38.
  13. Kobayashi, G.; Kuribayashi, T.; Yokoi, S.; and Inui, K. 2023. Feed-Forward Blocks Control Contextualization in Masked Language Models. arXiv:2302.00456. — [arXiv:2302.00456](https://arxiv.org/abs/2302.00456) find
  14. Kovaleva, O.; Romanov, A.; Rogers, A.; and Rumshisky, A. 2019. Revealing the Dark Secrets of BERT. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), 4365–4374. Hong Kong,…
  15. Levy, O.; Seo, M.; Choi, E.; and Zettlemoyer, L. 2017. Zero-Shot Relation Extraction via Reading Comprehension. In Proceedings of the 21st Conference on Computational Natural Language Learning (CoNLL 2017), 333–342. Vancouver, Canada: Association for Computational Linguistics.
  16. Li, X.; Li, S.; Song, S.; Yang, J.; Ma, J.; and Yu, J. 2023. PMET: Precise Model Editing in a Transformer. arXiv:2308.08742. — [arXiv:2308.08742](https://arxiv.org/abs/2308.08742)
  17. Liang, K.; Liu, Y.; Zhou, S.; Tu, W.; Wen, Y.; Yang, X.; Dong, X.; and Liu, X. 2023a. Knowledge Graph Contrastive Learning Based on Relation-Symmetrical Structure. IEEE Transactions on Knowledge and Data Engineering, 1–12. find
  18. Liang, K.; Meng, L.; Liu, M.; Liu, Y.; Tu, W.; Wang, S.; Zhou, S.; and Liu, X. 2023b. Learn from relational correlations and periodic events for temporal knowledge graph reasoning. In Proceedings of the 46th International ACM SIGIR Conference on Research and Development in Information Retrieval, 155… find
  19. Liang, R.; Li, T.; Li, L.; Wang, J.; and Zhang, Q. 2020. Knowledge Consistency between Neural Networks and Beyond. arXiv:1908.01581. — [arXiv:1908.01581](https://arxiv.org/abs/1908.01581) find
  20. Meng, K.; Bau, D.; Andonian, A.; and Belinkov, Y. 2022a. Locating and Editing Factual Associations in GPT. In Koyejo, S.; Mohamed, S.; Agarwal, A.; Belgrave, D.; Cho, K.; and Oh, A., eds., Advances in Neural Information Processing Systems, volume 35, 17359–17372. find
  21. Curran Associates, Inc. Meng, K.; Sharma, A. S.; Andonian, A.; Belinkov, Y.; and Bau, D. 2022b. Mass-Editing Memory in a Transformer. arXiv:2210.07229. find
  22. Mitchell, E.; Lin, C.; Bosselut, A.; Finn, C.; and Manning, C. D. 2022a. Fast Model Editing at Scale. In International Conference on Learning Representations. find
  23. Mitchell, E.; Lin, C.; Bosselut, A.; Manning, C. D.; and Finn, C. 2022b. Memory-Based Model Editing at Scale. arXiv:2206.06520. find
  24. Murphy, A. H. 1996. The Finley affair: A signal event in the history of forecast verification. Weather and forecasting, 11(1): 3–20. find
  25. Petroni, F.; Rocktäschel, T.; Riedel, S.; Lewis, P.; Bakhtin, A.; Wu, Y.; and Miller, A. 2019. Language Models as Knowledge Bases? In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMN…
  26. Sinitsin, A.; Plokhotnyuk, V.; Pyrkin, D.; Popov, S.; and Babenko, A. 2020. Editable Neural Networks. arXiv:2004.00345. find
  27. Wang, B.; and Komatsuzaki, A. 2021. GPT-J-6B: A 6 find
  28. Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax. Accessed: 2023-12-21. ↗
  29. Wang, K.; Variengien, A.; Conmy, A.; Shlegeris, B.; and Steinhardt, J. 2022. Interpretability in the wild: a circuit for indirect object identification in gpt-2 small. arXiv:2211.00593. find
  30. Yao, Y.; Wang, P.; Tian, B.; Cheng, S.; Li, Z.; Deng, S.; Chen, H.; and Zhang, N. 2023. Editing Large Language Models: Problems, Methods, and Opportunities. arXiv:2305.13172. find
  31. Zhao, W. X.; Zhou, K.; Li, J.; Tang, T.; Wang, X.; Hou, Y.; Min, Y.; Zhang, B.; Zhang, J.; Dong, Z.; Du, Y.; Yang, C.; Chen, Y.; Chen, Z.; Jiang, J.; Ren, R.; Li, Y.; Tang, X.; Liu, Z.; Liu, P.; Nie, J.-Y.; and Wen, J.-R. 2023. A Survey of Large Language Models. arXiv:2303.18223.
  32. Zheng, C.; Li, L.; Dong, Q.; Fan, Y.; Wu, Z.; Xu, J.; and Chang, B. 2023. Can We Edit Factual Knowledge by In-Context Learning? arXiv:2305.12740. find
  33. Zhu, C.; Rawat, A. S.; Zaheer, M.; Bhojanapalli, S.; Li, D.; Yu, F.; and Kumar, S. 2020. Modifying Memories in Transformer Models. arXiv:2012.00363. find

Updated

↑ back to top

This page in Markdown → https://md.research.elamur.ai/free/en/papers/li-2023-pmet-precise-model-editing-transformer/