Learn Everything

Module · AI Engineer

RAG

Retrieval-augmented generation end to end.

3 topics4 interactive tasks

Tool Deep-Dive Available

View full architecture diagrams, CLI cheatsheets, and production gotchas.

Open RAG & Vector Databases Hub ↗

TOPIC 01

Embeddings and Vector Search

Vector representations of semantic text, cosine similarity, and chunking heuristics.

Embeddings and Vector Search

Retrieval-Augmented Generation (RAG) grounds language models in authoritative private data by converting text into high-dimensional vector spaces.

Semantic Vector Spaces

Embedding models map sentences to dense numerical vectors (typically 768 to 3072 dimensions) where geometric proximity reflects conceptual similarity.

  • Cosine Distance: Computes the cosine of the angle between two vectors: $sim(A,B) = \frac{A \cdot B}{|A| |B|}$.
  • HNSW Indices: Hierarchical Navigable Small World graphs enable sub-millisecond approximate nearest neighbor (ANN) search over millions of vectors.

Chunking Strategies

Raw documents must be split into digestible chunks before embedding:

  1. Fixed-Size with Overlap: e.g., 512 tokens with 50-token overlap to prevent splitting sentences mid-thought.
  2. Semantic / Recursive Character Splitting: Splits on paragraph double-newlines first, then sentences, then words.
  3. Hierarchical Chunking: Parents hold broad context for generation; small children vectors are matched during retrieval.

TOPIC 02

Chunking Documents

Split long documents into chunk files and track them with a manifest before embedding.

Chunking Documents

Retrieval-augmented generation cannot feed a whole document to a model — it feeds pieces. Chunking is the act of splitting a long document into those pieces: small enough to embed precisely, big enough to make sense alone. A manifest that lists every chunk keeps the pipeline honest about what exists.

What you'll practice

  • Split a Document into Chunks — practice · beginner

A command you'll meet

echo chunk-01.txt > manifest.txt

Open any task below to get the full step-by-step walkthrough — every command is explained, and the lab validator checks what you actually built.

TOPIC 03

The Vector Store

Where the embeddings live, and how a query finds the right chunk in it.

What you'll practice

  • Configure the Vector Store — practice · intermediate
  • Blend Dense and Sparse Retrieval — challenge · advanced

A command you'll meet

cat ~/rag/store.yaml

Retrieval quality is a storage problem before it is a prompt problem. Open the task below for the full walkthrough.