12. RAG Foundations — Embeddings, Similarity Search & Reranking#

A fast, conceptual revision guide for 12-rag-embeddings-similarity-reranking. Focused on the "R" (Retrieval) in RAG — how text becomes meaning-preserving vectors, why cosine similarity measures direction rather than length, how Top-K semantic search beats keyword matching, and why production systems pair fast bi-encoders with precise cross-encoder rerankers.

7 Sections • 6 Code Snippets • 3 Diagrams • 7 Self-Check Q&As