Welcome to 6.S093!
Memory and RAG
January 23rd, 2026
Eduardo Baena / Konstantina Yaneva
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
About Me
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
The Dream
Imagine your ideal SM AI Agent that…
Image created with Nano Banana
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Objective: Reality
Image created with Nano Banana
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Why can’t we just retrain?
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Why can’t we just retrain?
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Context Engineering (CE)
CE is the deliberate design of everything that enters the LLM's context window to achieve desired behavior
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
RAG: A Context Engineering Technique
Retrieval-Augmented Generation (RAG) is one specific technique within CE
The analogy
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
RAG: A Context Engineering Technique
Retrieval-Augmented Generation (RAG) is one specific technique within CE
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
What is an Embedding?
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
What is an Embedding?
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Embedding Space
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Embedding Space
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
RAG: Simple breakdown
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
What is a Vector Database?
A vector database stores embeddings and enables similarity search
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
What is a Vector Database?
A vector database stores embeddings and enables similarity search
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Indexing: Why It Matters
Problem: Comparing query to ALL vectors is slow: O(n)
Solution: Indexing organizes vectors for faster search: O(log n)
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Indexing: Why It Matters
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Similarity Metrics: How to Compare?
Three main ways to measure (semantic) similarity
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Similarity Metrics: How to Compare?
Three main ways to measure (semantic) similarity
Start with cosine similarity it's the most common and works well for text.
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Metadata Filtering
Metadata allows filtering results by attributes:
Example query: Find ML posts with ≥50 likes from last month
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Hands On: Vector Database Options
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
The Complete RAG Pipeline
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Step 1: Setup Database and Store Documents
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Step 2: Index Documents
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Step 3: Search by Similarity
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Step 4: Build Prompt with Retrieved Context
This is the Augment step: injecting retrieved docs into the prompt
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Step 5: Generate with LLM
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Welcome to RAG World
BASIC RAG CONCEPTS THAT YOU SHOULD KNOW
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Chunking
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Chunking
Bad chunking example:
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Chunking Strategies
https://gustavo-espindola.medium.com/chunk-division-and-overlap-understanding-the-process-ade7eae1b2bd
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Chunking for Social Media Posts
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Precision and Recall: Trade-off
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Precision and Recall: When to Prioritize
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Keywords VS Embeddings
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Hybrid Search: Best of Both Worlds
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Hybrid Search: Best of Both Worlds
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
RAG vs Memory: What's the Difference?
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Memory Extension 1: Outcome-Aware Retrieval
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Memory Extension 2: Human-in-the-Loop (HITL)
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Memory Extension 3: Temporal Evolution
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
RAG Challenges
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
SoA: Infinite Context?
RLM @ MIT
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Key Takeaways
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Key Takeaways
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
RAG & Memory
Questions?
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club
Now: lunch break!
Sundai Club Team
January, 2025
Mini test for today's lecture.
Please fill in to get the attendance!��https://forms.gle/PAYNjtQUnm1Pbzxz8
MIT 6.S093 How to ship almost anything with AI
iap.sundai.club
sundai_club