Abstract
Personalizing language models that effectively incorporate user interaction history remains a central challenge in the development of adaptive AI systems. While large language models (LLMs), combined with Retrieval-Augmented Generation (RAG), have improved factual accuracy, they often lack structured memory and fail to scale in complex, long-term interactions. To address this, we propose a flexible external memory framework based on knowledge graphs, which construct and update memory models automatically by the LLM itself. Building upon the AriGraph architecture, we introduce a novel hybrid graph design that supports both standard edges and two types of hyper-edges, enabling rich and dynamic semantic and temporal representations. Our framework also supports diverse retrieval mechanisms, including A*, water-circle traversal, beam search, and hybrid methods, making it adaptable to different datasets and LLM capacities. We evaluate our system on three benchmarks: TriviaQA, HotpotQA, and DiaASQ, demonstrating that different memory and retrieval configurations yield optimal performance depending on the task. Additionally, we extend the DiaASQ benchmark with temporal annotations and internally contradictory statements, showing that our system remains robust and effective in managing temporal dependencies and context-aware reasoning.
Introduction
For AI agents to truly personalize interactions, they require a reliable mechanism to remember and reason over a user's long-term history. The current industry standard, Retrieval-Augmented Generation (RAG), typically relies on chunking text and retrieving snippets via dense vector similarity. However, standard RAG lacks structured memory; it treats information as isolated fragments, struggling with complex reasoning or understanding temporal relationships across stored memories.
While recent "GraphRAG" approaches attempt to bridge this gap by building knowledge graphs, they often lack the flexibility to adapt retrieval strategies to varying LLM capacities or specific task demands. PersonalAI addresses these limitations by introducing a flexible, LLM-generated knowledge graph memory framework designed for long-term personalization and robust reasoning.
The PersonalAI Framework
The PersonalAI system operates in two primary phases: automated memory construction and a pluggable information retrieval pipeline.
Automated Memory Construction
The framework builds upon the AriGraph architecture to transform unstructured text into a structured hybrid graph. The process involves several steps, including triple and thesis extraction, episodic memory construction, and a self-correction mechanism that identifies and removes outdated or contradictory knowledge.
Hybrid Graph Structure
The resulting memory model is a hybrid graph incorporating three distinct types of nodes to capture different levels of granularity:
- Object Vertices: Atomic concepts (e.g., "Mona Lisa").
- Thesis Vertices: Complete atomic thoughts or claims extracted from the text.
- Episodic Vertices: The original raw text passages, providing full context.
This structure allows the system to support both standard edges and hyper-edges, facilitating rich semantic and temporal representations. Crucially, the system allows for "Graph Restrictions," where the retrieval algorithm can be instructed to ignore certain node types (like noisy episodic nodes) depending on the LLM's capacity.
Retrieval Mechanisms
PersonalAI features a customizable retrieval interface that traverses the graph using various algorithms:
- A* Search: Utilizes vector-based heuristics to find the shortest path between entities.
- WaterCircles: A fast Breadth-First Search (BFS) method that expands from query entities to find intersecting pathways.
- BeamSearch: Generates multiple semantically relevant paths, mimicking LLM token generation.
- Hybrid Methods: Combinations such as BeamSearch + WaterCircles to balance speed and depth.
Experimental Evaluation
The framework was evaluated across three benchmarks: DiaASQ (Chinese forum dialogues), HotpotQA (multi-hop reasoning), and TriviaQA (open-domain factoids). The authors specifically extended DiaASQ with temporal annotations and contradictory statements to test the agent's ability to handle temporal dynamics.
Key Results and Insights
The study revealed that the optimal memory configuration depends heavily on the size of the LLM:
- Model Size and Memory Diet: Smaller models (7B/8B) are easily overwhelmed by noisy raw text and rely heavily on structured "thesis" nodes. In contrast, larger models (>14B) are robust enough to extract information directly from episodic nodes.
- Retrieval Efficiency: WaterCircles proved to be the fastest method (0.30 min/query), while BeamSearch was the most thorough but computationally expensive (6.59 min/query). For large models, a hybrid of both yielded the best performance.
- Performance Gains: PersonalAI outperformed existing GraphRAG baselines by 14.1% on the ExactMatch metric for HotpotQA. However, it still lags behind domain-specific fine-tuned RAG models on TriviaQA, indicating that zero-shot graph retrieval remains a challenge against highly specialized retrievers.
Conclusion and Future Work
PersonalAI demonstrates that a flexible, structured knowledge graph can significantly enhance the reasoning capabilities of personalized AI agents. While the computational cost of graph construction remains high (e.g., 90 hours for a TriviaQA subset on a 7B model), the ability to tune retrieval strategies based on model capacity offers a path forward for more efficient adaptive AI. Future work will explore temporal filtering, distributed scalability, and security protocols like Private Information Retrieval (PIR) to ensure personalized memory remains secure.
Summary updated