Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Guided project · 2 of 3

Retrieval Benchmark for a Docs Corpus

A reproducible experiment that ingests a licensed documentation corpus and compares chunking, embedding and hybrid search configurations by precision@k and recall@k. The winning configuration and its code feed the capstone.

  • Intermediate
  • 5 milestones · 35 steps in all
  • Quizzes on 5 skills
  • Self-paced

Start with M1: Corpus and labelled queries. Build it one step at a time; your progress is saved as you go.

What you will build

  • Build a labelled benchmark: a licensed docs corpus and 20 queries with the documents that answer them.
  • Ingest the corpus deterministically, with stable chunk IDs and source metadata.
  • Measure an exact-search baseline with correctly computed mean precision@k and recall@k.
  • Compare chunking settings, embedding models and hybrid BM25 + vector search, and choose on the numbers.
  • Trace missed queries to the stage that failed and carry the winning configuration into the RAG assistant.

Tools and ground rules

  • Python 3.12 with NumPy, sentence-transformers (small local models), rank-bm25 and pytest.
  • A corpus whose licence allows your use (for example MIT, BSD, Apache-2.0 or CC BY), recorded with its source and commit.
  • Free and local: no paid provider or API key at any milestone, and no secrets in the repository.
  • The benchmark reruns from a clean checkout with the documented commands and gives the same table.

Getting started

Follow the milestones in order. Each one is a short list of steps you work through and mark done, and ends with a quiz on each skill it used: passing a quiz is what counts as evidence for that skill.

Milestones

From brief to evidence

  1. Milestone 1 · M1

    Corpus and labelled queries

    Licensed corpus, ingestion script and 20 queries with expected source IDs

    Done when: The licence is confirmed and every query lists at least one expected source.

    7 steps
    1. Create the repository and environment
    2. Choose a corpus and check its licence
    3. Record where the corpus came from
    4. Load every document with a stable ID
    5. Write 20 labelled queries
    6. Check the query file automatically
    7. Test the checker and commit the benchmark
  2. Milestone 2 · M2

    Deterministic ingestion

    Parsing and chunking pipeline producing stable chunk IDs with source metadata

    Done when: An automated test runs ingestion twice and gets identical chunk IDs and counts.

    7 steps
    1. Normalise the text first
    2. Split Markdown into sections, skipping code blocks
    3. Write two chunking settings
    4. Test the parser and the chunkers
    5. Give every chunk a stable ID and its metadata
    6. Write the chunks and print a fingerprint
    7. Prove ingestion is deterministic, then commit
  3. Milestone 3 · M3Includes an exercise

    Baseline index and metrics

    Exact-search baseline plus a script computing mean precision@k and recall@k

    Done when: The metric code passes the platform's retrieval-metrics fixture.

    7 steps
    1. Embed the chunks and cache the vectors
    2. Search exactly with NumPy
    3. Write precision@k and recall@k
    4. Test the metrics on cases you can work out by hand
    5. Check your metric code on the Tech Atlas fixture
    6. Score a retriever on the 20 queries
    7. Run the baseline and save per-query results
  4. Milestone 4 · M4

    Configuration comparison

    Results table for at least two chunking settings, two embedding models and hybrid search

    Done when: A reviewer reruns the benchmark, reproduces the table and finds the chosen configuration justified by its numbers.

    7 steps
    1. Add keyword search with BM25
    2. Fuse the two rankings with reciprocal rank fusion
    3. Test fusion on a case you can compute
    4. Define every configuration in one place
    5. Run the comparison with one command
    6. Check that a rerun gives the same table
    7. Choose a configuration and justify it
  5. Milestone 5 · M5

    Failure analysis

    Write-up of at least three missed queries with causes and proposed fixes

    Done when: Each failure is traced to a stage (parsing, chunking, embedding or ranking) with evidence from the run.

    7 steps
    1. List the queries that were missed
    2. Trace a query through each retriever
    3. Name the stage that failed, with evidence
    4. Write up each failure and a fix
    5. Try one fix: put the heading path in every chunk
    6. Rerun the full table and compare
    7. Rerun from a fresh clone and hand over

A project worth finishing

Finish all 5 milestones and pass their quizzes to demonstrate the skills this project uses. Next in the series: Build a Grounded RAG Assistant.