IESE AI Club

Memory
& RAG

What AI keeps, and how it finds the right page.

04
Rajas Bhagat
Where we are

Today: what the agent keeps and looks up.

The case

Your case: Pedala raises a €4M Series A

You are a summer associate at Fondo Norte.

Price sheet 2025superseded
Price sheet 2026current
Battery contractVoltCell
Customer surveyQ2 2026
Board minutes15 Sep 2026
Investor FAQlong, general

The data room. We open it after memory.

All fictional
The desk

The model only sees its desk.

The desk (context window) is small. The oldest pages fall off. After the chat, it is cleared.

The notebookPart 1 · Memory

Memory is the associate’s notebook

The desk is cleared after every chat. The notebook keeps what matters across chats.

MemoryPart 1 · Memory

Four kinds of memory

Skills from Thursday 02 are memory too: how we do things.

All fictional
Memory loopPart 1 · Memory

Write, store, recall, update or forget

Remember this: recall is a search. Part 2 is all about search.

Memory storesPart 1 · Memory

Where to keep the notebook

RisksPart 1 · Memory

Memory can go wrong

RuleAsk before you remember. Make forgetting easy.
Exercise 1Part 1 · Memory

Sort the memory cards

Cards →
NoteKnowledge base = documents to search later. That is Part 2.
All fictional
The data roomPart 2 · RAG

It has never seen this data room.

The notebook holds what we learned. The data room holds what others wrote.

Two waysPart 2 · RAG

Two ways to fill the desk

RuleSmall data room: put it all on. Big data room: bring the right pages.
RAG in one linePart 2 · RAG

RAG: from closed book to open book

Retrieval-augmented generation (RAG): look it up, then answer.

Before anyone asksPart 2 · RAG

Cut the files into labelled pages

Prepare the pages (indexing). It happens once, before any question.

All fictional
Meaning mapPart 2 · RAG

Similar ideas sit close together

Meaning map (embeddings): the question lands, and the nearest pages win (top-k).

Exercise 2Part 2 · RAG

Closed book, then open book

E1What does Pedala charge per month for the standard plan?
E2If Pedala ends the battery contract after six months, what does it cost?
E3Does Pedala own any patents?

Ask with no files.

Attach six files. Ask again.

Score: quote and file.

All fictional
Five stagesPart 2 · RAG

Five places RAG can go wrong

1 Indexing2 Pre-retrieval3 Retrieval4 Post-retrieval5 Generation

A bad cut loses the answer

Cut at the headings. Labels say which price sheet is current.

All fictional
1 Indexing2 Pre-retrieval3 Retrieval4 Post-retrieval5 Generation

Improve the question before you search

The contract never says “cancel”. Rewrite the question in its words (query rewrite).

1 Indexing2 Pre-retrieval3 Retrieval4 Post-retrieval5 Generation

Search by words and by meaning

Keyword search finds exact words. Meaning search finds ideas. Merge both (hybrid).

1 Indexing2 Pre-retrieval3 Retrieval4 Post-retrieval5 Generation

Pick the best pages for the desk

20 pages → best 3 (reranking) → only the useful lines (compression).

1 Indexing2 Pre-retrieval3 Retrieval4 Post-retrieval5 Generation

Answer only from the desk

Point to the page. “Not in the data room” is a correct answer.

Exercise 3Part 2 · RAG

Fix five questions in the RAG Lab

Pick a question.

Watch it fail.

Add one fix. It passes.

RAG Lab →
All fictional
AdvancedPart 3 · Together

RAG that checks its own work

Check the pages. If they are weak, search again.

Beyond RAGPart 3 · Together

From pages to a graph that learns

Step 4 is memory again: the notebook as a graph. Author’s view: Sosa (2025).

Context engineeringPart 3 · Together

Everything meets on one desk

Context engineering = deciding what goes on the desk, and what stays off it.

ClosePart 3 · Together

The desk is small.

Memory decides what we keep. RAG brings the right pages.

Next: Agent Orchestration, 5 Nov

Backuptechnique map

Five stages, every technique

StageQuestion it answersTechniquesLab
1 Indexing
prepare the pages
How do we cut, label and store files so each page can be found?Chunking (fixed, section, semantic, propositions) · chunk-size tests · contextual headers · Contextual Retrieval · metadata · question generation · hierarchical or graph indexL1, L2
2 Pre-retrieval
improve the question
How do we turn the question into a better search?Query rewrite · step-back · sub-questions · HyDE · routingL3
3 Retrieval
search
How do we find the candidate pages?Meaning search (dense) · keyword search (BM25) · hybrid with reciprocal rank fusion · metadata filter · top-k · small-to-bigL3
4 Post-retrieval
pick the best pages
Which pages go on the desk, in what order and size?Rerank · compression · relevant segment extraction · neighbour chunks · orderingL4
5 Generation
answer from the pages
How does the model answer from the desk?Context injection · cite and quote · abstain · support checkL5
Advanced
modular, agentic
When to retrieve, how to check, how to improve?Adaptive routing · Self-RAG · CRAG · agentic RAG · Graph RAG · feedback · RL · long context vs RAG · evaluation—
Backup

Big desk or good search?

PUT IT ALL ON · long context

Small, stable data room

  • Simple: nothing to build.
  • Anthropic: under about 200,000 tokens, put it all in the prompt.
  • With enough budget, long context beat RAG on average (Li et al. 2024).
BRING THE RIGHT PAGES · RAG

Big, changing or permissioned

  • RAG costs much less (Li et al. 2024).
  • Models use the middle of a long context less well (Liu et al. 2023, older models).
  • Many teams combine both (Self-Route).
BackupAnthropic, Sep 2024

Contextual Retrieval: fewer misses

Share of relevant pages missing from the top 20 (Anthropic’s own test sets).

Baseline5.7%
+ contextual embeddings3.7% · −35%
+ contextual BM252.9% · −49%
+ reranking1.9% · −67%
BackupGao et al. 2024

Where the stage names come from

NAIVE RAG

Indexing → Retrieval → Generation

The basic pipeline.

ADVANCED RAG

+ pre-retrieval, + post-retrieval

Improve the index and the question first. Rerank and compress after.

MODULAR RAG

Adaptive and agentic

Routing, checks, loops, retrieval as a tool.

Our choiceWe show Indexing as its own stage because it runs before anyone asks. Pre-retrieval = the question side.
Backup

How the RAG Lab works

DATA

The six Pedala files

Fictional. Built into the page. No network, no account.

SEARCH

A teaching simulation

Keyword scores plus a small synonym table that imitates meaning search.

VERDICT

What reached the desk

Evidence on the desk ✓ · evidence missing ✗ · correctly said “not in the data room” ✓.

Sourceschecked 29 October 2026

Sources · RAG and graphs

Technique catalogue adapted from all-rag-techniques by Fareed Khan (MIT licence), via github.com/Shubhamsaboo/all-rag-techniques. Ideas adapted; no code copied.

Sourceschecked 29 October 2026

Sources · Memory and products

1 / 12