AXLE · RAG & Context Engineering
Home / Syllabus / Week 3
Week 3 of 8

Semantic Retrieval: Embeddings and Vector Search

Meaning as geometry: how embeddings find what keywords miss — and the chunking decision that quietly dominates quality.

Learning objectives
  • Explain what an embedding is and why cosine similarity approximates semantic relatedness
  • Design and compare chunking strategies empirically
  • Stand up a vector database and query it programmatically
  • Benchmark semantic retrieval against your BM25 baseline
Study material

Open the full Week 3 study material → Complete lesson: concepts in depth, the full lab with all code, and troubleshooting.

Concepts

1. Embeddings: meaning as coordinates

An embedding model maps text to a point in high-dimensional space where distance tracks meaning. 'Car' and 'automobile' land near each other even though they share no letters — exactly the failure BM25 can't fix.

2. Approximate nearest-neighbor search

Comparing a query against millions of vectors exactly is too slow. ANN indexes (HNSW, IVF) trade a sliver of accuracy for orders-of-magnitude speed. You'll learn what those trade-offs cost you.

3. Chunking: the highest-leverage decision

Documents must be split before embedding. Too small: fragments lose context. Too large: the signal drowns and the context budget bloats. Chunk size, overlap, and structure-awareness routinely matter more than the choice of embedding model.

4. Vector databases

Chroma, Qdrant, pgvector, and friends persist embeddings, filter on metadata, and serve ANN queries. You'll learn what they actually do — and why they're not magic, just indexes plus bookkeeping.

Lab — live session

  1. Embed your corpus with nomic-embed-text via Ollama
  2. Index in Chroma; wire a query pipeline
  3. Run three chunking strategies: fixed-size, paragraph-based, structure-aware
  4. Score each against your Week 2 query set; compare with the BM25 baseline head-to-head
Checkpoint

A vector index plus a chunking comparison table with real numbers — and a verdict on which queries semantics fixed and which it broke.

Reading

Watch

Reflection — bring answers to the next session

  1. Which of Week 2's 'Break BM25' failures did embeddings fix? Which survived?
  2. Did any query get worse under semantic search? What does that tell you?
  3. Why might a smaller chunk retrieve better but generate worse answers?
Weekend challenge

Challenge 3: The Chunking Bake-Off — Everyone copies chunk_size=1000, overlap=200 from a tutorial. You're going to find out what those numbers should be for YOUR corpus.