Large Language Models (LLMs)

Transformers, attention, context windows, KV cache, training pipelines, and 10 curated deep-dive videos — everything to understand LLMs before building RAG or agents.

Learn order: TransformersPromptingFine-tuning basics → then move to RAG tab

Mental Model

An LLM is a next-token predictor built on stacked transformer blocks. At inference time it reads a prefix (your prompt + history), runs attention over all prior tokens, and samples one token at a time. “Understanding” an LLM means understanding tokenization → embeddings → attention → MLP → logits → sampling, plus how models are trained (pretrain → SFT → RLHF) and served (KV cache, context limits).

Text → Tokenize → Embed (+ position) → N × [Multi-Head Attention → MLP] → LayerNorm → Logits → Softmax → Sample next token → Append & repeat
Deep-learning path: Watch the 10 videos in order → read Transformers internals → code along with Karpathy → study context & KV cache → finish with expert courses.

Concepts you must internalize

  1. Tokenization — BPE/WordPiece; why “hello” ≠ one token; subword tradeoffs
  2. Embeddings — discrete tokens → continuous vectors; positional encoding (learned, RoPE)
  3. Self-attention — Q, K, V matrices; scaled dot-product; causal (masked) attention in GPT
  4. Decoder-only vs encoder-decoder — GPT-style (generation) vs T5/BERT-style (understanding)
  5. Context window — max tokens the model can attend to; lost-in-the-middle; truncation strategies
  6. KV cache — why generation is slow without it; memory grows with sequence length
  7. Training stack — pretraining (next-token on internet) → SFT (instructions) → RLHF/DPO (preferences)
  8. Inference — prefill (parallel) vs decode (sequential); temperature, top-p, stop tokens

1 10 Videos for Deep Understanding Watch in order

Curated for depth, not hype. Start with Karpathy’s 1-hour intro, build visual intuition with 3Blue1Brown, then code transformers yourself, and finish with university lectures from the people who invented the architecture.

#VideoLinkLengthWhat you'll learn
1 Intro to Large Language Models
Andrej Karpathy
YouTube ~1 hr Big-picture map: pretraining, fine-tuning, inference, hallucinations, tool use — best single starting point.
2 Transformers, the tech behind LLMs
3Blue1Brown — Ch. 5
YouTube ~27 min Visual data flow: token embeddings, attention blocks, unembedding — no code required.
3 Attention in transformers, step-by-step
3Blue1Brown — Ch. 6
YouTube ~28 min Q/K/V intuition, attention patterns, multi-head attention — the math made visual.
4 Let's build GPT: from scratch, in code
Andrej Karpathy
YouTube ~2 hrs Implement a mini-GPT in PyTorch line by line — attention, causal mask, training loop.
5 Deep Dive into LLMs like ChatGPT
Andrej Karpathy
YouTube ~3.5 hrs The masterclass: tokenization, pretraining data, SFT, RLHF, inference, system prompts, agents — end to end.
6 Let's reproduce GPT-2 (124M)
Andrej Karpathy
YouTube ~4 hrs Training at scale: data loading, distributed training, checkpointing — bridges toy GPT to real models.
7 RNNs, Transformers, and Attention
MIT 6.S191
YouTube ~1 hr Academic rigor: why attention replaced RNNs; transformer block anatomy. MIT
8 Large Language Models
MIT 6.S191 (2025) — Google
YouTube ~1 hr Modern LLM landscape: scaling, multimodal, safety — industry perspective. MIT
9 Transformers & LLMs — Lecture 1: Transformer
Stanford CME295
YouTube ~1.5 hrs Full Stanford course lecture: theory + illustrated cheatsheet; entire playlist on cme295.stanford.edu.
10 How I Learned to Stop Worrying and Love the Transformer
Ashish Vaswani — Stanford CS25
YouTube ~1.3 hrs From the co-author of “Attention Is All You Need” — motivations, evolution, open research directions.
Total watch time: ~18 hours. Spread over 2–3 weeks (1 video/day) while coding along with #4 and #6.

2 Free Courses Structured learning

CourseLinkTimeFocus
Neural Networks: Zero to Hero karpathy.ai/zero-to-hero ~20 hrs micrograd → makemore → nanoGPT — the coding path behind the Karpathy videos.
How Transformer LLMs Work DeepLearning.AI ~2 hrs Jay Alammar — tokenization, embeddings, attention, KV cache. Best visual intro.
Attention in Transformers (PyTorch) DeepLearning.AI ~2 hrs Code self-attention, masked attention, multi-head attention from scratch.
Generative AI with LLMs DeepLearning.AI + AWS ~12 hrs Full lifecycle: pre-training, fine-tuning, RLHF, deployment.
Stanford CS336 — Language Modeling from Scratch cs336.stanford.edu Full course Build and train GPT-style models from first principles. Expert
Stanford CME295 — Transformers & LLMs cme295.stanford.edu Full course Illustrated cheatsheet + recorded lectures; theory meets production.
Stanford CS25 — Transformers United web.stanford.edu/class/cs25 Seminar series Guest lectures from Vaswani, Karpathy, Kiela (RAG), Wei (chain-of-thought).
MIT 6.S191 — Intro to Deep Learning introtodeeplearning.com Full course Lecture 5: RNNs → Transformers → Attention. MIT
MIT 15.773 Hands-On Deep Learning MIT OCW Full course Lectures 6–8: embeddings, transformers, HuggingFace. MIT
Stanford CS224N web.stanford.edu/class/cs224n Full course NLP with deep learning — word vectors through LLMs and agents.
Fast.ai — Practical Deep Learning course.fast.ai Full course Top-down ML; Part 2 covers transformers and LLM fine-tuning.

3 Transformers — Deep Dive

The transformer is the core invention. Decoder-only GPT stacks L identical blocks; each block has (1) multi-head self-attention with causal mask, (2) feed-forward MLP, (3) residual connections + layer norm.

Input tokens → Embedding + Position → [Attention → Add&Norm → MLP → Add&Norm] × L → Final LayerNorm → Linear (vocab logits)

Must-read explainers

Key equations (know these cold)

Attention(Q,K,V) = softmax(QKT / √dk) · V
Causal mask: set future positions to −∞ before softmax
Multi-head: concat(head₁…headh) · WO

4 Context, Tokenization & KV Cache

“Context” is everything the model can attend to at once — your system prompt, chat history, and retrieved documents (in RAG). Context limits are hard (model architecture + memory); KV cache is how inference stays fast.

Tokenization

Context window & long-context research

KV cache (inference memory)

5 Training Pipeline — Pretrain → SFT → Alignment

A “chat model” is not just pretrained — it goes through multiple stages. Understanding this explains why base models hallucinate freely while ChatGPT refuses harmful requests.

Web crawl → Tokenize → Pretrain (next-token, ~trillions of tokens) → SFT (instruction pairs) → RLHF/DPO (human preferences) → Deploy
StageWhat happensKey resource
Pretraining Predict next token on massive text; learns grammar, facts, reasoning patterns. GPT-3 paper; Scaling Laws (Kaplan)
SFT Supervised fine-tuning on (instruction, response) pairs; teaches format and helpfulness. InstructGPT
RLHF / DPO Reward model + PPO, or direct preference optimization; aligns with human values. InstructGPT; DPO paper
Continued pretraining Domain adaptation on your corpus before SFT — for specialized vocab. HF — How to train

6 Foundational Papers Read after videos

