Architecture · MemGPT
Virtual Context and MemGPT: Memory Paging for LLMs
MemGPT introduced virtual context — treating the LLM context window like RAM and paging memories in and out of external storage — giving agents effectively unbounded memory; Letta is the production framework built on this idea.
Main context (RAM)
Hot tier · in prompt · limited tokens
Archival (disk)
Cold tier · external DB · unbounded
Research
The MemGPT paper and core idea
MemGPT (“MemGPT: Towards LLMs as Operating Systems”, Packer et al., 2023, arXiv:2310.08560) applies OS virtual memory to LLMs.
Limited fast memory (context window) + larger slow store (database) + paging functions the LLM invokes. Reported 93.4% accuracy on the Deep Memory Retrieval (DMR) benchmark with gpt-4-turbo. Zep later reports 94.8% on the same DMR task (Rasmussen et al., 2025).
Mechanism
How virtual context paging works
The agent has tools to search archival memory, write core memory and page segments in/out — the LLM decides what enters context before each step.
Core memory
In-context hot tier
Page out
Move to archival store
Archival
Persistent cold tier
Recall
Search + page in
Agent control
Memory as tools
Production
Letta: MemGPT in production
Letta is the product most developers use to implement MemGPT — agent server, memory blocks, recall functions and archival persistence.
MemGPT is the research idea; Letta is the deployable framework. When searchers ask for “MemGPT alternatives,” they usually mean Letta alternatives.
Trade-offs
Virtual context vs long raw context
Long context is bigger RAM; virtual context paging is the OS layer — still needed for unbounded history at sustainable cost.
Million-token windows exist, but cost scales linearly and attention dilution persists. Mem0 selective retrieval uses ~1,800 tokens per LOCOMO query vs ~26,000 full-context (Chhikara et al., 2025) — a different architecture class (extraction API vs paging), but the same cost motivation.
Architecture class
Virtual context vs vector memory APIs
Paging frameworks (Letta) give the agent OS-style tier control; vector APIs (Engram, Mem0) extract and retrieve facts without paging abstractions.
| Class | Examples | Best for |
|---|---|---|
| Virtual paging | Letta (MemGPT) | Unbounded multi-session chat |
| Vector API | Engram, Mem0 | Per-user fact memory |
| Temporal graph | Zep | Changing facts + relationships |
FAQ
Frequently asked questions
Is MemGPT the same as Letta?
Same lineage — MemGPT is the research paper (Packer et al., 2023); Letta is the production platform. See Letta alternatives.
What is virtual context memory?
Treating the LLM context window like RAM and paging segments to/from external archival storage — the MemGPT OS analogy. Letta implements this in production.
Is MemGPT open source?
The MemGPT research code and Letta OSS components are available. Letta also offers managed/hosted options. See open-source vs managed.
MemGPT vs Mem0 — which architecture?
MemGPT/Letta = agent-controlled paging across memory tiers. Mem0 = extraction API to vector store. Different classes — paging for unbounded chat; Mem0 for per-user facts. See Mem0 alternatives.
MemGPT vs Zep?
MemGPT/Letta pages conversation history. Zep stores temporal knowledge-graph facts. Different problems — paging vs evolving entity relationships. See Zep alternatives.
Is the MemGPT paper still relevant?
Yes — it established virtual context paging (Packer et al., 2023, DMR 93.4%). Letta continues the lineage; Zep reports 94.8% on the same DMR task (Rasmussen et al., 2025).
Does Engram use MemGPT paging?
No — Engram is a vector-native memory layer on Weaviate, not a paging framework. Choose Letta when agent-controlled tier paging is required. See Engram explained.
Can you build virtual context without Letta?
DIY: Redis hot tier + vector cold store + summarization pipeline mimicking MemGPT pattern. Letta provides research-backed paging tools built-in. See storage backends.
Virtual context vs million-token windows?
Long context is bigger RAM; paging is virtual memory for unbounded history at linear-cost control. See long context vs memory.
What are core and archival memory in MemGPT?
Core = in-context hot tier visible to the LLM. Archival = external cold store searched via recall functions. Agent tools move data between tiers.