Language models typically need to be trained or finetuned in order to acquire new knowledge, which involves updating their weights. We instead envision language models that can simply read and memorize new data at inference time, thus acquiring new knowledge immediately. In this work, we extend language models with the ability to memorize the internal representations of past inputs. We demonstrate that an approximate kNN lookup into a non-differentiable memory of recent (key, value) pairs improves language modeling across various benchmarks and tasks, including generic webtext (C4), math papers (arXiv), books (PG-19), code (Github), as well as formal theorems (Isabelle). We show that the performance steadily improves when we increase the size of memory up to 262K tokens. On benchmarks including code and mathematics, we find that the model is capable of making use of newly defined functions and theorems during test time.
Initialization is Critical to Whether Transformers Fit Composite Functions by Reasoning or Memorizing
School of Mathematical Sciences, Shanghai Jiao Tong University(上海交通大学数学科学学院);Shanghai Seres Information Technology Co., Ltd(上海赛尔斯信息技术有限公司);Center for LLM, Institute for Advanced Algorithms Research(高级算法研究院大语言模型中心)
Learn to Memorize: Scalable Continual Learning in Semiparametric Models with Mixture-of-Neighbors Induction Memory
State Key Laboratory for Multimedia Information Processing, School of Computer Science, Peking University(多媒体信息处理国家重点实验室,计算机科学学院,北京大学);Microsoft(微软公司);Microsoft Research Asia(微软亚洲研究院)
University of Maryland, College Park(马里兰大学帕克分校);Google Research(谷歌研究院)
大型Transformer模型在许多自然语言任务中取得了令人印象深刻的性能。特别地,基于Transformer的语言模型已经被证明在以其大量参数对事实知识进行编码方面具有很强的能力。虽然提高Transformers的记忆和概括能力的任务已经得到了广泛的研究,但如何使transformers忘记特定的旧事实并记住新事实还不太清楚。在本文中,我们提出了一个新的任务\emph{explicitly modifying specific factual knowledge in Transformer models while ensuring the model performance does not degrade on the unmodified facts}。此任务在许多情况下都很有用,例如更新陈旧的知识,保护隐私,以及消除存储在模型中的意外偏见。我们对几种方法进行了基准测试,这些方法在这项任务上提供了自然的基线性能。这导致了Transformer模型的关键组件的发现,这些组件对于知识修改特别有效。这项工作还提供了不同的训练阶段(如预训练和微调)对记忆和知识修改的作用的见解。
Memory Limitations of Prompt Tuning in Transformers
Department of Mathematics, National University of Singapore(新加坡国立大学数学系);IPAL, IRL2955, Singapore(新加坡IPAL);School of Computing, National University of Singapore(新加坡国立大学计算机学院);Department of Electrical and Computer Engineering, National University of Singapore(新加坡国立大学电气与计算机工程系)