PaperLinkWhy read it
Attention Is All You Need (2017) arxiv.org/abs/1706.03762 The original transformer. Encoder → BERT; Decoder → GPT. Read Section 3 carefully.
Improving Language Understanding by Generative Pre-Training (GPT-1) OpenAI PDF Decoder-only pretrain + task fine-tune — the GPT recipe.
Language Models are Unsupervised Multitask Learners (GPT-2) OpenAI PDF Zero-shot task transfer from scale alone.
Language Models are Few-Shot Learners (GPT-3) arxiv.org/abs/2005.14165 In-context learning — the foundation of prompting.
Scaling Laws for Neural Language Models arxiv.org/abs/2001.08361 Compute, data, parameters — why bigger models work predictably.
Training language models to follow instructions (InstructGPT) arxiv.org/abs/2203.02155 SFT + RLHF pipeline — birth of “chat” models.
LoRA: Low-Rank Adaptation arxiv.org/abs/2106.09685 Parameter-efficient fine-tuning — train adapters, not full weights.
Chain-of-Thought Prompting arxiv.org/abs/2201.11903 Why “think step by step” improves reasoning.

7 Build From Scratch Code along

Reading papers is not enough — implement attention yourself. These repos are ordered from smallest to largest.

ProjectLinkWhat you build
microgpt karpathy.github.io/microgpt ~200 lines, pure Python — full GPT algorithm in one file.
micrograd GitHub — karpathy/micrograd Autograd engine — understand backprop before transformers.
minGPT / nanoGPT GitHub — karpathy/nanoGPT Clean, minimal GPT training — the Karpathy video companion.
build-nanogpt GitHub — karpathy/build-nanogpt Step-by-step git history for reproducing GPT-2 (124M).
LLM from Scratch (Raschka book code) GitHub — rasbt/LLMs-from-scratch Chapter-by-chapter GPT + LoRA + classification heads.
Annotated Transformer (LabML) GitHub — labmlai Original “Attention Is All You Need” reimplemented with notes.
Stanford CS336 assignments GitHub — stanford-cs336 Train BPE tokenizer, implement transformer, run pretraining. Expert

8 Visual & Interactive Explainers

9 Inference & Serving

Production LLM apps are bounded by inference cost and latency. Two phases matter: prefill (process full prompt in parallel) and decode (generate one token at a time).

10 Prompting & Fine-tuning

11 Expert Track Go deep

After the 10 videos and a working nanoGPT, these resources take you to research-engineer level.

ResourceLinkWhy it's expert-level
Stanford CS336 — Language Modeling from Scratch cs336.stanford.edu Full stack: BPE tokenizer → transformer → distributed pretraining → eval harness.
Stanford CS25 — Transformers United CS25 recordings Seminars from Vaswani, Karpathy, Kiela (RAG), Hinton, Fan (agents).
Spinning Up in Deep RL (OpenAI) spinningup.openai.com Background for understanding RLHF reward modeling and PPO.
The Batch — Andrew Ng deeplearning.ai/the-batch Weekly research digest — stay current without reading every paper.
Papers With Code — Language Modelling paperswithcode.com SOTA benchmarks + linked implementations.
Sebastian Raschka — Ahead of AI magazine.sebastianraschka.com Deep technical articles: KV cache, MoE, quantization, new architectures.
Lilian Weng's Blog lilianweng.github.io Canonical surveys: transformers, RLHF, agents, diffusion.
Distill.pub (archive) distill.pub Beautiful interactive explanations of attention and representation learning.

12 Books & Long-form Guides

ResourceLinkLevel
Build a Large Language Model (From Scratch) Manning — Sebastian Raschka Best code-first book — pairs with Karpathy videos and CS336.
Hands-On Large Language Models O'Reilly — Alammar & Grootendorst Practical — embeddings, fine-tuning, RAG, evaluation.
Speech and Language Processing (Jurafsky & Martin) web.stanford.edu/~jurafsky/slp3 Free textbook — NLP foundations through transformers. Expert
Deep Learning (Goodfellow, Bengio, Courville) deeplearningbook.org Free — math foundations for backprop, optimization, regularization.
LLM Course (GitHub) mlabonne/llm-course Free curated roadmap: fundamentals → training → deployment.
Stanford CME295 Cheatsheet cme295.stanford.edu Illustrated reference — transformer variants, training, inference.

13 8-Week Deep Learning Plan

  1. Week 1 — Intuition: Videos #1–3 (Karpathy intro + 3Blue1Brown). Read Illustrated Transformer + Illustrated GPT-2.
  2. Week 2 — Code: Video #4 (build GPT). Complete micrograd + nanoGPT first training run.
  3. Week 3 — Depth: Video #5 (Karpathy deep dive). Read Attention paper + Scaling Laws.
  4. Week 4 — Scale: Video #6 (reproduce GPT-2). Start Raschka book Ch. 1–4 or CS336 assignment 1.
  5. Week 5 — University: Videos #7–8 (MIT 6.S191). CS224N lectures on transformers.
  6. Week 6 — Theory: Videos #9–10 (CME295 + Vaswani). Read InstructGPT + LoRA papers.
  7. Week 7 — Context & inference: KV cache coding article. Lilian Weng inference post. Experiment with tiktokenizer + vLLM.
  8. Week 8 — Apply: Switch to RAG tab. You now understand what the LLM is doing when you feed it retrieved context.
Next step: Once you can explain attention, KV cache, and the pretrain→SFT pipeline to a colleague, move to the RAG tab.

Retrieval-Augmented Generation (RAG)

Patterns, use cases, MIT expert track, interactive demos, and production evaluation — everything for mastering RAG.

How to Use This Guide

RAG is not one technique — it is a stack of decisions. Most production failures happen in retrieval and chunking, not in the LLM.

Suggested learning order: Foundations (1–2 days) → Build naive RAG (1 day) → Retrieval upgrades (3–5 days) → Evaluation (2 days) → Advanced architectures (as needed).

Impact order when tuning (highest leverage first)

  1. Better chunking / contextual retrieval
  2. Cross-encoder reranking
  3. Hybrid search (dense + BM25)
  4. Query transformation (multi-query, HyDE, rewrite)
  5. Swap embedding model
  6. Swap LLM (last resort)

Recommended production stack (2026 consensus)

Contextual chunks (optional) → Hybrid search (top 50) → Rerank (top 5–10) → LLM

Visual & Interactive Resources

See how RAG works — animated pipelines, live demos, 3D embedding maps, and videos with diagrams. Start here if you learn better by watching and clicking than by reading.

Visual-first learning path: Watch a 10-min video → step through RAG Visualized → explore How Does RAG Work → try a 3D embedding explorer (Unravel or Revelio).

Interactive demos Click & play

ResourceLinkWhat you see
RAG Visualized Start here zackproser.com/demos/rag-visualized Animated pipeline — Play or step through each stage; live Inspector shows data flow at every step.
RAG Playground rag-play.vercel.app Hands-on tabs: text splitting → vector embeddings → semantic search → context generation.
How Does RAG Work how-does-rag-work.vercel.app 4-step sidebar: query term analysis, similarity bar chart, source cards, augmentation. Hover words to see retrieval links.
Unravel (live demo) Unravel on Streamlit 5-step pipeline with 3D embedding map (UMAP), chunk explorer, and retrieval tuning.
Revelio GitHub — krxthx/revelio 3D embedding space, retrieval workbench (cosine vs MMR), exact prompt context sent to the LLM.
RAG Playground (PDF) playground.vercel.app Upload a PDF; split-screen highlights which chunks were retrieved with similarity scores.

