GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
arXiv preprint

Zep: A Temporal Knowledge Graph Architecture for Agent Memory

Zep stores agent memory as a knowledge graph whose facts record when they were true and when they were learned. On LongMemEval it beat full context by 8 to 11 points with 1.6K tokens instead of 115K.

Breakdown by FDE Interviews · 12 min read · Updated

About the original · 2025
AUTHORS
Rasmussen, Paliychuk, Beauvais, Ryan, Chalef
FROM
Zep AI
PUBLISHED
Jan 2025 · arXiv preprint
CITED BY
426Semantic Scholar · Oct 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 21% of this breakdown.

01

The paper in one minute

Zep is a commercial memory service for AI agents, and this paper describes its engine, Graphiti, a knowledge graph that is updated continuously from conversations and business data.

The graph has three tiers. Episodes hold raw input (messages, text or JSON) without loss. From each episode, an LLM extracts entities and facts (relationships between two entities, stored as edges), using the previous four messages for context. New entities are matched against existing ones by embedding similarity, full-text search and an LLM judgment, so "Priya" and "Priya Shah" become one node. Communities group strongly connected entities and carry summaries.

The distinctive part is time. Zep uses a bi-temporal model: each fact edge records when it became true and when it stopped being true in the world (valid_at, invalid_at), and when the system created and retired it (created_at, expired_at). Relative dates such as "two weeks ago" are resolved against the message's timestamp. When an LLM finds that a new fact contradicts an existing one over the same period, the old edge's validity is closed at the new fact's start. Nothing is overwritten, so the system can answer both "where does she live now?" and "where did she live in March?"

Retrieval runs cosine similarity, BM25 keyword search and breadth-first graph search, reranks the results, and formats the top facts with their date ranges plus entity summaries.

On LongMemEval, Zep beat putting the whole 115,000-token history in context, using about 1,600 tokens.

THE IDEA, VISUALLY
THREE TIERS, ONE GRAPH Communities label propagation; summaries Entities + facts resolved nodes; fact edges Episodes raw messages, kept whole A fact edge Priya —LIVES_IN→ Denver valid_at 2024-03-01 invalid_at (open) created 2024-04-02 expired (open) source episode 7 INGESTION: MANY LLM CALLS PER MESSAGE 1. extract entities (last 4 messages as context) 2. resolve: embeddings + full text + LLM 3. extract facts; dedupe within the same pair 4. extract dates from the message timestamp 5. LLM checks contradictions → close old edges RETRIEVAL: SEARCH, RERANK, FORMAT cosine + BM25 + breadth-first graph search → RRF, MMR, mention count, node distance or cross-encoder → facts with date ranges + entity summaries Ingestion latency and cost are not reported. LONGMEMEVAL, ~115K-TOKEN HISTORIES (TABLE 2) score latency context full context, 4o-mini 55.4% 31.3 s 115k Zep, 4o-mini 63.8% 3.20 s 1.6k full context, 4o 60.2% 28.9 s 115k Zep, 4o 71.2% 2.58 s 1.6k Zep timed over the internet; baselines were not BY QUESTION TYPE, gpt-4o (TABLE 3) single-session-preference 20.0 → 56.7 temporal-reasoning 45.1 → 62.4 multi-session 44.3 → 57.9 knowledge-update 78.2 → 83.3 single-session-assistant 94.6 → 80.4 gray = full context, blue = Zep DEEP MEMORY RETRIEVAL, gpt-4-turbo (TABLE 1) recursive summarization 35.3% conversation summaries 78.6% MemGPT 93.4% full conversation 94.4% Zep 94.8% 60 messages per conversation: fits in any context
Zep keeps raw messages, extracts entities and facts from them, and stores each fact with four timestamps, so a changed address closes the old fact instead of overwriting it. Retrieval returns facts with their date ranges, which is what made temporal questions answerable.
Research notes: the problem, approach and results
60.2% → 71.2%

LongMemEval with gpt-4o: full 115K-token history in context versus Zep's retrieved memory

115K → 1.6K

average context tokens per question, full history versus Zep

28.9 s → 2.58 s

median response latency with gpt-4o, full context versus Zep (Zep timed over the internet)

THE PROBLEM

Assistants need to remember facts that change: a customer moves, changes role, cancels an order. Retrieval over raw chat history finds stale and current statements alike, and stuffing a long history into the prompt is slow and costly. Most memory systems either overwrite facts or keep every version with no sense of which is current.

THE IDEA

Store memory in three tiers: raw episodes, extracted entities and fact edges, and community summaries. Give every fact a validity interval in the world and a record of when the system learned or retracted it (a bi-temporal model). When an LLM finds a new fact contradicting an old one, close the old fact's interval. Retrieve with semantic, keyword and graph search, rerank, and return facts with their dates.

THE RESULT

On LongMemEval, with histories averaging 115,000 tokens, Zep scored 63.8% with gpt-4o-mini and 71.2% with gpt-4o, against 55.4% and 60.2% for full context, using about 1,600 tokens and cutting latency about 90%. The biggest gains were on preference, temporal and multi-session questions; questions about what the assistant had said got worse.

02

Why it matters to an FDE

Enterprise assistants remember things that go stale: a customer's plan, a contact's role, a shipping address, a project's status. If memory is a pile of retrieved chat snippets, the model sees "I live in Austin" and "we moved to Denver" side by side and has to guess. If memory overwrites, you lose the history and cannot answer "what did we know when we sent that invoice?"

Zep's design gives three ideas worth copying even if you never use the product.

Store facts with validity intervals. A fact is true from one date to another. Closing an interval keeps history; returning date ranges with each fact lets the model answer "now" and "then" questions.

Separate world time from system time. When the assistant learns in April that someone moved in March, the record should show both. That lets you reconstruct what the agent believed when it acted, which matters for audits and complaints.

Keep the source. Every fact links back to the episode it came from. When extraction or entity matching goes wrong, and it will, you can find every fact a bad episode created or closed, and revert them.

The weak points are the ones the paper does not measure. Every message goes through several LLM calls (extraction, resolution, date extraction, contradiction checks), and the paper reports no ingestion cost or delay. Wrong merges and wrong contradiction calls silently change what the assistant believes. Budget for both, and build correction tools.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 149 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    The data model, ingestion pipeline, retrieval, results by question type and three misreadings

    Free account
  2. 04How it works

    Ingestion step by step, the temporal rules, communities and the retrieval pipeline

    Premium
  3. 05The numbers that matter

    Both benchmarks, latency, per-type results and the arithmetic behind the headline

    Premium
  4. 06Try it yourself

    Recheck the headline arithmetic, query a bi-temporal store, and undo a bad entity merge

    Premium
  5. 07Where it breaks

    Unmeasured ingestion, extraction errors, uneven baselines, a weak benchmark and table slips

    Premium
  6. 08Using it on a deployment

    Building memory for changing customer facts with intervals, provenance and correction tools

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →