Module · AI Engineer
RAG
Retrieval-augmented generation end to end.
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:
- Fixed-Size with Overlap: e.g., 512 tokens with 50-token overlap to prevent splitting sentences mid-thought.
- Semantic / Recursive Character Splitting: Splits on paragraph double-newlines first, then sentences, then words.
- 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.txtOpen any task below to get the full step-by-step walkthrough — every command is explained, and the lab validator checks what you actually built.
Hands-On Tasks in This Topic (1)
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.yamlRetrieval quality is a storage problem before it is a prompt problem. Open the task below for the full walkthrough.
Hands-On Tasks in This Topic (2)
Configure the Vector Store
The vector store holds the embeddings and answers the nearest-neighbour queries. Write the store configuration - index type, vector dimension and how many replicas it runs.
Blend Dense and Sparse Retrieval
Dense vectors find meaning, keyword search finds exact identifiers. Blend the two and add a reranker on top - then say how much weight each side gets.