Videos with diagrams Watch

ResourceLinkLengthStyle
What is RAG? Explained YouTube ~10 min Clear diagrams: retrieval layer → context assembly → generation.
Intro to RAG YouTube ~15 min Workflow diagrams; Volvo manual example (with vs without RAG).
RAG in 60 Seconds YouTube 1 min Quick animated mental model — great before diving deeper.
LangChain: Chat with Your Data DeepLearning.AI ~1.5 hrs Video lessons + code; chunking and retrieval shown live.

Articles with strong diagrams

Open-source visualizers (run locally)

ProjectLinkHighlight
RAG Visualizer GitHub — KHemanthRaju/RAG_Visualizer Web app + demo video: chunking, embeddings, cosine similarity scores.
RAGflow GitHub — sap156/RAGflow Animated step-by-step flow on each question (demo GIF in README).
Unravel GitHub — jvorndran/Unravel 3D UMAP embedding explorer + retrieval strategy comparison.
How Does RAG Work (source) GitHub — JessePeplinski/how-does-rag-work Next.js source for the live demo; similarity landscape + hover highlighting.

Which stage to explore where

Pipeline stageBest place to see it visually
Chunking RAG Playground — Text Splitting tab
Embeddings / vector space Unravel or Revelio — 3D map
Similarity search How Does RAG Work — similarity bar chart
Context → LLM RAG Visualized — Inspector panel
Which chunks were used RAG Playground (PDF) — document highlight view

1 Foundations

Start here. Understand what RAG is and why retrieval quality dominates answer quality.

ResourceWhy read it
Original RAG paper (Lewis et al., NeurIPS 2020) The source. Defines parametric + non-parametric memory, RAG-Sequence vs RAG-Token.
Meta Research — RAG publication page Same paper, easier to skim with a plain-language summary.
RAG: The Complete Guide (Medium) End-to-end overview: pipeline, hybrid search, reranking, evaluation, tech stack.
RAG Complete Guide 2026 (Huzaifa Tahir) Production-focused: chunking, metadata, hybrid search, deployment checklist.
Comet — RAG Developer's Guide Good bridge from the academic paper to modern LLM applications.
Key mental model: RAG does not permanently teach the model your data. It retrieves context at query time — so retrieval quality dominates answer quality.

2 Build Your First RAG

Hands-on courses and official tutorials. Build something before reading advanced patterns.

Free short courses Free

CourseInstructorTime
LangChain: Chat with Your Data Harrison Chase ~1.5 hrs
Building Agentic RAG with LlamaIndex Jerry Liu ~1 hr
JavaScript RAG Web Apps with LlamaIndex Laurie Voss ~1 hr
LangChain for LLM Application Development Harrison Chase & Andrew Ng ~1.5 hrs
Retrieval Augmented Generation (full course) Zain Hasan ~26 hrs
12 Best RAG Courses in 2026 (Class Central) Curated list Reference

Official docs & tutorials

3 Core Components

Chunking, embeddings, and vector stores — the decisions that matter most.

3A — Chunking

Rule of thumb: Start with 512 tokens, ~10–20% overlap. Tune only after you have evaluation metrics.
Chunking strategyWhen to use
Recursive character splitDefault for most documents
Markdown / header splitDocs with clear headings (wikis, READMEs)
Parent–childPrecise retrieval but need full paragraph context
Semantic chunkingUnstructured prose where fixed size breaks meaning
Contextual retrievalChunks lose document context when embedded alone

3B — Embeddings

ModelWhen to use
text-embedding-3-small / large (OpenAI)Fast to ship, good general English
voyage-3-largeStrong for Claude / Anthropic stacks
bge-large / e5 / nomic-embedSelf-hosted, cost-sensitive
voyage-code-3Code search RAG
Important: MTEB is a starting point only. Always validate on your corpus with 50–200 labeled Q&A pairs.

3C — Vector databases

DatabaseWhen to use
pgvectorAlready on Postgres, <5–10M vectors, need SQL + vectors together
QdrantFast filtered search, self-host, open source
PineconeZero ops, ship fast, large scale, managed SaaS budget
ChromaLocal dev and prototypes
Weaviate / MilvusLarge-scale hybrid search, enterprise deployments

4 Retrieval Patterns

The core of advanced RAG — when to use each pattern and where to learn it.

Pattern decision matrix

Pattern Problem it solves When to use Complexity
Naive RAG Baseline Prototype only Low
Hybrid search (dense + BM25 + RRF) Misses exact terms (SKUs, names, codes) Default for production Medium
Reranking (cross-encoder) Top-k has noise Almost always after hybrid Medium
Multi-query Vague or multi-faceted queries Low recall, exploratory Q&A Medium
HyDE Query–document vocabulary mismatch Short queries vs technical corpus Medium
Query rewriting Conversational follow-ups Chatbots with history Medium
Contextual retrieval Orphaned chunks without doc context Long docs, reports, policies Med–High
Parent–child retrieval Small chunks retrieve, large chunks context PDFs, legal, technical docs Medium
Contextual compression Too many tokens in context Long retrieved documents Medium
MMR Redundant similar chunks Need diverse sources Low
Metadata filtering Multi-tenant, dates, doc types SaaS, permissions, time-sensitive data Low–Med
GraphRAG Multi-hop reasoning, corpus themes Research, investigations, entity-heavy domains High
Self-RAG Model decides if to retrieve Agentic systems, uncertain queries High
Agentic RAG Dynamic retrieve-or-answer Agents, tool-using assistants High

Best resources per pattern

Pattern / topicResource
All 12 advanced techniques Atlan — 12 Advanced RAG Techniques
Hybrid search + reranking Canonical — Hybrid Search and Reranking
Hands-on code tutorial RubyHalib — Advanced RAG Tutorial
Query transformations LangChain Blog — Query Transformations
Recall vs precision (rewrite + rerank) Jatin Bansal — Query Transformations
Contextual retrieval (49% → 67% failure reduction) Anthropic — Contextual Retrieval
GraphRAG (official) Microsoft GraphRAG (GitHub)
GraphRAG explainer Medium — GraphRAG Complete Guide
Agentic RAG tutorial LangGraph — Agentic RAG
Agentic RAG notebook GitHub — langgraph_agentic_rag.ipynb
Adaptive RAG (local) LangGraph — Adaptive RAG tutorial

5 Evaluation & Production

Measure retrieval and generation separately. Build a golden set from real logs.

Evaluation frameworks

ToolLinkBest for
RAGAS docs.ragas.io Faithfulness, context precision/recall, answer relevance
RAGAS quickstart RAGAS Quick Start Get running in minutes
RAGAS metrics RAGAS Metrics Overview Understanding each metric
DeepEval docs.confident-ai.com Pytest-style CI/CD gates
Tool comparison Braintrust — Best RAG Eval Tools 2026 Production traces → eval datasets

Production evaluation guides

Key metrics

MetricLayerWhat it catches
Context recall Retrieval Right doc never retrieved (~60% of prod failures)
Context precision Retrieval Too much irrelevant context
Faithfulness Generation Hallucination beyond retrieved context
Answer relevance Generation Answer doesn't address the question
Citation accuracy End-to-end Wrong source attribution
Golden rule: Build a 100–300 question golden set from real production logs, not synthetic-only data. Re-run on every chunking, embedding, or reranker change.

6 Use-Case Playbooks

Pick the right pattern for your scenario before over-engineering.

