Özer Cem KELAHMETKELAHMET
RAG

RAG

Retrieval-augmented generation end to end: chunking, embeddings, vector databases, hybrid search and reranking, query rewriting, GraphRAG, agentic and corrective RAG, multimodal RAG, evaluation and running RAG in production, with simulations you can run.

Download Markdown

November 2026 16

Vector databases12 minNewVector databases explained: HNSW, IVF and product quantisation measured with FAISSHow vector databases search millions of embeddings: HNSW, IVF and product quantisation, a FAISS benchmark, pgvector settings and a product comparison.Read Self-RAG and CRAG12 minNewSelf-RAG and CRAG explained: grading passages, corrective retrieval and web fallbackHow Self-RAG and Corrective RAG check their own retrieval: reflection tokens, a grader with two thresholds, knowledge strips and web fallback, in Python.Read Reranking11 minNewReranking for RAG: cross-encoders, LLM rerankers and the latency and cost of eachHow rerankers reorder RAG candidates: cross-encoders versus pointwise, pairwise and listwise LLM rerankers, nDCG worked by hand, and token cost per query.Read RAG evaluation11 minNewRAG evaluation step by step: recall@k, MRR, nDCG, faithfulness and when a gain is realHow to evaluate a RAG system in two halves: retrieval metrics computed by hand and checked with pytrec_eval, generation metrics in Ragas, DeepEval and TruLens.Read RAG basics13 minNewRAG basics: the retrieve-then-generate pipeline, step by step, and when it beats fine-tuningHow retrieval-augmented generation works step by step: indexing, retrieval, prompt assembly and generation, with worked costs and when RAG beats fine-tuning.Read Query transformation12 minNewQuery transformation for RAG: multi-query, HyDE, step-back, decomposition and routingHow query transformation fixes RAG retrieval misses: multi-query, HyDE, step-back prompts, decomposition and routing, with runnable BM25 code and costs.Read Production RAG11 minNewProduction RAG: ingestion, freshness, access control, caching, latency and cost per answerHow to run RAG in production: incremental ingestion with content hashes, access control before ranking, semantic caching, latency budgets and cost per answer.Read Multimodal RAG11 minNewMultimodal RAG explained: ColPali page retrieval, PDF parsing, tables and storage costsHow multimodal RAG retrieves from PDFs, tables and images: parsing versus ColPali page images, late-interaction MaxSim, ViDoRe scores and storage costs.Read Long context vs RAG11 minNewLong context vs RAG: when a big prompt replaces retrieval, and what caching changesWhen should you paste the whole corpus into a long prompt instead of using RAG? Cost and latency worked out, context caching, KV reuse and accuracy limits.Read Hybrid search11 minNewHybrid search for RAG: BM25, SPLADE and dense vectors fused with reciprocal rank fusionHow hybrid search combines BM25, SPLADE and dense embeddings, with the BM25 formula worked by hand and reciprocal rank fusion compared with score blending.Read GraphRAG12 minNewGraphRAG explained: entity graphs, community summaries, LightRAG and indexing costHow GraphRAG builds an entity graph and community summaries for RAG, how local and global search differ, how LightRAG compares, and what indexing really costs.Read Embeddings12 minNewEmbedding models for RAG: how they work, how to read MTEB and what dimensions really costHow text embedding models turn chunks into vectors, how contrastive training works, how to read MTEB results and what dimensions cost in memory and money.Read Chunking13 minNewChunking for RAG explained: fixed, recursive, semantic and late chunking with worked numbersHow to split documents for RAG: fixed-size, recursive, semantic and late chunking, the overlap formula, chunk-size trade-offs and runnable Python to test them.Read Agentic RAG12 minNewAgentic RAG explained: agents that decide when, where and how to retrieve, step by stepHow agentic RAG lets a model decide when, where and what to retrieve, with a runnable loop, token growth worked out, deep research and the guardrails it needs.Read Engineering11 minNewShrinking vector search: Matryoshka embeddings, binary quantisation and rescoringHow Matryoshka training and int8 or binary quantisation cut embedding storage by up to 128 times, and how rescoring recovers most of the lost retrieval quality.Read Concepts8 minNewRAG types explained: naive, hybrid, reranked, HyDE, corrective, agentic and GraphRAGThe main kinds of retrieval-augmented generation, what each fixes, what it costs and when to use it, with a live simulation that scores each on one corpus.Read

October 2026 1

01Simulations 18

Interactive simulations of retrieval and generation: change the chunk size, the fusion weights or the reranker and watch recall and answers change.

