While large language models (LLMs) have enabled learning knowledge from the pre-training corpora, the acquired knowledge may be fundamentally incorrect or outdated over time, which necessitates rectifying the knowledge of the language model (LM) after the training. A promising approach involves employing a hyper-network to generate parameter shift, whereas existing hyper-networks suffer from inferior scalability in synchronous editing operation amount. To mitigate the problem, we propose the MAssive Language Model Editing Network (MALMEN), which formulates the parameter shift aggregation as the least square problem, subsequently updating the LM parameters using the normal equation. To accommodate editing multiple facts simultaneously with limited memory budgets, we separate the computation on the hyper-network and LM, enabling arbitrary batch size on both neural networks. Our method is evaluated by editing up to thousands of facts on LMs with different architectures, i.e., BERT-base, GPT-2, T5-XL (2.8B), and GPT-J (6B), across various knowledge-intensive NLP tasks, i.e., closed book fact-checking and question answering. Remarkably, MALMEN is capable of editing hundreds of times more facts than strong baselines with the identical hyper-network architecture and outperforms editor specifically designed for GPT. Our code is available at https://github.com/ChenmienTan/malmen.
翻译:尽管大规模语言模型(LLMs)能够从预训练语料中学习知识,但所获取的知识可能从根本上存在错误或随时间过时,这需要在训练后修正语言模型(LM)的知识。一种有前景的方法涉及使用超网络生成参数偏移,然而现有的超网络在同步编辑操作数量方面存在可扩展性不足的问题。为解决该问题,我们提出大规模语言模型编辑网络(MALMEN),将参数偏移聚合问题形式化为最小二乘问题,随后利用正规方程更新LM参数。为在有限内存预算下同时编辑多个事实,我们将超网络和LM上的计算分离,使得两种神经网络均能采用任意批量大小。我们的方法通过在具有不同架构(即BERT-base、GPT-2、T5-XL(2.8B)和GPT-J(6B))的LM上编辑多达数千个事实进行评估,涵盖各种知识密集型NLP任务(即闭卷事实核查和问答)。值得注意的是,MALMEN能够在相同超网络架构下编辑比强基线多数百倍的事实,并超越专门为GPT设计的编辑器。我们的代码可在https://github.com/ChenmienTan/malmen获取。