Systematic Diagnosis and Benchmarking of Memory Systems in Autonomous AI Research Agents: A Low-Resource Framework
A hands-on KDD'26 tutorial — diagnose, benchmark, and improve memory systems for autonomous research agents. Everything runs on a laptop; no GPU required for Phases 1–2.
KDD'26 · Jeju Island, Republic of Korea · August 9–13, 2026
Nur Arifin Akbar1 ·
Rahool Dembani2 ·
Gregorius Airlangga3 ·
Ripto Mukti Wibowo3
Biagio Lenzitti1 ·
Domenico Tegolo1
1 Universitá degli Studi di Palermo, Italy 2 Singularlogic, Athens, Greece 3 Atma Jaya Catholic University of Indonesia, Jakarta
DOI: 10.1145/3770855.3816477 · ISBN: 979-8-4007-2259-2/2026/08
Tutorial Workflow
┌─────────────────────────────────────────────────────────────────────┐ │ 4-PHASE HANDS-ON TUTORIAL (180 min) │ ├─────────────────────────────────────────────────────────────────────┤ │ Phase 1 (45 min) 30 memory techniques × 6 families (8 books) │ │ LLM demos (offline fallback) │ │ Phase 2 (40 min) Diagnose + benchmark on public data (5 books) │ │ 3-probe diag · utilization lab · LLM-as-judge │ │ Phase 3 (35 min) Real LLM-pretraining sweep on Modal L4 (4 books) │ │ groups split by depth/batch · memory diagnostic │ │ Phase 4 (50 min) Cognitive Memory Layer — constraint-aware │ │ memory: CML-lite build + diagnose (1 notebook) │ ├─────────────────────────────────────────────────────────────────────┤ │ 4 storage providers: verbatim | extracted_facts | episodic | hybrid │ │ + cognitive_constraint (Phase 4) — constraint-aware retrieval │ │ Honest metrics: util ≠ hit | semantic_pass ≠ hit | 3-arm reader │ └─────────────────────────────────────────────────────────────────────┘
You are here: this is the complete documentation. Follow the sections in the sidebar left-to-right, or jump to any phase.
What You'll Learn
- The 30 memory techniques across 6 families (short-term, long-term, cognitive, retrieval, frameworks, production) — with hands-on demos using a real LLM.
- The 3-probe diagnostic framework — how to measure retrieval relevance, context utilization, and failure root-cause independently (not circularly).
- How to benchmark four genuine memory providers (verbatim, extracted facts, episodic, hierarchical) on real public datasets (LoCoMo, LongMemEval, MemoryArena).
- The autonomous-research case study — run a real LLM-pretraining sweep on a cloud GPU, aggregate results across groups, and diagnose memory failures.
- Cognitive / constraint-aware memory — build a pure-Python "CML-lite" provider that surfaces stored constraints (allergies, OOM rules) even on zero-overlap queries, then diagnose it with the same 3-probe harness.
🔬 Run in Google Colab
Every notebook below is a clickable Colab link (🔬). Click any name to open that specific notebook in Google Colab — the setup cell auto-clones the repo and installs dependencies.
| Phase | Start here (click to open) | Total |
|---|---|---|
| 1 | 01 Short-term Memory 🔬 | 8 notebooks |
| 2 | 01 Diagnostic Framework 🔬 | 5 notebooks |
| 3 | 01 Autoresearch Loop 🔬 | 4 notebooks |
| 4 | 11 Cognitive Memory Layer 🔬 | 1 notebook |
Individual notebook links (all 18) are in the Phase tables below.
Setup (5 minutes)
Prerequisites
| Requirement | Details |
|---|---|
| Python | 3.10 or later |
| RAM | 8 GB+ (16 GB recommended for Phase 3) |
| GPU | Not required for Phases 1–2. Phase 3 uses a cloud L4 (Modal). |
| API key (Phase 1) | Free OpenAI-compatible endpoint: OPENAI_API_KEY + OPENAI_BASE_URL=https://api.openai.com/v1 |
| Modal (Phase 3) | pip install modal && modal setup (~$0.5–1/group) |
Install
# 1. Clone the repository
git clone -b tutorial-rebuild https://github.com/syaikhipin/kdd26-memdiag kdd-tutorial
cd kdd-tutorial
# 2. Install dependencies (offline-only, lightweight)
pip install numpy matplotlib pyyaml
# 3. Install the CLI package (optional but recommended)
pip install -e source # core package
pip install -e "source[api]" # + openai/tiktoken for LLM demos
# 4. Verify
python -m compileall -q source # should print nothing (success)
export OPENAI_API_KEY=-<your-key>
export OPENAI_BASE_URL=https://api.openai.com/v1
Without a key, the demos fall back to offline heuristics (still runnable, just less rich).Quick Start
Open any notebook in Jupyter or Colab — each is independent and self-contained:
# Phase 1 (offline or ):
jupyter notebook tutorial/phase1_memory_architectures/01_short_term_memory.ipynb
# Phase 2 (offline, no key):
jupyter notebook tutorial/phase2_public_datasets/01_diagnostic_framework.ipynb
# Or use the CLI directly:
diagnostic-framework diagnose --strategies verbatim,extracted_facts,episodic,hybrid --top_k 5
benchmark-cli compare --providers verbatim,extracted_facts,episodic,hybrid --sample_size 20
Phase 1 Agent Memory Techniques (60 min)
Goal: tour all 30 memory techniques across 6 families, with hands-on demos. LLM-based techniques use an OpenAI-compatible endpoint; offline fallbacks are always available.
Adapted from Agent Memory Techniques by Nir Diamant (Apache-2.0).
The 6 families
| Family | Techniques | What it solves |
|---|---|---|
| Short-term | 01–05 | Keep recent turns without filling the context window |
| Long-term | 06–11 | Persist knowledge across sessions, users, and time |
| Cognitive | 12–19 | Working, hierarchical, consolidation, reflection, routing, forgetting |
| Retrieval | 20–23 | Choose what to recall and when; share across agents |
| Frameworks | 24–27 | Production libraries: Graphiti, Mem0, Letta, Zep |
| Evaluation | 28–30 | Measure quality, benchmark, deploy at scale |
Phase 1 notebooks (8)
| # | Notebook | Covers | LLM demos |
|---|---|---|---|
| 01 | 01_short_term_memory 🔬 | Buffer, sliding, summary, token budget | 03 summary |
| 02 | 02_long_term_memory 🔬 | Vector, entity, KG, episodic, semantic, procedural | 07 entity |
| 03 | 03_cognitive_architectures 🔬 | Working, hierarchical, consolidation, forgetting | via providers |
| 04 | 04_retrieval_multi_agent 🔬 | Retrieval patterns, cross-session, multi-agent, tools | — |
| 05 | 05_frameworks 🔬 | Graphiti, Mem0, Letta, Zep (descriptions) | — |
| 06 | 06_evaluation_production 🔬 | Evaluation, benchmarks, production | — |
| 07 | 07_capstone 🔬 | 4 architectures compared on one conversation | via providers |
| 08 | 08_exercise 🔬 | Hands-on: build a support-agent memory system | yes |
Phase 2 Public Datasets (60 min, offline)
Goal: diagnose retrieval vs utilization failures on real benchmarks, then benchmark the 4 providers. No API key needed.
The 3-probe diagnostic framework
| Probe | Measures | How |
|---|---|---|
| 1. Retrieval relevance | Did the system retrieve the right evidence? | P/R/F1 vs gold evidence IDs |
| 2. Context utilization | Did the agent use the memory? | 3-arm reader (no-context / oracle / provider) |
| 3. Failure root-cause | Where did it break? | retrieval_miss / partial / retrieved-but-unused |
Phase 2 notebooks (5)
| # | Notebook | What | Time |
|---|---|---|---|
| 01 | diagnostic_framework 🔬 | Exercise 1: diagnose failures | 1.4s |
| 02 | utilization_lab 🔬 | 3-arm utilization lab + inspect a failure | <1s |
| 03 | benchmarking 🔬 | Exercise 2: benchmark providers | 4.2s |
| 04 | llm_as_judge_lab 🔬 | Live LLM judge vs offline proxy | 25s |
| 05 | question_type_analysis 🔬 | Per-type: which architecture wins where | <1s |
Phase 3 Autoresearch (60 min, Modal L4)
Goal: run a real LLM-pretraining sweep on a cloud GPU, aggregate across groups, and diagnose memory failures.
Group slices (each fits one L4)
| Group | Configs (depth, batch) | Why |
|---|---|---|
| A | (4,32), (6,32) | Shallow, safe |
| B | (8,32), (10,32) | Medium depth |
| C | (12,16), (14,16) | Deep — batch 16 recovers the VRAM">OOM |
| D | (16,16), (18,16) | Deepest |
Phase 3 notebooks (4)
| # | Notebook | What | Time |
|---|---|---|---|
| 01 | autoresearch_loop 🔬 | The loop + why we split into groups | <1s |
| 02 | run_your_group 🔬 | Run YOUR slice on Modal L4 | ~14.5 min |
| 03 | aggregate_and_debug 🔬 | Aggregate sweep + keep/revise/discard | 8s |
| 04 | memory_diagnostic 🔬 | 5-condition interventional diagnostic | pilot |
Phase 4 Cognitive Memory Layer (50 min, offline)
Goal: go beyond storage memory. Build a tiny "CML-lite" provider that adds the one thing verbatim / episodic / extracted / hybrid all lack — constraint awareness: surfacing a stored rule ("I'm allergic to shellfish", "depth 16 → OOM") even when the query shares zero words with it. Then diagnose it with the same 3-probe / LoCoMo harness from Phase 2.
Inspired by the Cognitive Memory Layer (avinash-mall/CognitiveMemoryLayer), a neuro-inspired system (Docker + Postgres + Neo4j + Redis + ~25 GB of models) we cannot run in a Colab slot — so we capture its cognitive core in ~90 lines of pure Python, fully offline.
The 5 cognitive constraint types
| Type | Example | When the cognitive layer surfaces it |
|---|---|---|
| POLICY | "I'm allergic to shellfish" | Always (safety-critical) |
| STATE | "the GPU server is down" | Always |
| CAUSAL | "depth 16 batch 32 → OOM" | Action / config queries (Phase 3 tie-in!) |
| GOAL | "I want to lose weight" | Recommendation queries |
| VALUE | "I value privacy over convenience" | Recommendation queries |
Phase 4 notebook (1)
| # | Notebook | What | Time |
|---|---|---|---|
| 11 | cognitive_constraint_layer 🔬 | Constraint extraction + zero-overlap retrieval + 3-probe diagnostic | <1s |
Results (honest, tutorial-scale)
LoCoMo — where the 4 architectures are distinct
| Strategy | Precision | Recall | Hit | Memory size |
|---|---|---|---|---|
| no_memory | 0.000 | 0.000 | 0.000 | 0 |
| verbatim | 0.040 | 0.188 | 0.200 | 419 |
| extracted_facts | 0.040 | 0.188 | 0.200 | 1282 |
| episodic | 0.000 | 0.000 | 0.000 | 19 |
| hybrid | 0.003 | 0.125 | 0.125 | 438 |
Memory footprints differ 10x (419 / 1282 / 19 / 438) — genuinely different architectures. No single strategy dominates.
Autoresearch trace (real L4)
| Depth | Batch | val_bpb (lower = better) |
|---|---|---|
| 4 | 32 | 1.254 |
| 6 | 32 | 1.296 |
| 8 | 32 | 1.433 |
| 10 | 32 | 1.661 |
3-arm utilization lab results
| Strategy | p0 (baseline) | Oracle (ceiling) | Provider | Net gain | Beneficial | Harmful |
|---|---|---|---|---|---|---|
| no_memory | 0.25 | 0.60 | 0.25 | 0.00 | 0 | 0 |
| verbatim | 0.25 | 0.60 | 0.35 | +0.10 | 7 | 3 |
| extracted_facts | 0.25 | 0.60 | 0.325 | +0.075 | 6 | 3 |
| episodic | 0.25 | 0.60 | 0.35 | +0.10 | 5 | 1 |
| hybrid | 0.25 | 0.60 | 0.35 | +0.10 | 7 | 3 |
Memory helps by +10pp accuracy (provider vs no-memory). The oracle ceiling (0.60) shows room for improvement — better retrieval/representation could close the gap.
CLI Package
pip install -e source # offline deps
pip install -e "source[api]" # + openai/tiktoken
diagnostic-framework diagnose --strategies verbatim,extracted_facts,episodic,hybrid --top_k 5
benchmark-cli compare --providers verbatim,extracted_facts,episodic,hybrid --sample_size 20
benchmark-cli serve --port 8080
LLM-as-Judge Lab
Notebook 04_llm_as_judge_lab.ipynb runs a live LLM judge
and compares it to the offline token-overlap proxy. Where they disagree: semantic relevance the
proxy misses. This is the proposal's headline evaluation protocol, demonstrated live.
Memory Diagnostic (Phase 3D)
5 memory conditions x K=5 repeated probes, frozen pre-decision snapshots, real LLM agent:
| Condition | OOM rate | Any-OOM | Tests |
|---|---|---|---|
| M0 no-memory | 50% | 62% | Placebo baseline |
| M1 raw-history | 12% | 12% | Full trial log |
| M2 retrieved | 12% | 30% | Batch-keyed retrieval |
| M3 structured-rule | 5% | 5% | Raw + constraint |
| M4 oracle | 0% | 12% | Raw + outcome |
4-Phase Schedule (180 min)
| Time | Phase | Activity |
|---|---|---|
| 0:00–0:45 | 1 | 30 memory techniques (8 notebooks) + hands-on exercise |
| 0:45–0:55 | — | Break (install Modal for Phase 3) |
| 0:55–1:35 | 2 | Diagnose + benchmark (5 notebooks) + LLM-as-judge lab + type analysis |
| 1:35–2:10 | 3 | Autoresearch groups (4 notebooks) + memory diagnostic |
| 2:10–3:00 | 4 | Cognitive Memory Layer — CML-lite build + diagnose (1 notebook) + discussion |
Prerequisites: Python 3.10+, 8 GB RAM, no GPU for Phases 1–2. Phase 3 uses Modal L4 (~$0.5–1/group). An OpenAI-compatible API key enables richer LLM demos in Phase 1 (offline fallbacks always available).
Timing & Pacing
| Phase | Execution | Speech (3s/cell) | Total |
|---|---|---|---|
| Phase 1 (8 notebooks) | 182s | 126s | 308s (5.1 min) |
| Phase 2 (5 notebooks) | 31s | 48s | 79s (1.3 min) |
| Phase 3 (4 notebooks) | 885s | 18s | 903s (15.1 min) |
| Phase 4 (1 notebook) | 1s | 15s | 16s (0.3 min) |
| Total | 1099s (18.3 min) | 207s | 1306s (21.8 min) |
For a 180-min session: 158 min spare for lecture, discussion, Q&A.
FAQ
Phase 1 LLM demos use an OpenAI-compatible endpoint. Without a key, offline heuristics. Phase 2 is fully offline. Phase 3 uses Modal (cloud GPU).
No for Phases 1-2. Phase 3 uses a cloud L4 via Modal (~$0.5-1/group, ~15 min).
No — tutorial-scale (40-86 questions). Full-scale needs complete datasets + Modal.
Yes — pip install -e source then from providers import build_provider. MIT-licensed.
Glossary
| Term | Meaning |
|---|---|
| RAG | Retrieving context from a memory store to augment an LLM's answer |
| LLM | Large Language Model (e.g. GPT, Claude, Llama) |
| TF-IDF | Lexical text similarity: matches by word overlap, not meaning |
| OOM | CUDA error when the GPU runs out of VRAM |
| val_bpb | Compression metric for language models (lower = better). Independent of vocabulary size. |
| VRAM | Memory on the GPU (e.g. 22 GB on an NVIDIA L4) |
| F1 | Harmonic mean of precision and recall. Balanced retrieval metric. |
| P | Of retrieved items, how many are relevant. High = few false positives. |
| R | Of relevant items, how many were retrieved. High = few misses. |
| CI | Automated testing on every code push (GitHub Actions) |
| CLI | Run tools from the terminal (e.g. diagnostic-framework diagnose) |
| GPU | Parallel processor for ML training. Phase 3 uses an NVIDIA L4 via Modal. |
| SDPA | PyTorch's built-in attention mechanism (replaces Hopper-only flash-attn-3) |
| dia_id | Dialogue turn ID in LoCoMo (identifies a specific turn in a conversation) |
| evidence_hit | Whether the system retrieved the gold evidence turn (an ID match) |
| memory_utilized | Whether the agent actually used the retrieved memory (a content match, independent of evidence_hit) |
| 3-arm reader | The contrastive utilization probe: tests no-context / oracle / provider conditions |
| provider | A memory architecture (verbatim, extracted_facts, episodic, hybrid) |
Authors & Credits
Tutorial Authors
| Name | Affiliation |
|---|---|
| Nur Arifin Akbar | Universitá degli Studi di Palermo, Italy |
| Rahool Dembani | Singularlogic, Athens, Greece |
| Gregorius Airlangga | Atma Jaya Catholic University of Indonesia |
| Ripto Mukti Wibowo | Atma Jaya Catholic University of Indonesia |
| Biagio Lenzitti | Universitá degli Studi di Palermo, Italy |
| Domenico Tegolo | Universitá degli Studi di Palermo, Italy |
Funded by the European Union's Horizon research and innovation programme under the Marie Skłodowska-Curie grant agreement No. 101073381.
Software & Data Attribution
- Phase 1 techniques adapted from Agent Memory Techniques by Nir Diamant
(GitHub, Apache-2.0);
see
licenses/APACHE-2.0.txt. The Phase 1 technique notebooks are self-contained adaptations. - Memory providers (verbatim, extracted_facts, episodic, hybrid) — original implementations inspired by techniques 06/10/09/13. MIT-licensed.
- Phase 4 cognitive-constraint provider ("CML-lite") — original pure-Python re-implementation of the key idea of the Cognitive Memory Layer (avinash-mall/CognitiveMemoryLayer). MIT-licensed; the reference system is neuro-inspired and is not vendored.
- LoCoMo — snap-research/locomo (research use).
- LongMemEval — xiaowu0162/longmemeval-cleaned (research use).
- MemoryArena — ZexueHe/memoryarena (research use).
- Autoresearch — Karpathy's nanochat-derived pretraining loop (our fork).
- CLI package (
memory-diagnostic-toolkit) — original, MIT. - All other code is original to the tutorial authors.