Skip to content
nonconvexcard

Build and instrument a minimal RAG pipeline

CodingAdvanced⏱ 1 dayRAGragimplementationinstrumentationevaluation

Problem

Implement a minimal retrieval pipeline end to end and instrument it so that each stage's recall is measurable.

  1. Chunk a corpus, embed, index, retrieve top-kk, and construct a context.
  2. Measure chunk recall, index recall (against brute force) and truncation recall separately.
  3. Show the effect of normalisation on ranking, and of chunk size on chunk recall.
  4. Demonstrate the recall ceiling by computing end-to-end accuracy against the product of stage recalls.

Implement it, then check the implementation against something you can verify independently.

Write it

Solve it here10 tests · Python runs in your browser
⌘/Ctrl + ↵ to run · limit 60s · draft saved in this browser
10 tests will run against your code. The first run downloads the Python runtime — several megabytes, once per browser.

Solution

Opening this before you have a real attempt on paper is the fastest way to feel like you understand something you cannot reproduce.

Related problems

All problems
SolvedProblemFieldTypeDifficultyTime
End-to-end recall arithmetic for a RAG systemRAGNumericalBeginner15 min
Perplexity is not comparable across tokenisersLLMsNumericalBeginner15 min
Implement backpropagation from scratch runDeep LearningCodingIntermediate3 hours
Implement kernel ridge regression runClassical MLCodingIntermediate1 hour
Implement multi-head attention from scratch runDeep LearningCodingIntermediate3 hours