MemoryBank: Enhancing Large Language Models with Long-Term Memory

Wanjun Zhong, Lianghong Guo, Qiqi Gao, He Ye, Yanlin Wang
5/17/2023
cs.CLcs.AI

No official code found. Best implementation: zhongwanjun/MemoryBank-SiliconFriend (451 stars, MIT, last commit 2023-05-24).

Abstract

Revolutionary advancements in Large Language Models have drastically reshaped our interactions with artificial intelligence systems. Despite this, a notable hindrance remains-the deficiency of a long-term memory mechanism within these models. This shortfall becomes increasingly evident in situations demanding sustained interaction, such as personal companion systems and psychological counseling. Therefore, we propose MemoryBank, a novel memory mechanism tailored for LLMs. MemoryBank enables the models to summon relevant memories, continually evolve through continuous memory updates, comprehend, and adapt to a user personality by synthesizing information from past interactions. To mimic anthropomorphic behaviors and selectively preserve memory, MemoryBank incorporates a memory updating mechanism, inspired by the Ebbinghaus Forgetting Curve theory, which permits the AI to forget and reinforce memory based on time elapsed and the relative significance of the memory, thereby offering a human-like memory mechanism. MemoryBank is versatile in accommodating both closed-source models like ChatGPT and open-source models like ChatGLM. We exemplify application of MemoryBank through the creation of an LLM-based chatbot named SiliconFriend in a long-term AI Companion scenario. Further tuned with psychological dialogs, SiliconFriend displays heightened empathy in its interactions. Experiment involves both qualitative analysis with real-world user dialogs and quantitative analysis with simulated dialogs. In the latter, ChatGPT acts as users with diverse characteristics and generates long-term dialog contexts covering a wide array of topics. The results of our analysis reveal that SiliconFriend, equipped with MemoryBank, exhibits a strong capability for long-term companionship as it can provide emphatic response, recall relevant memories and understand user personality.

View on arXivView PDF

Code Implementations(1)

MIT

Source code and demo for memory bank and SiliconFriend

45160CSS, ShellMay 17, 20233 years agoMIT

Similar Papers

Cite this paper

@article{zhong2023memorybank,
  title  = {MemoryBank: Enhancing Large Language Models with Long-Term Memory},
  author = {Wanjun Zhong and Lianghong Guo and Qiqi Gao and He Ye and Yanlin Wang},
  year   = {2023},
  eprint = {2305.10250},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.10250v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2305.10250.svg)](https://codeofpaper.com/paper/2305.10250)

Discussion