Use caseRecommended approachStart with
Internal docs Q&A Hybrid + rerank + metadata filters LangChain Chat with Your Data
Customer support Hybrid + rerank + query rewrite for chat history Agentic RAG (LangGraph)
Code search voyage-code-3 + hybrid (semantic + keyword on symbols) Pinecone embedding guide
Legal / compliance Parent–child + citations + faithfulness eval Contextual retrieval + RAGAS
Research / corpus themes GraphRAG or RAPTOR Microsoft GraphRAG
Multi-modal (PDFs + images) Multi-modal RAG index LlamaIndex Multimodal Cookbook
Low-latency chat pgvector + small embedder + rerank top-5 Convly local stack guide
Enterprise permissions Metadata pre-filtering + pgvector or Qdrant Vector DB filtered search guide

? RAG vs Alternatives

Know when RAG is the right tool — and when it isn't.

ApproachUse when
RAG Knowledge changes often, need citations, proprietary data, no fine-tuning budget
Fine-tuning Style/format control, domain language, task-specific behavior (not facts)
Long context only Small corpus that fits reliably in the context window
GraphRAG Relationship-heavy data, multi-hop questions, corpus-wide themes
Tool / API agents Live data (CRM, DB, APIs) — connect as tools, not a vector index

4 4-Week Learning Plan

A practical schedule with a deliverable each week.

WeekFocusDeliverable
Week 1 Foundations + naive RAG Working chatbot over your own PDFs
Week 2 Hybrid search + reranking Measurable recall improvement vs baseline
Week 3 Evaluation with RAGAS Golden set of 50+ questions + baseline scores
Week 4 One advanced pattern Contextual retrieval or agentic RAG for your use case

Expert Track — MIT & Deep Foundations

Go beyond tutorials: understand retrieval theory, read the papers that shaped modern RAG, and study how MIT teaches and builds production RAG systems. Rigorous, not academic for its own sake.

Expert path (recommended order): IR fundamentals (Manning Ch. 6, 11) → DPR paper → RAG paper → MIT 15.773 Lecture 9–10 → Stanford CS224N RAG slides → Systematic literature review → Self-RAG / CRAG → build with Archi or your own stack + RAGAS.

MIT — courses & lectures MIT

ResourceLinkWhy it matters for experts
15.773 Hands-On Deep Learning (full course) MIT OCW — 15.773 Free graduate course. Lectures 6–10 cover embeddings → transformers → LLMs → RAG → LoRA fine-tuning.
Lecture 9 video: LLMs & RAG (1h 14m) MIT Learn — Lecture 9 Full lecture on next-word prediction, prompting, and retrieval-augmented generation.
Lecture 10 slides: RAG + LoRA Lecture 10 PDF RAG vs fine-tuning, when you can't fit data in context, Colab notebook linked.
RAG Colab notebook Assignments — Colab: RAG (Lecture 10) Hands-on: HODL-SP24-Section-A-Lec-10-Retrieval-Augmented-Generation. Build it yourself.
6.5830 Database Systems — Lec 17 Embeddings, RAG, and Vector DBs (PDF) CSAIL depth: word2vec → RAG architecture → vector DB internals (HNSW, NSW indexing). The systems layer most RAG blogs skip.
6.5830 course schedule MIT 6.5830 Schedule Full database systems curriculum; Lecture 17 is the RAG/vector DB week.
Archi (A2rchi) — MIT RAG framework GitHub — archi-physics/archi Production RAG built at MIT (SubMIT, courses 8.01/8.511, CSAIL). Study real architecture, not toy demos.
Archi documentation archi-physics.github.io/archi Ingestion pipelines, Piazza integration, deployment patterns for academic/research RAG.
MIT ORCD — Run your own RAG ORCD Docs — RAG recipe Practical guide: vector store from PDFs/Markdown, HuggingFace LLMs, cluster deployment.
MIT GenAI — A2rchi overview genai.mit.edu — A2rchi Research context: why MIT built open-source RAG for courses and research support.
CSAIL talk: Search for LLM workloads Chroma CTO at MIT CSAIL Hybrid search architecture, context rot research, how retrieval systems should be designed for LLMs.
MIT xPRO — RAG & Context Engineering Paid MIT xPRO program 8-week professional program: hybrid retrieval, multihop pipelines, production eval, capstone. Optional if you want structured credential.

Information retrieval foundations Prerequisite

RAG experts understand why BM25 still matters and how vector search relates to classical IR. Don't skip this.

Paper reading ladder Core papers

Read in this order. Each paper builds on the last. Skip surveys until you've read at least the first four.

#PaperLinkWhat you'll learn
1 DPR — Dense Passage Retrieval arxiv.org/abs/2004.04906 Bi-encoder retrieval, dual-encoder training — the foundation under every vector DB query.
2 RAG — Lewis et al. (NeurIPS 2020) arxiv.org/abs/2005.11401 Parametric + non-parametric memory, RAG-Sequence vs RAG-Token.
3 REALM — Retrieval-augmented pre-training arxiv.org/abs/2002.08909 Training the retriever end-to-end; async re-indexing during training.
4 FiD — Fusion-in-Decoder arxiv.org/abs/2007.01282 How to feed many retrieved passages into the generator efficiently.
5 Self-RAG arxiv.org/abs/2310.11511 Reflection tokens: when to retrieve, grade passages, critique output.
6 CRAG — Corrective RAG arxiv.org/abs/2401.15884 Evaluate retrieved docs; web fallback when retrieval quality is low.
7 RAPTOR — Tree-organized retrieval arxiv.org/pdf/2401.18059 Hierarchical summarization for thematic / multi-level retrieval.
8 GraphRAG — Microsoft arxiv.org/abs/2404.16130 Knowledge graphs + community summaries for corpus-wide questions.

Paper guides & reading lists

12-week expert curriculum

WeeksFocusResourcesDeliverable
1–2 IR foundations Manning IR book Ch. 6, 8, 11 Implement BM25 + explain precision/recall on a toy corpus
3 Dense retrieval DPR paper + facebookresearch/DPR Embed + retrieve with a bi-encoder; measure Recall@k
4 Canonical RAG RAG paper + MIT 15.773 Lecture 9–10 + Colab End-to-end RAG with citations
5 Systems layer MIT 6.5830 Lec 17 + vector DB guide Explain HNSW vs brute-force; tune pgvector/Qdrant
6 Hybrid + rerank Canonical blog + hands-on tutorial Hybrid pipeline with measured precision lift
7 Advanced patterns Self-RAG + CRAG papers Implement document grading loop (LangGraph)
8 Evaluation discipline RAGAS + Respan production eval guide Golden set 100+ Qs; separate retrieval vs generation metrics
9 Production RAG Study Archi source + ORCD recipe Deploy RAG with observability and metadata filters
10 Structured retrieval GraphRAG paper + Microsoft repo GraphRAG on a small corpus; compare vs flat RAG
11 Field survey Systematic review (128 papers) + PKU survey Written taxonomy: which pattern for which failure mode
12 Capstone Your domain corpus Production RAG with eval CI gate, hybrid + rerank, documented architecture
What separates an expert from a tutorial-follower: You can diagnose whether a failure is retrieval (Recall@k) or generation (faithfulness), explain why hybrid beats dense-only on SKU/name queries, and choose patterns based on failure mode — not because a blog post said "use GraphRAG."

Top 10 Links

If you only bookmark ten resources, make it these.

Building AI Agents

Production-grade agents: ReAct loops, LangChain DAGs, LangGraph state machines, MCP tools, memory, evaluation, and observability — curated for deep conceptual understanding.

