Abstract
Large Language Models (LLMs) excel in single-session interactions but often lack the ability to retain user-specific knowledge across long-term engagements. This paper presents a plug-and-play framework that equips LLMs with an "evolving" memory. By selectively distilling dialogues into "conditional" memory records—comprising context and knowledge—the system facilitates persistent personalization without the need for model retraining. Experimental results on specialized benchmarks show that this method outperforms traditional history-based retrieval in both accuracy and token efficiency.
1. Introduction
Current LLM-based assistants typically operate with a limited temporal horizon, often resetting to a baseline state between sessions. This "Goldfish Memory" necessitates that users repeatedly provide the same instructions, preferences, or background information, hindering the development of a truly personalized AI companion.
To address this, we propose a framework that intelligently preserves historical dialogue insights. Unlike simple chat log storage, our system evaluates the significance of each interaction, ensuring that only relevant knowledge is promoted to long-term memory.
2. Methodology
The framework functions as an external wrapper around a frozen LLM, utilizing prompt engineering and vector databases. It requires no fine-tuning, making it easily deployable on top of existing APIs.
2.1 Conditional Memory Construction
Rather than storing raw text, the system generates "Conditional Memory" records. When an interaction is deemed significant, the LLM produces a two-part entry:
- Context: A concise summary of the situational background.
- Knowledge: The specific preference or fact learned.
2.2 Self-Reflection Retrieval
Standard Retrieval-Augmented Generation (RAG) often fails when initial search queries are imprecise. Our system introduces a self-reflection loop. Upon retrieving potential memories, the LLM assesses whether the information is sufficient to address the user's current prompt. If insufficient, it iteratively generates refined search queries to explore the memory bank more deeply.
3. Experimental Setup
As no standard benchmarks existed for long-term personalized memory, three synthetic datasets were developed using GPT-4:
- Continuing Previous Dialogue: Tests referencing specific details from distant past conversations.
- Learning New Knowledge: Evaluates the acquisition of novel facts across sessions.
- Learning from Human Feedback: Focuses on adapting to explicit user corrections and stylistic preferences.
4. Results and Discussion
The Conditional Memory approach demonstrated significant improvements over baseline methods:
- Performance: In the "Learning New Knowledge" task, the framework achieved a GPT-score of 0.63, compared to 0.56 for raw history and 0.57 for summary-based methods.
- Efficiency: By filtering for importance, the system adds an average of only 140 tokens per utterance, maintaining a lean context window compared to the thousands of tokens required by raw history logs.
- Self-Reflection Utility: The iterative retrieval process was particularly effective for summary-based memory, allowing the model to pinpoint specific details within dense text blocks.
5. Conclusion and Future Work
This research provides a scalable, plug-and-play solution for LLM personalization. While highly effective with frontier models like GPT-4, future work is required to optimize performance for smaller open-source models and to implement "forgetting" mechanisms that can handle outdated or contradictory information.
Summary updated