RAG Systems: Embeddings, LLMs & Production
Learning Goal: Build and optimize production-ready Retrieval-Augmented Generation (RAG) systems to ground large language models in custom proprietary data.
Prerequisites
- Python Programming: Comfort with Python (variables, functions, data structures, and asynchronous requests). Note: General Python syntax instruction is not covered in this advanced path.
- Command Line & Environment Management: Familiarity with pip/conda, dotenv, and Docker.
- Basic Machine Learning Concepts: Understanding vectors, matrices, and cosine similarity.
Estimated Study Time
- Total Estimated Study Time: 38 hours (includes lectures, hands-on programming labs, debugging, and system evaluation).
Module 1: LLM Foundations, APIs, and Tokenization
This module covers the core mechanics of Large Language Models (LLMs) from a practical developer perspective. You will explore how weights, parameters, context windows, and tokenization models operate under the hood, and how to interface with commercial and open-source models via API endpoints.
Gap Alert (Self-Study Recommendation): Due to the specialized nature of the video pool, tokenization mechanics (like Byte-Pair Encoding) and deep transformer attention animations are not explicitly detailed in these videos. We highly recommend reading the Hugging Face Tokenizers guide or watching Andrej Karpathy's "Let's build the GPT Tokenizer" as supplementary material.
Recommended Videos
Why this video is valuable: Jeremy Howard provides an excellent, pragmatic baseline for language models. He strips away the hype to focus on the reality of model weights, predictive outputs, and how context injection directly affects response accuracy.
Why this video is valuable: This video contextualizes the engineering limitations of vanilla LLMs. It covers structural constraints like token context ceilings and knowledge cutoffs, establishing why retrieval architectures (RAG) are mathematically necessary for grounding models in external enterprise knowledge.
Module 1 Knowledge Checkpoint
- Understand the difference between parametric knowledge (model weights) and source knowledge (context-injected data).
- Explain how context limits (e.g., 4k vs. 128k tokens) restrict the amount of raw text that can be directly passed to a model.
- Articulate why fine-tuning is used for tone, style, and domain specialization, whereas RAG is used for factual grounding and data access.
Module 2: LLM APIs & Vector Embeddings
In this module, you will learn to represent unstructured text mathematically. You will study how text is transformed into dense vector representations (embeddings), how models like Sentence-BERT capture semantic intent, and how to programmatically make similarity searches using vector spaces.
Recommended Videos
Why this video is valuable: This video provides a brilliant, visual explanation of vector embeddings. You will learn how words and phrases are mapped into a multi-dimensional coordinate space where mathematical proximity correlates directly to semantic meaning.
Why this video is valuable: This is a comprehensive mathematical and conceptual deep dive. Umar Jamil explains the architecture of embedding pipelines, the mechanics of Sentence-BERT, and how high-dimensional indices like Hierarchical Navigable Small World (HNSW) enable rapid approximate nearest neighbor (ANN) lookups.
Why this video is valuable: This hands-on implementation guide walks through the mechanics of initializing API calls to OpenAI, transforming strings to vectors, and building a foundational vector lookup routine using raw Python.
Module 2 Knowledge Checkpoint
- Define vector embeddings and how dimensions (e.g., 1536 for
text-embedding-3-small) represent semantic coordinate values. - Explain the difference between dot product, cosine similarity, and Euclidean distance metric choices for vector search.
- Describe how Sentence-BERT transforms bidirectional encoder outputs into unified dense text vectors.
Module 3: Introduction to RAG Architecture
This module introduces the classic two-stage architecture of RAG: Ingestion (Offline Pipeline) and Retrieval-Generation (Online Pipeline). You will explore the tooling ecosystem, comparing the capabilities of LangChain and LlamaIndex, and code your first complete orchestration loop.
Recommended Videos
Why this video is valuable: An exceptional whiteboard-style breakdown of the RAG conceptual pipeline. It clearly demarcates the split between how data is prepared, stored, searched, and formatted as a prompt template for LLM inference.
Why this video is valuable: This guide explains the core architectural differences between LangChain and LlamaIndex. It clarifies how LangChain serves as a general-purpose, component-chaining library, whereas LlamaIndex focuses deeply on index structure, query tasks, and data ingestion over deep document structures.
Why this video is valuable: A massive, project-based video that ties together local embedding creation, data staging, and system integration. You will construct a complete local/cloud RAG application using LangChain, giving you direct exposure to basic orchestration code.
Module 3 Knowledge Checkpoint
- Draw the sequence of a typical RAG query operation, beginning with a user query and ending with a streamed response.
- Contrast LangChain’s LCEL (LangChain Expression Language) with LlamaIndex’s node-and-query engine abstraction.
- Implement a basic prompt wrapper that takes
{retrieved_context}and{user_question}parameters and passes them to an LLM.
Module 4: Data Ingestion & Vector Databases
Ingesting raw, real-world data requires robust pipelines. In this module, you will master parsing complex document schemas (such as multi-page PDFs with tables), advanced chunking algorithms (recursive character splits vs. semantic boundaries), and hybrid database retrieval strategies.
Gap Alert (Self-Study Recommendation): While the selected videos cover layout parsing and chunking extremely well, production parsing of complex scanned tables and OCR can be finicky. We recommend building a local pipeline using the PyMuPDF, Unstructured, or LlamaParse libraries to supplement this module.
Recommended Videos
Why this video is valuable: This is a crucial overview of text segmentation. It progresses from static token-length boundaries to Greg Kamradt's semantic chunking technique, showing how to calculate cosine distance variance between adjacent sentences to find natural semantic break points.
Why this video is valuable: An exhaustive code-along session that demonstrates the programmatic setup of semantic chunkers within LangChain. It explains how embedding models are used mid-ingestion to establish boundary cuts.
Why this video is valuable: Introduces "Late Chunking"—a breakthrough method for retaining global context in embeddings. Instead of tokenizing and embedding isolated segments, late chunking embeds the entire document first using a transformer model to capture global attention before chunk boundary pooling is applied.
Why this video is valuable: PDFs with embedded vector graphics, tables, and multi-column formats are notoriously hard to parse. This session teaches you how to leverage Unstructured.io tools and LlamaIndex to structure complex PDFs into tabular nodes.
Why this video is valuable: Perfect for mastering the retrieval step. This in-depth masterclass explains why dense vector search alone can fail (especially with obscure product IDs, SKU numbers, or exact keywords) and how to configure hybrid search pipelines combining sparse keyword BM25 indices with dense vector systems.
Module 4 Knowledge Checkpoint
- Understand why chunk size vs. chunk overlap tradeoffs exist, and how token-based overlap preserves context across splits.
- Code a
RecursiveCharacterTextSplitterpipeline using separators["\n\n", "\n", " ", ""]. - Describe the structural difference between sparse retrieval (BM25 token match index) and dense retrieval (vector spatial match).
- Explain how late chunking leverages self-attention layers to distribute global contextual information before creating individual chunk arrays.
Module 5: Advanced RAG & Production Optimization
This final module focuses on advanced techniques to make your RAG application performant, secure, and production-ready. You will build query expansion and re-ranking routines, configure agentic feedback loops, integrate with Model Context Protocol (MCP) environments, and quantitatively score your outputs using the RAGAS evaluation framework.
Recommended Videos
Why this video is valuable: This video covers Query Translation. Learn how to write query expansion and "RAG Fusion" modules. This involves instructing an LLM to decompose a singular user query into multiple search variants, retrieving separate document spaces, and sorting results using Reciprocal Rank Fusion (RRF).
Why this video is valuable: Focuses on re-ranking, a standard optimization pattern for production. You will learn how to implement a two-stage retrieval pipeline: retrieve a large candidate chunk pool (e.g., top 100) using cheap bi-encoder cosine similarity, and filter down to the top 5 using a highly accurate local cross-encoder model.
Why this video is valuable: A stellar, comprehensive session on evaluation. You will learn to measure system performance using the RAGAS framework across four foundational evaluation vectors: Context Precision, Context Recall, Faithfulness, and Answer Relevancy.
Why this video is valuable: Explores state-of-the-art Model Context Protocol (MCP) implementations. This lesson introduces open standards for connecting LLMs securely to modular external data sources, enterprise databases, and dynamic microservice infrastructures.
Why this video is valuable: This video details the core steps for moving RAG prototypes to production. It covers wrapping LLM loops inside secure FastAPI wrappers, implementing asynchronous streaming endpoints, and managing production API credentials.
Module 5 Knowledge Checkpoint
- Program a query translator that rewrites complex input statements into distinct sub-questions.
- Understand how a cross-encoder model computes joint attention between a query and a candidate document, and why it is too slow to use for initial dense retrieval.
- Set up a RAGAS test suite that automatically evaluates system outputs for hallucinations using LLM-as-a-judge patterns.
- Explain how Model Context Protocol (MCP) abstracts data schemas for secure tool use by agents.
Course Map
Below is the conceptual dependency flow of the curriculum. Move sequentially to ensure foundational concepts are fully established before tackling complex pipeline optimizations.
Key People Index
The following researchers, developers, and educators are featured across the modules of this curriculum:
- Jeremy Howard: Co-founder of Fast.ai, a leading researcher who demystifies Deep Learning and language modeling for developers.
- Umar Jamil: A technical educator known for deep math, transformer architectural dissections, and indexing theory.
- Greg Kamradt: Creator of foundational advanced chunking approaches (such as the embedding-variance semantic chunker).
- Jerry Liu: Co-founder of LlamaIndex, pioneer of hierarchical data index structures for LLMs.
Final Self-Assessment
Complete this comprehensive self-assessment before deploying your RAG pipelines to staging or production environments.
- Context vs Weight Separation: Can you clearly outline to stakeholders why fine-tuning a model on custom documents is inefficient for real-time information updates compared to RAG?
- API Orchestration: Can you write a clean, asynchronous Python loop using LangChain/LlamaIndex that retrieves chunks from a store, styles a prompt, and streams the generation output?
- Data Cleansing: Have you implemented a custom pre-processing parser to handle headers, footers, page numbers, and inline figures inside raw PDF formats?
- Semantic Chunking: Have you analyzed your average document layout and configured either an embedding-boundary chunker or a recursive text splitter with tailored overlaps?
- Database Engineering: Do you know how to build metadata filters inside your vector index (e.g., filtering by tenant ID, date, or department) to secure data retrieval boundaries?
- Hybrid Search: Is your search pipeline configured to blend lexical (BM25) and semantic vector similarity search?
- Re-ranking Optimization: Does your runtime query engine use a cross-encoder re-ranking model to score the top-K retrieved vector nodes before prompt injection?
- LLM-as-a-Judge Validation: Are you running systematic regressions on your model outputs using RAGAS to check for Faithfulness (hallucination checks) and Answer Relevancy?
- Microservice Architecture: Is your RAG core wrapped in a FastAPI gateway using connection pooling, error boundaries, and rate limits to handle heavy user traffic?

