Learn order: LLMs tabAgent mental modelLangChain + LangGraphProduction patternsObservabilityAgentic RAG tab

Mental Model — Agents vs Workflows

Anthropic draws a critical distinction: a workflow is a predefined code path (DAG); an agent lets the LLM dynamically decide which tools to call and when to stop. Production systems usually blend both — deterministic steps where reliability matters, agentic loops where flexibility matters.

User goal → [Planner/Router] → LLM reasons → Tool call → Observation → Update state → … → Final answer (or human approval)

The 5 building blocks (CoALA framework)

  1. LLM (brain) — reasoning, planning, tool selection
  2. Tools (hands) — APIs, DB queries, search, code execution, MCP servers
  3. Memory — working (context window) + long-term (vector store, LangGraph Store)
  4. Orchestration — LangChain chains (linear DAG) or LangGraph StateGraph (cyclic state machine)
  5. Observability + eval — traces, trajectory scoring, regression datasets (non-optional in production)

1 15 Conceptual Videos Theory, not tutorials

Lectures, keynotes, and architecture deep-dives — not step-by-step coding walkthroughs. Watch in rough order.

#VideoLinkLengthWhat you'll learn
1 Learn to Build Effective Agentic AI Systems
Andrew Ng
YouTube ~15 min 4 agentic design patterns in raw Python; why disciplined error analysis (evals) is the #1 success predictor.
2 Stanford CS230 — Agents, Prompts & RAG
Kian Katanforoosh
YouTube ~1.5 hrs Full university lecture: agent components (prompts, memory, tools), agentic workflows, MCP, multi-agent, RAG bridge.
3 Language Agents: From Reasoning to Acting
Shunyu Yao + Harrison Chase
YouTube ~1 hr ReAct author + LangGraph creator discuss ReAct, Reflexion, CoALA, and the future of language agents.
4 Keynote — The Second Half (AI Agents)
Shunyu Yao [OpenAI]
YouTube ~25 min Why agents work now: language prior + reasoning as action space + RL; test-time scaling and operator models.
5 Anthropic's Blueprint for Building Effective Agents
Blog walkthrough
YouTube ~30 min Workflows vs agents, prompt chaining, routing, parallelization, orchestrator-workers, evaluator-optimizer.
6 LLM Chronicles — ReAct (Reason + Act)
Research breakdown
YouTube ~20 min Thought → Action → Observation loop; why the agent executor parses LLM output; reasoning traces in context.
7 ReAct Agent Explained Simply
Conceptual overview
YouTube ~15 min When ReAct helps vs overkill; tools as "hands," LLM as "brain," prompt template structure.
8 LangChain vs LangGraph — A Tale of Two Frameworks YouTube ~12 min DAG (linear chains) vs cyclic graphs; state management; when each framework fits.
9 Introduction to LangGraph (Course Launch)
Harrison Chase
YouTube ~8 min Why LangGraph exists: precision, control, HITL, memory — production agent runtime philosophy.
10 What's Next for AI Agents
Harrison Chase @ Sequoia AI Ascent
YouTube ~15 min Planning, UX, and memory as the three frontiers for production-ready agents.
11 Enterprise Agents & Observability
Harrison Chase interview
YouTube ~45 min Why traces are the foundation of reliable agents; LangSmith insights, regression testing, debug mode.
12 MIT 6.S191 — LLMs (ReAct section)
Google Research
YouTube ~1 hr ReAct vs chain-of-thought vs act-only; why interleaving reasoning and action prevents loops.
13 How to Build AI Agents (Stanford)
Kian Katanforoosh
YouTube ~1.5 hrs Working vs archival memory, tool design, agentic workflow design for production.
14 Multi-Agent Architectures (Conceptual Guide)
LangChain team
YouTube ~15 min Supervisor, hierarchical teams, shared state keys, message-list communication patterns.
15 AutoGen — Complex Tasks via Multi-Agent Workflows
Microsoft Research
YouTube ~30 min Task ledger, agent specialization, inner progress loop — multi-agent from first principles.
Total: ~8–10 hours. Pair with the CoALA paper and Building LangGraph blog post.

2 Free Courses & Structured Learning Hands-on after theory

CourseLinkTimeFocus
Agentic AI DeepLearning.AI — Andrew Ng ~5 hrs 4 patterns in raw Python: reflection, tool use, planning, multi-agent. Eval-driven development.
AI Agents in LangGraph DeepLearning.AI ~1.5 hrs Scratch agent → LangGraph rebuild. Persistence, HITL, agentic search.
LangChain Academy — Intro to LangGraph LangChain Academy ~6 hrs State, memory, HITL, deployment — official production-focused course.
Hugging Face Agents Course hf.co/learn/agents-course ~10 hrs smolagents, LangGraph, LlamaIndex — full curriculum with certification.
Functions, Tools and Agents with LangChain DeepLearning.AI ~1.5 hrs Tool binding, OpenAI function calling, agent executor loops.
Multi AI Agent Systems with crewAI DeepLearning.AI ~2 hrs Role-based multi-agent delegation — contrast with LangGraph supervisor pattern.
Building Agentic RAG with LlamaIndex DeepLearning.AI ~1 hr Bridges agents + RAG — prerequisite for Agentic RAG tab.
Stanford CS224G — Generative AI Agents web.stanford.edu/class/cs224g Full course Lecture 7: Agent Orchestration & Workflow Design (LangGraph vs CrewAI, MCP, state).

3 Agent Architecture — CoALA & Components

The CoALA (Cognitive Architectures for Language Agents) framework organizes every agent into memory, action space, and decision-making cycles.

Planning phase (reason + retrieve) → Execution phase (tool call / write memory) → Observe → Repeat
ComponentWhat it doesDeep resource
Planning CoT, ReAct, Tree-of-Thoughts, plan-and-execute Lilian Weng survey
Memory Working (context) + long-term (vector store, graph, LangGraph Store) LangChain Memory concepts
Tool use Function calling, structured outputs, tool schemas OpenAI Function Calling guide
Reflection Self-critique and retry (Reflexion pattern) Reflexion paper
Multi-agent Supervisor, hierarchical teams, peer handoffs LangGraph Multi-Agent blog

4 LangChain vs LangGraph — DAG vs State Machine

LangChain orchestrates linear pipelines (DAG): prompt | model | parser — great for RAG, summarization, fixed flows. LangGraph compiles a cyclic state machine: nodes mutate shared state, edges route conditionally, loops are native.

DimensionLangChain (LCEL / chains)LangGraph (StateGraph)
Execution modelDirected acyclic graph (DAG) — forward onlyCyclic state machine — loops, branches, retries
StateImplicit between stepsExplicit TypedDict/Pydantic, checkpointed to DB
Human-in-the-loopManual workaroundNative interrupt() + resume
Multi-agentPossible but awkwardNodes as agents, supervisor routing, subgraphs
Production fitSimple RAG, classification, ETLTool agents, long-running workflows, compliance gates

5 Core Agentic Patterns

