All labs · Lab 22 · intermediate · 40 min

Measure retrieval before you tune it

Put a number on how often the right page is found, then change one thing and see if the number moves.

You build: evalset.jsonl with 20 questions, eval.py, and a before and after table.

  • Python 3.11 or newer and uv
  • Lab 21 done
  1. 01Write 20 questions, each with the file that holds the answer

    wc -l evalset.jsonl

    You pass when: 20 lines. Include five that use different words from the page.

  2. 02Print recall at 4 and the mean reciprocal rank

    Recall at 4: how often the right page is in the four chunks you fetch. Reciprocal rank: 1 if it is first, 1/2 if second, and so on.

    uv run --with requests --with "psycopg[binary]" eval.py evalset.jsonl

    You pass when: Two numbers between 0 and 1, and a list of the questions that missed.

  3. 03Change one thing: chunk size, overlap, or a rerank step

    uv run --with requests --with "psycopg[binary]" eval.py evalset.jsonl --label after

    You pass when: The same two numbers for the new setup.

  4. 04Write the before and after in a table and keep or revert the change

    cat RESULTS.md

    You pass when: Two rows and a one-line decision. A change that does not move the number is reverted.

The check runs on the computer, not on your word: a step passes when its command exits with 0 there.

Your computer · Fleet · off

Computers are not set up on this site yet. Run each command on your own machine and compare with "You pass when".