IN THIS BREAKDOWN · 10 SECTIONS
You can read 21% of this breakdown.
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.
Research notes: the problem, approach and results
LongMemEval with gpt-4o: full 115K-token history in context versus Zep's retrieved memory
average context tokens per question, full history versus Zep
median response latency with gpt-4o, full context versus Zep (Zep timed over the internet)
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.
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.
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.
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.
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
- ◇1 architecture diagram
- </>1 runnable code experiment
- ▦2 results tables
- ?5 interview questions with answers
- 03Key takeaways
The data model, ingestion pipeline, retrieval, results by question type and three misreadings
Free account - 04How it works
Ingestion step by step, the temporal rules, communities and the retrieval pipeline
Premium - 05The numbers that matter
Both benchmarks, latency, per-type results and the arithmetic behind the headline
Premium - 06Try it yourself
Recheck the headline arithmetic, query a bi-temporal store, and undo a bad entity merge
Premium - 07Where it breaks
Unmeasured ingestion, extraction errors, uneven baselines, a weak benchmark and table slips
Premium - 08Using it on a deployment
Building memory for changing customer facts with intervals, provenance and correction tools
Premium - 09Interview angles
Five questions this paper prepares you for, with answer hints
Premium - 10Read next
Where to go from here on this site
Premium
