Seven Mental · 心智七篇
← Knowledge Atlas · Entity

MemGPT (Memory-GPT)

MemGPT:UC Berkeley 的虚拟上下文管理系统,LLM as OS 思想的关键实现
ENTITY · MEMGPT · UC BERKELEY · LLM AS OS · VIRTUAL CONTEXT MANAGEMENT · 2023

MemGPT

Imports OS-style hierarchical memory management into LLM context — “Towards LLMs as Operating Systems”

MemGPT (Packer, Stoica, Gonzalez et al., 2023) maps OS virtual-memory concepts onto LLMs: main context is like RAM, archival/recall memory is like disk. The LLM decides when to page via function calls — the key systems-level realization of the “LLM as OS” architecture.

MemGPT vs. AIOS — Same Roots, Different Streams
Dimension
MemGPT
AIOS
Focus
Single-agent context extension
Multi-agent resource management
OS Analogue
Virtual memory hierarchy
Full kernel scheduling
Scheduler
LLM self-paging
Centralized kernel
Problem
Context window too small
Concurrent agents competing for resources
Core Mechanisms
Main Context (RAM)
Active working memory — current conversation, task state, recent memory
Archival Memory (Disk)
Long-term persistent storage — historical dialogue, accumulated knowledge, retrieved on demand
Interrupt Mechanism
Control flow switches between management system and user — enables natural pause/resume in long sessions
Engineering Successors
Anthropic structured note-taking, Codex compaction — the hierarchical idea landing in production
→ Virtual Context Management · Context Management · AIOSarXiv:2310.08560 (2023)

MemGPT (Memory-GPT)

概述

MemGPT 是 UC Berkeley 团队(Charles Packer、Ion Stoica、Joseph Gonzalez 等)于 2023 年提出的系统,将操作系统的层次化内存管理思想应用于 LLM 上下文管理。论文标题”Towards LLMs as Operating Systems”直接表达了其定位:不是一个应用,而是一种系统架构思路。

核心机制

MemGPT 引入 虚拟上下文管理

  1. 层次化存储:main context(类似 RAM)+ archival memory / recall memory(类似磁盘)
  2. 自主调度:LLM 通过函数调用自主决定何时从外部存储读取或写入信息
  3. 中断机制:管理系统与用户之间的控制流切换

评估域

  • 长文档分析:处理远超 context window 的文档
  • 多会话聊天:跨多次对话维持记忆、反思、动态演化

在 Wiki 知识体系中的位置

MemGPT 是”LLM as OS”思想流派的关键系统实现。在本 wiki 的 context management 知识图谱中,它位于”架构级方案”层——介于底层的 compaction 机制和上层的 harness engineering 设计模式之间。

后续的工程实践(Anthropic 的 structured note-taking、initializer-coder 架构;OpenAI 的 Codex compaction)可以视为 MemGPT 层次化思路在生产系统中的具体落地。

与 AIOS 的关系

MemGPT 和 AIOS 都借鉴 OS 概念,但切入点不同:

MemGPTAIOS
焦点单 agent 的上下文扩展多 agent 的资源管理
OS 概念虚拟内存(RAM + 磁盘分层)完整内核(调度 + 内存 + 工具 + 权限)
调度方式LLM 自主决定何时换页Kernel 集中调度
解决的问题Context window 太小并发 agent 抢资源

两者互补:MemGPT 的层次化存储可以作为 AIOS Memory Manager 的底层实现,AIOS 的调度和隔离机制可以管理多个 MemGPT agent 的并发。

相关实体

  • Anthropic — 后续在 context management 工程上的主要推动者
  • OpenAI — Codex 的 compaction 机制与 MemGPT 思路呼应
  • Chroma — context rot 研究为 MemGPT 的分层存储提供了实证支持

References

  • sources/arxiv_papers/2310.08560-memgpt-towards-llms-as-operating-systems.md
  • sources/arxiv_papers/2403.16971-aios-llm-agent-operating-system.md