Manuscript Offprint

arXiv:2608.28978

Selective Forgetting: A Graph-Based Memory Framework for Long-Term LLM Agents

Theo Rusu, Sourena Khanzadeh, Manar Alalfi

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Theo Rusu

Department of Computer Science Toronto Metropolitan University Toronto, Ontario, Canada trusu@torontomu.ca

Sourena Khanzadeh*

The Creative School Toronto Metropolitan University Toronto, Ontario, Canada Flybits, Creative AI Hub Toronto, Ontario, Canada sourena.khanzadeh@torontomu.ca

Manar Alalfi

Department of Computer Science Toronto Metropolitan University Toronto, Ontario, Canada manar.alalfi@torontomu.ca

Abstract

Knowledge graphs have been proposed as a structured alternative to flat retrieval-augmented generation for long-term agent memory, on the assumption that representing conversations as entities and relations improves recall. We evaluate that assumption directly. Our framework extracts each conversational turn into typed nodes and attributed edges, answers questions from a two-hop subgraph, and periodically prunes nodes that score low on a weighted combination of recency, access frequency, degree centrality, and age. On LongMemEval, the graph does not outperform a flat vector baseline at a matched candidate-generation budget of five retrieval roots: token F1 is 0.417 against 0.468, and a paired bootstrap over 500 questions gives Δ=−0.050\Delta = -0.050 (95% CI [−0.085,−0.016][-0.085, -0.016]). The gap is widest on questions that require recalling a specific prior assistant turn, where judged correctness falls from 0.911 to 0.607, suggesting that decomposing a turn into entities discards the surface form these questions depend on. The forgetting module is more successful. Applied once to a persistent 27,021-node graph, it removes 9.8% of nodes and 9.5% of stored bytes; token F1 is unchanged (+0.001, 95% CI [−0.015,+0.016][-0.015, +0.016]) and judged correctness falls by 1.6 points, with the 95% interval bounding any loss at 3.8 points ([−0.038,+0.006][-0.038, +0.006]). Because our extractor is a single small model evaluated on one benchmark, these results characterise this extraction-based pipeline rather than graph-structured memory in general.

Code: https://github.com/skhanzad/Selective-Amnesia

1 Introduction

Large Language Models have rapidly evolved from standalone text generators into the foundation of complex, agentic systems that are able to reason, plan, and use external tools. These systems are increasingly being adopted as personal AI assistants that interact with users over prolonged periods of time. The quality of these interactions is reliant not only on the model's immediate

*This work was conducted prior to the author's affiliations with Flybits and The Creative School. The author was previously affiliated with the Department of Computer Science at Toronto Metropolitan University.

Preprint.

reasoning ability, but also on the model's capacity to incorporate information from past exchanges. As such, memory becomes a critical component of these systems and is typically classified into two subcategories: short-term memory and long-term memory.

The current widely adopted long-term memory approach is retrieval-augmented generation Lewis et al. [2020], where dense vector stores are indexed and queried at inference time to retrieve relevant entries that augment the model's output. This method models memory as a flat, similarity-based retrieval system, which has been shown to be sensitive to noise, prone to retrieving irrelevant or redundant context, and is limited in its ability to support multi-hop reasoning or maintain coherent long-term knowledge Gao et al. [2023].

To address these limitations, recent work has explored structured memory representations based on knowledge graphs, where information is organized as entities and their relationships rather than independent embeddings. In these systems, memories are encoded as nodes and edges, allowing more complex semantic and relational representations to be stored Ji et al. [2021], Peng et al. [2023].

However, existing graph-based approaches mainly focus on how information is added and maintained for consistency Chhikara et al. [2025]. This does not address a fundamental challenge of long-term memory systems: unbounded growth. As interactions accumulate over time, memory stores become increasingly large, creating a range of downstream negative effects, including degraded retrieval quality, higher computational cost, and the retention of low-utility information.

As memory accumulates over prolonged interactions, the system must integrate new information and manage the relevance of existing knowledge. Prior work in continual learning and neural memory systems has shown that effective memory requires mechanisms for selective retention and forgetting, as retaining all information leads to performance degradation Kirkpatrick et al. [2017], Wei et al. [2026].

In this work, we investigate whether structuring long-term conversational memory as a knowledge graph meaningfully improves retrieval and reasoning in LLM agents, and whether systems can remain efficient over extended interactions. We introduce a graph-based memory framework with an explicit forgetting module that controls the lifecycle of stored information. Rather than assuming structural representations are uniformly beneficial, our study empirically characterizes where graph-based memory helps and where it degrades performance. In addition, we show that selective forgetting based on recency, frequency, and structural importance can reduce memory size without materially affecting retrieval quality. These findings highlight that effective long-term memory requires structured representation and careful design of update and retention mechanisms.

References (33)