05 · Instrumented RAG lab
RetrievalLab
Advanced RAG made visible — contextual chunking, hybrid search, cross-encoder reranking, query transformation, and retrieval eval (recall@k, MRR).
RetrievalLab assembles contextual chunking, hybrid search (vector + BM25, fused with RRF), HyDE query transformation, and cross-encoder reranking into one pipeline you can inspect live.
Ingestion uses contextual retrieval: before embedding, an LLM writes a one-sentence context that situates each chunk in its document. The Pipeline Inspector shows the HyDE probe, hybrid candidates with vector vs keyword rank, and the rerank step promoting chunks. A compare view puts naive vs advanced answers side by side.
Eval reports recall@k and MRR for naive vs advanced on a labelled set. The repo is explicit that reranking’s margin is largest on large messy corpora; on a small clean corpus a strong embedding already does well. Measuring that, instead of assuming “advanced” always wins, is the point.
In the repo
- Contextual chunking (Anthropic-style situating sentence)
- Hybrid retrieve: vector + BM25 + RRF, plus HyDE
- FlashRank / MiniLM cross-encoder rerank
- Pipeline Inspector and naive vs advanced compare
- Retrieval eval: recall@k and MRR