MemFactory: Unified Inference & Training Framework for Agent Memory

📄 arXiv: 2603.29493v1 📥 PDF

作者: Ziliang Guo, Ziheng Li, Zhiyu Li

分类: cs.CL, cs.AI

发布日期: 2026-03-31

备注: 10 pages, Code: https://github.com/Valsure/MemFactory


💡 一句话要点

MemFactory:用于Agent Memory的统一推理与训练框架,提升记忆增强Agent性能。

🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 记忆增强Agent 强化学习 统一框架 模块化设计 策略优化 GRPO AI Agent

📋 核心要点

  1. 现有记忆增强Agent的实现方案零散且任务依赖性强,缺乏统一的训练和推理框架。
  2. MemFactory通过模块化设计,将记忆操作分解为可插拔组件,并集成GRPO进行策略优化。
  3. 实验表明,MemFactory在记忆Agent任务上取得了显著的性能提升,最高可达14.8%。

📝 摘要(中文)

本文提出了MemFactory,这是一个统一且高度模块化的训练和推理框架,专为记忆增强型Agent设计。现有方法高度碎片化且任务特定,缺乏统一的基础设施来简化复杂流程的集成、训练和评估。MemFactory借鉴LLaMA-Factory的成功经验,将记忆生命周期抽象为原子化的、即插即用的组件,使研究人员能够通过“乐高式”架构无缝构建自定义记忆Agent。此外,该框架原生集成了Group Relative Policy Optimization (GRPO),以微调由多维环境奖励驱动的内部记忆管理策略。MemFactory开箱即用地支持Memory-R1、RMM和MemAgent等前沿范式。在MemAgent架构上,MemFactory在领域内和领域外评估中均优于对应的基线模型,相对增益高达14.8%。MemFactory通过提供标准化、可扩展且易于使用的基础设施,显著降低了准入门槛,为记忆驱动AI Agent的未来创新铺平了道路。

🔬 方法详解

问题定义:现有记忆增强型Agent的研究面临缺乏统一框架的问题,导致研究人员难以高效地集成、训练和评估不同的记忆管理策略。现有的实现方案通常是针对特定任务定制的,缺乏通用性和可扩展性,阻碍了该领域的发展。

核心思路:MemFactory的核心思路是将记忆增强Agent的生命周期抽象为一系列原子化的、可插拔的组件,类似于乐高积木。通过这种模块化的设计,研究人员可以灵活地组合不同的组件,构建自定义的记忆Agent,并方便地进行训练和评估。同时,利用强化学习优化记忆管理策略。

技术框架:MemFactory框架主要包含以下几个核心模块:记忆存储模块(负责存储和管理记忆)、记忆检索模块(负责从记忆中检索相关信息)、记忆更新模块(负责更新记忆内容)以及策略优化模块(使用GRPO优化记忆管理策略)。整个流程包括:Agent与环境交互,产生观测;记忆检索模块根据观测从记忆中检索信息;Agent利用检索到的信息进行决策;Agent执行动作并获得环境反馈;记忆更新模块根据环境反馈更新记忆。

关键创新:MemFactory的关键创新在于其统一的、模块化的架构设计,以及原生集成的GRPO优化算法。这种设计使得研究人员可以方便地探索不同的记忆管理策略,并利用强化学习自动优化这些策略。与现有方法相比,MemFactory提供了一个更加通用、灵活和高效的平台,加速了记忆增强Agent的研究和开发。

关键设计:MemFactory的关键设计包括:1) 模块化的组件接口,允许用户自定义和替换不同的记忆存储、检索和更新策略;2) GRPO算法的集成,用于优化记忆管理策略,包括记忆的存储、检索和更新;3) 灵活的奖励函数设计,允许用户根据不同的任务目标定义多维奖励信号,驱动策略优化。

🖼️ 关键图片

fig_0

📊 实验亮点

MemFactory在MemAgent架构上进行了验证,实验结果表明,在领域内和领域外评估中,MemFactory均优于对应的基线模型,相对增益高达14.8%。这表明MemFactory能够有效地提升记忆增强Agent的性能,并具有良好的泛化能力。实验结果充分证明了MemFactory的有效性和优越性。

🎯 应用场景

MemFactory的应用场景广泛,包括智能对话系统、机器人导航、游戏AI等。通过增强Agent的记忆能力,可以使其更好地理解上下文信息,做出更明智的决策。该框架的标准化和易用性,将促进记忆增强Agent在各个领域的应用,并推动相关技术的发展。

📄 摘要(原文)

Memory-augmented Large Language Models (LLMs) are essential for developing capable, long-term AI agents. Recently, applying Reinforcement Learning (RL) to optimize memory operations, such as extraction, updating, and retrieval, has emerged as a highly promising research direction. However, existing implementations remain highly fragmented and task-specific, lacking a unified infrastructure to streamline the integration, training, and evaluation of these complex pipelines. To address this gap, we present MemFactory, the first unified, highly modular training and inference framework specifically designed for memory-augmented agents. Inspired by the success of unified fine-tuning frameworks like LLaMA-Factory, MemFactory abstracts the memory lifecycle into atomic, plug-and-play components, enabling researchers to seamlessly construct custom memory agents via a "Lego-like" architecture. Furthermore, the framework natively integrates Group Relative Policy Optimization (GRPO) to fine-tune internal memory management policies driven by multi-dimensional environmental rewards. MemFactory provides out-of-the-box support for recent cutting-edge paradigms, including Memory-R1, RMM, and MemAgent. We empirically validate MemFactory on the open-source MemAgent architecture using its publicly available training and evaluation data. Across both in-domain and out-of-distribution evaluation sets, MemFactory consistently improves performance over the corresponding base models, with relative gains of up to 14.8%. By providing a standardized, extensible, and easy-to-use infrastructure, MemFactory significantly lowers the barrier to entry, paving the way for future innovations in memory-driven AI agents.