Joel Stevick

Episode 2 of 3 · 10:48

RAG Embeddings Explained: BM25, Vector Search and Cosine Similarity

What this episode covers

How a RAG app's search ranks passages, from first principles, on a real pipeline and its book of 629 chunks: chunking a PDF and a book, the tokens keyword search and an embedding model each see, BM25 built term by term (IDF, term frequency saturation, length normalization, against TF-IDF), embeddings from bge-m3 and contrastive learning, cosine similarity worked through, inverted indexes, HNSW and IVF, and why a demo runs both searches and fuses them.

At the end: a golden set and recall at k tell you which search works on your documents.