Managing Infinite Memory: Neuro-Inspired Selective Forgetting in Graph RAG
Executive Summary
Standard Vector Retrieval-Augmented Generation (RAG) suffers from two main issues in long-horizon operations: context degradation (where irrelevant historical chunks pollute model context) and quadratic token expense.
Graph-structured memory offers superior multi-hop reasoning over unstructured vector databases, but without continuous maintenance, knowledge graphs experience exponential node growth. This article introduces the Neuro-Inspired Selective Forgetting Engine, a dynamic pruning framework that bounds context sizes while preserving vital relational memory.
The Selective Forgetting Mathematical Model To decide which knowledge nodes remain in high-priority working context, each node v in the graph receives a dynamic retention score S(v):
S(v) = (w1 * R(v)) + (w2 * F(v)) + (w3 * C(v)) - (w4 * A(v))
Where:
R(v) [Recency]: Exponential decay calculated from the time of last retrieval:
R(v) = exp(-lambda * delta_t)
F(v) [Frequency]: Total retrieval count over a rolling operational window.
C(v) [Degree Centrality]: The graph-level importance measure of node v based on its connected edges.
A(v) [Age]: Absolute elapsed time since the node was created.
w1, w2, w3, w4: Hyperparameters tuned based on workload characteristics.
Memory Lifecycle and Pruning Flow
Nodes whose retention score S(v) drops below the dynamic threshold undergo a two-tier offloading process:
By periodically compressing medium-tier nodes into generalized abstract nodes and archiving cold nodes, the active knowledge graph stays small. This guarantees fast multi-hop retrieval times while maintaining strict control over token usage.