PatternHow it worksWhen to useResource
ReAct Interleaved Thought → Action → Observation loop Dynamic tool use, QA with search ReAct paper
Plan-and-Execute Planner creates steps; executor runs them Predictable multi-step tasks, lower cost LangChain Planning Agents
Routing Classifier picks which sub-agent or tool chain to run Multi-domain support bots Anthropic Agents Cookbook
Prompt chaining Output of step N → input of step N+1 Fixed pipelines (translate → summarize) Anthropic workflows
Orchestrator-workers Central LLM delegates subtasks to workers Parallel research, multi-perspective analysis Claude Cookbook
Evaluator-optimizer Generator + critic loop until quality threshold Writing, code generation, translation Anthropic Cookbook
Reflexion Agent critiques own output, retries with memory Tasks with verifiable feedback Reflexion paper
Supervisor (multi-agent) Router delegates to specialist sub-agents Complex workflows with role separation LangGraph Supervisor tutorial
StateGraph Nodes + conditional edges + shared state + reducers Production agents needing control + durability LangGraph Graph API
Human-in-the-loop interrupt() pauses graph; human approves/edits; resume Irreversible actions, compliance, billing LangGraph Interrupts

6 LangGraph Deep Dive — Production Concepts

LangGraph is a state machine compiler. You define typed state, nodes (functions), edges (routing), and a checkpointer (persistence).

StateGraph → add_node() → add_edge() / add_conditional_edges() → compile(checkpointer=…) → invoke(thread_id=…)

Core concepts

ConceptWhat it meansDocs
State schema TypedDict/Pydantic — every node reads/writes named channels State
Reducers add_messages merges message lists; custom reducers for lists/dicts Reducers
Checkpointing Serialize state after every node — resume, time-travel, HITL Persistence
thread_id Unique ID per conversation/run — required for multi-tenant production Threads
Subgraphs Nested StateGraphs — hierarchical multi-agent teams Subgraphs
Command Node returns Command(goto=…, update=…) for dynamic routing Command
Store Long-term memory across threads (user profiles, facts) Store
recursion_limit Hard cap on loop iterations — always set in production Recursion limit

Production checklist

7 Tools, Function Calling & MCP

Tools extend the LLM beyond text. Modern stacks use OpenAI-style function calling or the Model Context Protocol (MCP) for standardized tool discovery.

LayerWhat it isResource
Function calling LLM outputs structured JSON → runtime executes function OpenAI guide
LangChain tools @tool decorator, bind_tools(), ToolNode LangChain Tools
MCP Open protocol: Host → Client → Server (tools, resources, prompts) MCP Architecture
A2A Agent-to-Agent protocol (Google) for inter-agent communication A2A spec
Tool design Good schemas = reliable agents; return structured errors Anthropic Tool Use

8 Agent Memory & State

9 Agent Observability Production critical

Agents are non-deterministic. You cannot debug them with print statements — you need traces (full execution trees), spans per node/tool call, and trajectory evaluation (did the agent take the right steps?).

Industry standard: OpenTelemetry (OTel) GenAI semantic conventions — instrument once, send traces to LangSmith, Langfuse, Phoenix, or Datadog.

Observability platforms

PlatformTypeBest forLink
LangSmith Managed (LangChain-native) LangGraph teams — graph traces, Studio debugger, multi-turn evals docs.langchain.com/langsmith
Langfuse Open-source / cloud Self-hosted, OTel-native, cost dashboards, agent graph viz langfuse.com/docs
Arize Phoenix Open-source (ELv2) OTLP-native tracing, embeddings viz, eval harness docs.arize.com/phoenix
Braintrust Managed Experiment-driven evals, CI/CD for agents, scorer library braintrust.dev/docs
MLflow Tracing Open-source (Apache 2.0) Full MLOps lifecycle, 60+ framework integrations via OTel mlflow.org/tracing
Helicone Proxy gateway Zero-code cost/latency tracking across 300+ models docs.helicone.ai
Datadog LLM Observability Enterprise APM Teams already on Datadog — unified infra + LLM traces Datadog LLM Obs

Deep guides

10 Agent Evaluation & Safety

Production agents need offline evals (regression datasets) and online evals (sampled production traffic) — especially multi-turn trajectory scoring.

Safety & guardrails

11 Foundational Papers

PaperLinkWhy read it
ReAct arxiv.org/abs/2210.03629 The agent loop foundation — reasoning + acting interleaved.
CoALA arxiv.org/abs/2309.02427 Taxonomy for all language agents — memory, action, decision-making.
Reflexion arxiv.org/abs/2303.11366 Verbal reinforcement learning — agent learns from self-critique.
Toolformer arxiv.org/abs/2302.04761 LLMs learn to call APIs via self-supervised annotation.
Tree of Thoughts arxiv.org/abs/2305.10601 Search over reasoning paths — planning at inference time.
Generative Agents arxiv.org/abs/2304.03442 Memory + planning + reflection for believable agent behavior.
MRKL Systems arxiv.org/abs/2205.00445 Modular neuro-symbolic routing to expert modules.

12 Framework Comparison

FrameworkModelProduction fitLink
LangGraph Explicit state machine (graph) Best for compliance, HITL, audit trails, long-running agents GitHub
LangChain LCEL chains (DAG) + agent executors Component library, simple agents, RAG pipelines GitHub
CrewAI Role-based agent teams Fast multi-agent prototypes; less control than LangGraph docs.crewai.com
AutoGen (Microsoft) Conversation-based multi-agent Research, group chat agents, task ledgers microsoft.github.io/autogen
OpenAI Agents SDK Handoffs + guardrails OpenAI-native agents with built-in tracing OpenAI Agents SDK
smolagents (HF) Minimal code-first agents Learning and lightweight agents; code-as-action HF smolagents
Google ADK Workflow graphs + agents Google Cloud / Gemini ecosystem ADK docs

13 Hands-on Repos & References

14 When to Use What

ApproachUse whenAvoid when
Simple chain / LCELFixed pipeline, predictable I/O, low latencyNeed loops, dynamic tool selection
ReAct agent (LangGraph)Dynamic tool use, open-ended queriesEvery step must be auditable/deterministic
Workflow (Anthropic patterns)Known steps with optional LLM at each nodeTruly unpredictable user intent
Multi-agent supervisorSpecialized roles, complex branchingSimple single-tool tasks (overkill)
Agentic RAGLLM decides if/when to retrieveAll queries need same retrieval (use 2-step RAG)
Rule of thumb (Anthropic): Start with the simplest solution. Add agentic behavior only when simpler workflows fail your evals.

15 8-Week Production Agent Learning Plan

WeekFocusDeliverable
1Mental model + videos #1–5Read Anthropic + Lilian Weng; explain workflow vs agent to a colleague
2ReAct + function callingAgent with 3+ tools; trace every step in LangSmith
3LangChain LCEL chainsLinear RAG/summarization pipeline (DAG mental model)
4LangGraph StateGraphReAct agent with conditional edges + add_messages reducer
5Persistence + HITLPostgres checkpointer + interrupt before irreversible actions
6MCP + tool designConnect agent to 1 MCP server; structured error handling
7Observability + evalsLangfuse/LangSmith: trajectory evals, failure → regression dataset
8Multi-agent or production deploySupervisor pattern OR LangSmith deployment → move to Agentic RAG tab

Agentic RAG — Frontier & Production

Beyond 2-step RAG: agent-controlled retrieval, multihop reasoning, GraphRAG, multimodal docs, massive corpora, scaling DevOps, and rigorous evaluation — architecture-first.

Prerequisites: LLMs + RAG tab (phases 1–5) + AI Agents tab → then build agentic loops on top of solid retrieval

Evolution: Naive → Advanced → Agentic RAG

Naive RAG always retrieves top-k and generates. Advanced RAG adds hybrid search, reranking, contextual chunks, query transforms. Agentic RAG puts an LLM (or LangGraph state machine) in control: decide whether to retrieve, which tool/index to query, when to rewrite, and when to stop.