Retrieval (RAG)Intermediate5 minNewReal computationYour inputStep by stepBM25 ranking step by step: term frequency saturation, IDF and document length normalisationRank twenty real Python docstrings for the query parse file with BM25. Move k1 and b and see how term saturation, rarity and document length change the order.Open simulation Retrieval (RAG)Intermediate5 minNewReal computationYour inputStep by stepnDCG@k, precision@k and reciprocal rank: scoring a ranked retrieval list step by stepScore one retriever's top 20 passages with graded judgements: discounted gain, ideal DCG, nDCG@k, precision, recall and reciprocal rank, all computed live.Open simulation Retrieval (RAG)Intermediate5 minNewReal computationYour inputStep by stepSemantic caching for RAG: how the similarity threshold trades cost against wrong answersThirty questions meet a semantic cache in front of a RAG pipeline. Move the similarity threshold and watch hit ratio, wrong answers and cost per answer change.Open simulation Retrieval (RAG)Beginner8 minReal computationYour inputCode labNaive RAG: embed, search, take the top threeThe baseline of retrieval-augmented generation, step by step: embed the question, score every chunk by cosine similarity and pass the top three to the model.Open simulation Retrieval (RAG)Beginner8 minReal computationYour inputCode labChunking strategies: size, overlap and boundariesSplit a document with fixed-size, sentence or recursive chunking, change size and overlap, and see whether the answer survives in one chunk and ranks first.Open simulation Retrieval (RAG)Beginner8 minReal computationYour inputCode labEmbedding space: where your query lands among the documentsEvery chunk becomes a point in a vector space. Type a query, see where it lands on a 2D map and which chunks are its nearest neighbours by cosine.Open simulation Retrieval (RAG)Intermediate10 minReal computationYour inputCode labRAG types compared: naive, hybrid, rerank, HyDE, corrective, agenticRun seven retrieval strategies on the same corpus and compare what each one finds: naive, hybrid, rerank, HyDE, query rewriting, corrective, agentic.Open simulation Retrieval (RAG)Intermediate10 minReal computationYour inputCode labHybrid search: BM25 keywords plus vectors, fused by rankSee hybrid retrieval at work: a vector ranking, a BM25 keyword ranking and reciprocal rank fusion that merges them without tuning score scales.Open simulation Retrieval (RAG)Intermediate10 minReal computationYour inputCode labRetrieve and rerank with a cross-encoderRetrieve eight candidates fast, then rerank them with a cross-encoder that reads question and passage together, and watch the relevant chunks climb.Open simulation Retrieval (RAG)Intermediate10 minReal computationYour inputCode labMulti-query rewriting: ask the same question several waysAn LLM rewrites the question into several versions in the documents' vocabulary; each searches on its own and the results are merged by rank fusion.Open simulation Retrieval (RAG)Intermediate10 minReal computationYour inputCode labHyDE: search with a hypothetical answerHypothetical Document Embeddings: an LLM drafts an answer without retrieval, and the draft, which looks like the documents, is used as the search query.Open simulation Retrieval (RAG)Intermediate10 minReal computationYour inputCode labContextual chunks and parent–child retrievalChunks lose meaning when cut out of their document. Add a short context header before indexing and compare rankings with and without it.Open simulation Retrieval (RAG)Intermediate10 minReal computationYour inputCode labCorrective RAG: grade the retrieval, search again if it is weakCorrective RAG grades every retrieved chunk as correct, ambiguous or incorrect, rewrites and searches again when the evidence is weak, then strips noise.Open simulation Retrieval (RAG)Intermediate10 minReal computationYour inputCode labHNSW: how a vector database finds neighbours fastWatch a Hierarchical Navigable Small World index answer a nearest-neighbour query in a few hops instead of comparing against every point.Open simulation Retrieval (RAG)Intermediate10 minReal computationCode labEvaluating RAG: faithfulness, context precision and recallScore RAG answers the RAGAS way: break the answer into claims, check each against the contexts, and measure context precision, recall and answer relevancy.Open simulation Retrieval (RAG)Advanced12 minReal computationYour inputCode labSelf-RAG: the model decides when to retrieve and critiques itselfSelf-RAG emits reflection tokens: whether to retrieve, whether each passage is relevant, whether the answer is supported, how useful it is.Open simulation Retrieval (RAG)Advanced12 minReal computationYour inputCode labAgentic RAG: plan, search in hops, stop when the evidence is enoughAn agent splits a question into sub-questions, searches hop by hop using what each hop found, and stops when the evidence covers the question.Open simulation Retrieval (RAG)Advanced12 minReal computationYour inputCode labGraphRAG: entities, communities and global questionsBuild a knowledge graph from the chunks, group entities into communities with summaries, and answer questions about the whole corpus or across documents.Open simulation
Type to search.
    ↑↓ navigate↵ open