New MGMem framework enables efficient long-horizon agent memory
Researchers have introduced MGMem, a framework that provides deterministic and cost-effective memory for AI agents without using generative indexing.
Source: Grafy Research LabResearchers have introduced a new framework designed to solve the growing problem of long-term memory in Large Language Model (LLM) agents. By moving away from generative indexing, the MGMem framework offers a way for AI to remember thousands of interactions without the high costs and inconsistencies associated with current methods.
What are the problems with current AI agent memory?
As AI agents evolve into conversational companions and productivity assistants, they must maintain persistent memory over days, weeks, or even months. However, because LLMs are stateless, they require external memory systems to surface relevant past information during long-term interactions.
According to the research paper by Junhong Huang, Xin Tong, and Jun Xia, the current industry standard is a "generate-then-retrieve" pattern. In this model, a generative LLM is used to rewrite history into summaries, facts, or knowledge graphs, which are then indexed for later use. The authors identify three primary drawbacks to this approach: high cost, non-determinism, and loss of provenance.
Generating thousands of summaries or facts requires an immense number of generative calls, making the indexing process expensive. Furthermore, because generative models are non-deterministic, they can produce different summaries for the same input, leading to inconsistent agent behavior and difficult debugging. Finally, because the system consumes synthesized text rather than the original dialogue, the direct link to the source of information—the provenance—is often lost.
How does the MGMem framework work?
MGMem replaces the expensive generative indexing step with a deterministic discriminative-parser pipeline. Instead of asking an LLM to summarize what happened, the framework uses a parser to identify recurring mentions across different sessions.
These mentions are organized into an incidence graph. When a user asks a question, the system uses a subject-conditioned three-stage resolver to navigate this graph. This process moves from exact matches to a subject-local bridge, and finally to a full-graph bridge to resolve the query.
Crucially, instead of returning a synthesized summary to the user, MGMem returns the original, raw dialogue episodes. This ensures that the agent's answer can be directly traced back to the actual conversation that occurred, preserving a clear audit trail.
How efficient and accurate is MGMem?
In testing, the MGMem framework demonstrated significant improvements in efficiency. Because it requires zero generative LLM calls during the indexing phase, it avoids the computational overhead that plagues systems like LightMem or EMem.
On the LoCoMo English multi-session dialogue QA benchmark, the researchers found that MGMem achieved a 75.89 0.10% accuracy rate. This performance was notably higher than other systems, outperforming EMem by 2.60 percentage points and Hybrid by 9.27 percentage points, all while using zero generative indexing calls. On the LongMemEval-S benchmark, the framework remained competitive, leading or tying in single-session retrieval categories compared to other local retrieval methods.
Why does deterministic memory matter for developers?
For developers building complex AI systems, determinism is vital for reproducibility. If an agent's memory is built using generative calls, the resulting index can change every time the system is rebuilt, even with the same input data. This makes it nearly impossible to conduct reliable ablation studies or debug why an agent provided a specific answer in a specific session.
By using a deterministic parser, MGMem ensures that the same input always produces the same index. This stability allows developers to build more predictable agents and more robust testing environments. Additionally, the preservation of provenance means that when an agent makes a claim based on past memory, the developer can verify that claim against the actual raw text of the previous interaction.
How can researchers explore memory and retrieval?
While MGMem is a specialized framework for agentic memory, the principles of efficient retrieval and managing long-context information are central to modern AI research. For those looking to explore how AI interacts with large volumes of information, the ability to query specific segments of text is a foundational skill.
Users can explore these concepts of information retrieval and context management through the Reader app, which allows for deep research and questioning of complex documents. For those interested in the structural ways information can be connected, observing how different models handle various prompts in Chat can provide insight into the current state of model-driven context management.
Frequently asked questions
Does MGMem use generative LLMs to create its memory index?
No, MGMem does not use generative LLM calls during the indexing process. Instead, it utilizes a deterministic discriminative-parser pipeline to identify mentions and organize them into an incidence graph, which avoids the high costs and non-deterministic nature of generative indexing.
Does MGMem preserve the original dialogue turns?
Yes, MGMem is designed to be provenance-preserving. Rather than returning synthesized summaries or facts created by an LLM, the framework returns the original, raw dialogue episodes to the reader, ensuring that the source of any information remains directly traceable.
How does MGMem compare to existing memory systems in terms of accuracy?
MGMem has shown high accuracy in multi-session dialogue tasks. On the LoCoMo benchmark, it achieved 75.89 0.10% accuracy, which outperformed several matched-protocol baselines like EMem and Hybrid, despite using no generative calls for its indexing phase.