Query → [Router/Agent] → Retrieve | Rewrite | Web | SQL | Graph traverse → Grade → Reflect → (loop) → Generate → Faithfulness check
2-Step RAGAgentic RAG
Control flowFixed DAG — always retrieve → generateCyclic graph — LLM/agent routes dynamically
RetrievalSingle top-k passMulti-hop, multi-index, optional skip
Self-correctionNoneCRAG / Self-RAG grading loops
Latency & costLow2–5× LLM calls
Best forDocs Q&A, support botsMultihop research, mixed sources, high-stakes accuracy
Golden rule: Fix Recall@k and chunking in the RAG tab first. Agentic loops amplify bad retrieval — they don't fix it. ~80% of production systems still run optimized 2-step RAG; add agentic layers only when evals prove you need them.

1 RAG Frontier — 2025–2026 Patterns Architecture map

The field moved from "better embeddings" to orchestrated retrieval strategies. Use this table to pick patterns by query type — not hype.

PatternCore ideaQuery typeDeep resource
Agentic RAG Retriever as tool; agent decides when/how Mixed intent, tool selection Agentic RAG Survey (2025)
Self-RAG Reflection tokens: retrieve? relevant? supported? High-stakes factual QA Self-RAG paper
CRAG Grade docs; web search fallback on low relevance Stale internal KB + live web CRAG paper
Adaptive RAG Route by complexity: skip / vector / web / agent Diverse query mix (cost optimization) LangGraph Adaptive RAG
GraphRAG KG + community summaries; global/local search "What are the main themes?" corpus-wide Microsoft GraphRAG
RAPTOR Recursive clustering → tree retrieval Long docs needing hierarchical context RAPTOR paper
Contextual Retrieval Prepend chunk context before embedding All production corpora (Anthropic −49% failures) Anthropic research
ColPali / Vision RAG Page-as-image embeddings; no OCR pipeline Infographics, tables, slide decks, scans Microsoft ColPali RAG
PageIndex Vectorless tree navigation over document TOC Long structured PDFs (financial, legal) PageIndex intro
Agentic GraphRAG Agent picks vector vs graph traversal vs Cypher Relational + multi-hop entity queries Memgraph Agentic GraphRAG
HyDE Generate hypothetical answer → embed → retrieve similar real docs Low-recall queries with vocabulary mismatch HyDE paper
RRF hybrid fusion Merge BM25 + dense rankings without score normalization Production hybrid search baseline OpenSearch RRF

2 Agentic RAG Pattern Deep Dive

PatternArchitectureLangGraph nodesResource
Canonical Agentic RAG generate_query_or_respond → retrieve → grade → rewrite loop 5-node StateGraph LangGraph docs
CRAG Retriever → relevance grader → [generate | web search] Conditional edge on doc score CRAG tutorial
Self-RAG Retrieve decision → grade relevance → grade support → generate Multiple grader nodes Self-RAG tutorial
Adaptive RAG Query classifier → vectorstore | web | no-retrieval Router node first Adaptive RAG tutorial
Modular RAG Swappable retrieval modules per query type Subgraphs per module Modular RAG survey
Hybrid future Self-RAG reflection + agentic planning + CRAG correction Composable subgraphs Anthropic patterns

3 Multihop & Query Decomposition

Multihop queries need sequential retrieval — step 2's documents depend on step 1's answer. Single-pass top-k retrieval is structurally insufficient for questions like "Compare revenue of companies founded in the same city as X."

Complex query → Decompose sub-queries → Retrieve hop 1 → Accumulate context → Retrieve hop 2 → … → Synthesize answer
TechniqueHow it worksWhen to useResource
IRCoT Each CoT sentence becomes next retrieval query Research QA, HotpotQA-style IRCoT paper · code
Self-Ask LLM generates follow-up questions before answering Composable with any retriever Self-Ask paper
Query decomposition Planner splits query → parallel sub-retrievals → merge Compare/contrast, multi-entity LlamaIndex Agentic RAG
AtomRAG Atomic requirements → plan-then-retrieve for vector DBs Structured multihop over unstructured data AtomRAG paper
IRCoT-style agent loop LangGraph: retrieve → reflect → rewrite → repeat Production agentic multihop Production RAG Agent Platform (paper)

4 Production Agentic RAG Architecture (LangGraph)

The canonical 5-node graph — implement this before exotic variants. Add checkpointing, recursion limits, and faithfulness verification for production.

  1. generate_query_or_respond — LLM with retriever tool; decides retrieve or answer directly
  2. retrieve — hybrid search (BM25 + dense) → rerank top 5–10
  3. grade_documents — LLM relevance grader; route to rewrite or generate
  4. rewrite_question — reformulate query if docs irrelevant (max N retries)
  5. generate_answer — grounded generation + optional faithfulness check

Production extensions

5 Multimodal RAG — Infographics, Tables & Visual Docs

Text-only RAG loses layout, charts, and table structure. Three architectures dominate for visual-heavy corpora in 2026.

ArchitecturePipelineBest forTradeoff
Caption-and-index VLM captions images → embed captions as text Simple image search Loses spatial layout detail
Unified multimodal embeddings Cohere Embed v4, Voyage-multimodal, Gemini embeddings Mixed text+image corpora at scale Weaker on hardest visual reasoning
ColPali / page-as-image Render PDF page → vision encoder → multi-vector MaxSim Infographics, financial reports, slide decks 100–1000× more vectors per page

6 Massive Corpora & Document Ingestion

Agentic RAG at scale requires treating ingestion as a separate write-path from the query read-path — never block queries during reindexing.

Source (S3/GDrive/DB) → Queue → Parse → Chunk → Contextualize → Embed → Upsert vector DB → (optional) Build graph index

Patterns for huge data

PatternWhat it solvesResource
Parent-child chunking Retrieve small children (512 tok), generate on large parent (2–4k) LangChain parent retriever
Contextual retrieval LLM prepends situating context to each chunk before embed Anthropic contextual retrieval
Incremental / CDC ingestion Content-hash IDs; queue-driven updates on doc change K8s RAG reference arch
GraphRAG indexing Entity extraction → Leiden communities → community reports GraphRAG indexing pipeline
RAPTOR tree Recursive cluster + summarize for hierarchical retrieval RAPTOR paper
PageIndex filesystem File-level tree index over millions of structured docs PageIndex at scale

7 Scaling RAG — DevOps & Infrastructure Production

Production RAG separates write path (ingestion queue) from read path (query gateway → cache → vector DB → rerank → LLM). Scale each layer independently once you pass ~500–1000 QPS.

LayerProduction patternDeep resource
Ingestion Kafka/Redis Streams/SQS → idempotent workers; content-hash point IDs Scalable RAG — 10K+ QPS design
Vector DB One collection + tenant_id filter; shard ≥ 2× peers; int8 quant @ 50M+ vectors K8s RAG Stack 2026
Embedding service TEI/vLLM on GPU; batch ingest, real-time query; horizontal scale Enterprise RAG architecture
Query cache Redis: embed cache + retrieval result cache; biggest p95 win p95 <200ms RAG engineering
LLM gateway LiteLLM proxy; circuit breakers; rate limits per tenant GCP RAG on Vertex AI
Agentic loops recursion_limit, max iterations, cost caps, stuck-loop detection Self-correcting loops guide
Observability Langfuse/LangSmith traces per retrieval hop; OTel GenAI conventions Langfuse agent observability
Semantic cache Redis LangCache / embed-similarity cache for repeated queries Redis semantic caching

