Long-term memory becomes callable code: MaC lifts overall LLM-judge accuracy by up to 15.91% on LOCOMO while using fewer tokens
Synopsis
Long-term memory systems usually store facts as entries and pick them by relevance at query time, which makes facts scattered across sessions and changing over time hard to compose. MaC puts memory construction and retrieval under one code abstraction: facts become executable functions with canonical identifiers and source references, and a query is compiled into a retrieval program that an executor runs after a single planning call. On LOCOMO and LONGMEMEVAL, MaC reaches the highest overall LLM-judge score in all four evaluation settings, improving over the strongest baseline in each by up to 15.91% and 9.06%, while substantially cutting token consumption.
Interpretation
Long-term memory is no longer only a set of facts to be retrieved; it is a library of functions a query program can call, so retrieval becomes executing a structured program over memory rather than selecting relevant facts. Earlier memory systems focused on organizing and maintaining facts and gave limited support for encapsulating computations over stored facts for reuse across queries; retrieval either used predefined pipelines or bought flexibility through stepwise LLM planning. On LOCOMO and LONGMEMEVAL, MaC achieves the highest overall LLM-judge score in all four evaluation settings, improving over the strongest baseline in each by up to 15.91% and 9.06%.
Construction turns facts from dialogue history into a three-layer executable structure, moving from an atomic function layer through a relational layer to a modular composition layer, each keeping fact identifiers and sources. The atomic function layer makes each canonical fact a function returning an evidence record, the relational layer marks replacements with supersedes relations while keeping both facts available, and the modular composition layer instantiates current-state and history derived functions from templates. On the retrieval side, an LLM planner uses the function index and operator interfaces to generate a complete retrieval program in one planning call, and the executor follows predefined branches from intermediate results without stepwise LLM planning during successful execution.
Perspective
The demonstrated scope is two long-term conversational memory benchmarks, LOCOMO and LONGMEMEVAL: LOCOMO uses three generation backbones, Qwen3.6-27B, ChatGPT-5.6-Luna and DeepSeek-V4-Flash, while LONGMEMEVAL uses Qwen3.6-27B for all methods, with LLM-judge scores produced by DeepSeek-V4-Flash.
Query-stage token consumption varies across backbones and methods, with the construction-stage advantage the most consistent; when program checking or execution fails, bounded repair attempts follow, with a fixed retrieval fallback if needed.
