Larimar: Large Language Models with Episodic Memory Control (2403.11901v4)
Abstract: Efficient and accurate updating of knowledge stored in LLMs is one of the most pressing research challenges today. This paper presents Larimar - a novel, brain-inspired architecture for enhancing LLMs with a distributed episodic memory. Larimar's memory allows for dynamic, one-shot updates of knowledge without the need for computationally expensive re-training or fine-tuning. Experimental results on multiple fact editing benchmarks demonstrate that Larimar attains accuracy comparable to most competitive baselines, even in the challenging sequential editing setup, but also excels in speed - yielding speed-ups of 8-10x depending on the base LLM - as well as flexibility due to the proposed architecture being simple, LLM-agnostic, and hence general. We further provide mechanisms for selective fact forgetting, information leakage prevention, and input context length generalization with Larimar and show their effectiveness. Our code is available at https://github.com/IBM/larimar
- Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
- Exploring the limits of transfer learning with a unified text-to-text transformer. The Journal of Machine Learning Research, 21(1):5485–5551, 2020.
- Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
- Attention is all you need. Advances in neural information processing systems, 30, 2017.
- 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 (EMNLP-IJCNLP), pages 2463–2473, 2019.
- Exploring length generalization in large language models. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id=zSkYVeX7bC4.
- The impact of positional encoding on length generalization in transformers, 2023.
- Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521–3526, 2017.
- Modifying memories in transformer models, 2020.
- Large language models with controllable working memory, 2022.
- Lost in the middle: How language models use long contexts, 2023.
- Can sensitive information be deleted from llms? objectives for defending against extraction attacks, 2023.
- Regional synapse gain and loss accompany memory formation in larval zebrafish. Proceedings of the National Academy of Sciences, 119(3):e2107661119, 2022.
- Adaptive expression of engrams by retroactive interference. bioRxiv, pages 2023–03, 2023.
- Model-free episodic control, 2016.
- Hippocampal contributions to control: the third way. Advances in neural information processing systems, 20, 2007.
- What learning systems do intelligent agents need? complementary learning systems theory updated. Trends in cognitive sciences, 20(7):512–534, 2016.
- Organizing memories for generalization in complementary learning systems. Nature neuroscience, 26(8):1438–1448, 2023.
- Creating a false memory in the hippocampus. Science, 341(6144):387–391, 2013.
- The kanerva machine: A generative distributed memory, 2018a.
- Generative pseudo-inverse memory. In International Conference on Learning Representations, 2021.
- Locating and editing factual associations in gpt. Advances in Neural Information Processing Systems, 35:17359–17372, 2022a.
- Aging with grace: Lifelong model editing with discrete key-value adaptors. arXiv preprint arXiv:2211.11031, 2022.
- Easyedit: An easy-to-use knowledge editing framework for large language models, 2023a.
- Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
- Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
- Pointer sentinel mixture models, 2016.
- Mass-editing memory in a transformer. In The Eleventh International Conference on Learning Representations, 2023.
- Memory-based model editing at scale. In International Conference On Machine Learning, Vol 162. JMLR-JOURNAL MACHINE LEARNING RESEARCH, 2022.
- Editing large language models: Problems, methods, and opportunities. arXiv preprint arXiv:2305.13172, 2023.
- Can we edit factual knowledge by in-context learning?, 2023.
- Zero-shot relation extraction via reading comprehension. arXiv preprint arXiv:1706.04115, 2017.
- CNN. 2023 in review fast facts, 2023. URL: \https://www.cnn.com/2023/11/13/us/2023-in-review-fast-facts/index.html.
- Memory hierarchies map onto the hippocampal long axis in humans. Nature neuroscience, 18(11):1562–1564, 2015.
- Supersizing transformers: Going beyond rag with extended minds for llms. The Normal Blog, 2023. URL: https://blog.normalcomputing.ai/posts/2023-09-12-supersizing-transformers/supersizing-transformers.html.
- In-context learning and induction heads, 2022.
- Efficiently modeling long sequences with structured state spaces, 2022.
- Mamba: Linear-time sequence modeling with selective state spaces, 2023.
- Repeat after me: Transformers are better than state space models at copying, 2024.
- Memory networks. arXiv preprint arXiv:1410.3916, 2014.
- Neural turing machines. arXiv preprint arXiv:1410.5401, 2014.
- Key-value memory networks for directly reading documents, 2016.
- Pentti Kanerva. Sparse distributed memory. MIT press, 1988.
- Learning attractor dynamics for generative memory, 2018b.
- Kanerva++: extending the kanerva machine with differentiable, locally block allocated latent memory, 2022.
- Variational memory addressing in generative models, 2017.
- Addressing some limitations of transformers with feedback memory, 2021.
- Unbounded cache model for online language modeling with open vocabulary, 2017.
- Generalization through memorization: Nearest neighbor language models. arXiv preprint arXiv:1911.00172, 2019.
- A comprehensive study of knowledge editing for large language models. arXiv preprint arXiv:2401.01286, 2024.
- Knowledge editing for large language models: A survey, 2023b.
- Transformer-patcher: One mistake worth one neuron. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=4oYUGeGBPm.
- Fast model editing at scale. arXiv preprint arXiv:2110.11309, 2021.
- Editing factual knowledge in language models. arXiv preprint arXiv:2104.08164, 2021.
- Mass-editing memory in a transformer. arXiv preprint arXiv:2210.07229, 2022b.
- Does localization inform editing? surprising differences in causality-based localization vs. knowledge editing in language models. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id=EldbUlZtbd.
- Model editing at scale leads to gradual and catastrophic forgetting. arXiv preprint arXiv:2401.07453, 2024.
- Unveiling the pitfalls of knowledge editing for large language models, 2023.
- Model editing can hurt general abilities of large language models, 2024.
- Knowledge sanitization of large language models, 2023.
- Improving sequential model editing with fact retrieval. In Houda Bouamor, Juan Pino, and Kalika Bali, editors, Findings of the Association for Computational Linguistics: EMNLP 2023, pages 11209–11224, Singapore, December 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.findings-emnlp.749. URL https://aclanthology.org/2023.findings-emnlp.749.
- Unlearning bias in language models by partitioning gradients. In Findings of the Association for Computational Linguistics: ACL 2023, pages 6032–6048, 2023.
- Who’s harry potter? approximate unlearning in llms, 2023.
- Unlearn what you want to forget: Efficient unlearning for llms. arXiv preprint arXiv:2310.20150, 2023.
- In-context unlearning: Language models as few shot unlearners. arXiv preprint arXiv:2310.07579, 2023.
- Knowledge neurons in pretrained transformers. arXiv preprint arXiv:2104.08696, 2021.