Reference architectures (open source)

Sizing rule of thumb (~50 QPS, 10M vectors): 3-node Qdrant cluster, 2× TEI on GPU, 3× orchestration replicas, Langfuse small tier — scale the bottleneck layer only after measuring.

8 RAG & Agentic RAG Evaluation

Evaluate retrieval and generation separately, then end-to-end. For agentic systems, add trajectory eval — did the agent retrieve the right hops in the right order?

Core metrics

MetricWhat it measuresProduction threshold*
Context precisionRetrieved chunks actually relevant≥ 0.70
Context recallAll needed info was retrieved≥ 0.80
FaithfulnessAnswer grounded in context (no hallucination)≥ 0.75
Answer relevancyAnswer addresses the question≥ 0.80
Trajectory adherenceAgent took correct retrieval stepsDomain-specific rubric

*Starting thresholds — calibrate on your domain with human-labeled examples.

Evaluation stack (2026 consensus)

ToolRoleLink
RAGAS Offline dataset experiments; reference-free RAG metrics docs.ragas.io
DeepEval Pytest-native CI gates; agent + RAG metrics deepeval.com
LangSmith Trace → dataset; multi-turn + trajectory evals LangSmith evals
Arize Phoenix OTel traces + embedding drift + eval harness Phoenix docs
Braintrust Experiment-driven; scorer library; CI integration Braintrust evals
TruLens Production RAG triad: context relevance, groundedness, answer relevance trulens.org

9 Frontier Papers Read selectively

PaperLinkWhy it matters
Agentic RAG Survey arxiv.org/abs/2501.09136 Definitive 2025 taxonomy of agentic retrieval systems.
Self-RAG arxiv.org/abs/2310.11511 Reflection tokens for retrieve/grade/generate decisions.
CRAG arxiv.org/abs/2401.15884 Corrective retrieval with web fallback.
GraphRAG (Microsoft) arxiv.org/abs/2404.16130 Global corpus reasoning via knowledge graphs.
IRCoT arxiv.org/abs/2212.10509 Interleaved retrieval + chain-of-thought for multihop.
ColPali arxiv.org/abs/2407.01449 Vision-first document retrieval.
Contextual Retrieval Anthropic Chunk contextualization — production must-have.
Modular RAG arxiv.org/abs/2407.21078 Composable retrieval modules framework.

10 Conceptual Videos Architecture talks

VideoLinkFocus
Adding Agentic Layers to RAG — Jerry Liu YouTube Why naive RAG fails; routing, query planning, agentic loops over data.
Agentic RAG with Knowledge Graphs — Neo4j YouTube GraphRAG + agentic automation; MCP; multi-hop entity reasoning.
Stanford CS230 — Agents, Prompts & RAG YouTube Full lecture: RAG → agentic workflows → multihop → eval.
Top 3 RAG Evaluation Frameworks YouTube RAGAS vs DeepEval vs Opik — metric concepts explained.
Agentic GraphRAG — KGC 2025 KGC 2025 Combining vector + graph retrieval in agent architectures.
Microsoft GraphRAG — Architecture Deep Dive YouTube Indexing pipeline, community detection, global vs local search modes.
Building Production RAG — Anthropic Contextual Retrieval YouTube Chunk contextualization architecture; hybrid + rerank production stack.
ColPali — Visual Document RAG Explained YouTube Why page-as-image beats OCR for infographics and financial tables.
LangGraph Agentic RAG — Official Walkthrough YouTube 5-node StateGraph: grade → rewrite → generate loop in production terms.

11 Courses & Tutorials Hands-on

ResourceLinkFocus
LangGraph Agentic RAG (official) LangGraph docs Canonical grade → rewrite → generate loop.
Building Agentic RAG with LlamaIndex DeepLearning.AI — Jerry Liu Router → tool calling → multi-step research agent → multi-doc.
HF Agents — Agentic RAG unit HF Agents Course Unit 3 Cross-framework agentic RAG exercises.
CRAG / Self-RAG / Adaptive (local) LangGraph RAG tutorials hub All three pattern implementations with local LLMs.
Microsoft GraphRAG GraphRAG get started Index pipeline + global/local/DRIFT search modes.
ColPali multimodal RAG Microsoft ColPali repo Production visual document retrieval architecture.
PageIndex agentic vectorless RAG PageIndex GitHub Tree-index navigation without vector DB.
Adaptive/Corrective/Modular RAG LangGraph pattern guide Side-by-side architecture comparison.
hybrid-rag-system (full stack) GitHub Qdrant + ES + Neo4j + CRAG + RAGAS dashboard — clone and study.
agentic-RAG template GitHub RRF + GraphRAG + HyDE + multihop datasets + eval CI.

12 Production Checklist

  1. Baseline 2-step RAG with hybrid + rerank hitting Recall@10 ≥ 0.85 on golden set
  2. Contextual chunks or parent-child indexing for your doc types
  3. LangGraph agentic loop with recursion_limit and max rewrite attempts (3)
  4. Faithfulness verifier node before returning answer to user
  5. Async ingestion queue — never block queries during reindex
  6. Per-tenant isolation via metadata filters, not per-tenant collections
  7. LangSmith/Langfuse traces on every retrieval hop + tool call
  8. RAGAS offline eval on every chunking/embedding change
  9. DeepEval CI gate — faithfulness ≥ threshold blocks merge
  10. Cost guards — skip agentic path for simple queries (Adaptive RAG router)
Hybrid recommendation: Run optimized 2-step RAG for 80% of queries; route only complex/multihop/high-stakes to agentic subgraph via Adaptive RAG classifier.

13 When to Use Agentic RAG

ScenarioPatternWhy
Internal docs chatbot, fixed corpus2-step RAG + hybrid + rerankSimpler, faster, cheaper — agentic is overkill
Mixed queries (some need docs, some don't)Adaptive RAGRouter skips retrieval when unnecessary
Multihop research / compare entitiesAgentic + IRCoTSequential retrieval depends on prior hops
Infographics, financial PDFs, slide decksColPali / multimodal RAGOCR pipelines lose layout and tables
"What are the main themes?" over corpusGraphRAG global searchVector RAG fails on holistic questions
Long structured reports (SEC, legal)PageIndex or RAPTORTree navigation beats flat chunking
High-stakes compliance / medicalSelf-RAG + CRAGGrading loops reduce hallucination 30–60%
Latency-sensitive chat (<2s)2-step RAGAgentic adds 2–5+ LLM calls per query
Entity-relationship queriesAgentic GraphRAGGraph traversal + vector hybrid

14 8-Week Agentic RAG Mastery Plan

WeekFocusDeliverable
1RAG tab phases 1–3 + contextual retrievalHybrid + rerank baseline with RAGAS scores
2LangGraph canonical agentic RAG5-node graph with grade → rewrite loop
3CRAG or Self-RAG tutorialWeb fallback or reflection grading
4Multihop — IRCoT or query decompositionMultihop golden set with trajectory eval
5Adaptive RAG routerSimple vs complex query paths; cost comparison
6Multimodal OR GraphRAG (pick one)ColPali demo OR GraphRAG on small corpus
7Scaling — async ingestion + observabilityQueue pipeline + Langfuse traces per hop
8Production eval harnessRAGAS experiments + DeepEval CI gate + deploy
Don't skip basic RAG. Read the Agentic RAG Survey in week 1 while building your baseline — it maps which pattern fits which query type so you don't over-engineer.