Archives
All the articles I've archived.
What an Agent Looks Like to a GPU
The GPU has never heard of your agent. It sees separate requests that grow every turn, with idle gaps between them. Measured on a MacBook: the same 10-turn agent in 31 seconds or 78, depending on one line of the prompt.
RAG from Scratch, Part 6: Advanced Retrieval
Hybrid search with Reciprocal Rank Fusion, rerankers, query transformation, small-to-big and contextual retrieval, GraphRAG, and agentic RAG, plus how to choose between them.
RAG from Scratch, Part 5: BM25
Why vector search confuses error code E-4012 with E-4021, how BM25 scores exact matches, a worked example you can check by hand, and why BM25 scores have no fixed scale.
RAG from Scratch, Part 4: Evaluating Retrieval
Precision, recall, MRR, and nDCG computed by hand and in code, the nDCG mistake that hides missed chunks, and whether 82% vs 78% accuracy is a real difference.
HNSW Indexing in Vector Databases: How It Works and Why It Matters for RAG
How the HNSW index makes vector search fast: the layered graph, how it's built, how a query walks it, and what goes wrong in production, with a worked example you can check by hand.
RAG from Scratch, Part 3: The Query-Time Flow
What actually happens between a user's question and the LLM's answer, why vector search always returns something, and how to design for 'no match'.
RAG from Scratch, Part 2: Embeddings, Tokens, and Metadata
Why your user's question can silently vanish before retrieval, why chunk sizes belong in tokens, and what metadata does that embeddings can't.
RAG from Scratch, Part 1: Chunking
Why a '50-character' chunk turned out to be 47, and how fixed-size and recursive chunking actually work, implemented from scratch in Python.
RAG from Scratch, Part 0: What This Series Covers
A six-part series on Retrieval-Augmented Generation, built from first principles with runnable code: chunking, embeddings, the query flow, evaluation, BM25, and advanced retrieval.