Lesson 2.3
Recall@k, the Metric
How do you know retrieval is any good? Recall@k counts how many of the truly relevant passages you caught in the top k.
Did the net catch the fish?
Picture a pond with exactly 4 fish you care about. You cast a net and pull up 5 things. If 3 of those are the fish you wanted, you caught 3 of the 4 that mattered. You missed one. That fraction, 3 out of 4, is the whole idea behind recall@k. It answers one plain question about retrieval: of the passages that truly answer the question, how many did we actually bring back in our shortlist?
Retrieval hands the next stage a shortlist of the top k passages (the k nearest points, from the last lesson). Recall@k is the score that tells you whether that shortlist contained the passages you needed. If the right passage never makes the shortlist, the model can never use it, so this is the number that decides whether the rest of the pipeline even has a chance.
Recall@k asks: of all the truly relevant passages, what fraction landed in the top k? A passage that misses the shortlist is invisible to everything downstream.
The formula, in plain terms.
One small fraction. The top of the fraction is how many relevant passages you found inside your top k. The bottom is how many relevant passages exist in total.
recall@k = (relevant passages in the top k) ÷ (total relevant passages)
Note what is on the bottom: the total number that are relevant, not k. You are not asking "how much of my shortlist was good." You are asking "how much of the good stuff did I capture." That is why a perfect recall@k of 1.0 means every relevant passage made it in, and you missed nothing.
Worked example.
Say a question has 4 truly relevant passages sitting in your store. You retrieve the top 5 and 3 of those 5 turn out to be relevant. Then recall@5 = 3 ÷ 4 = 0.75, or 75%. You caught three quarters of what mattered and let one slip through.
Now drag the cut line below to set k yourself. Watch the fraction: as you let more passages into the shortlist, you scoop up more of the relevant ones, so recall climbs. It rises in steps, because it only moves when the cut crosses one of the relevant rows.
Drag the cut line to set k
recall@k = 3 / 4 = 75%
An illustrative ranking. Green rows are the truly relevant passages; the dashed line is your top-k cut.
Recall is not precision.
These two get muddled, so here is the one-line difference. Recall asks how much of the good stuff you caught (out of all relevant passages). Precision asks how clean your catch was (out of what you pulled back, how much was actually relevant). Back to the pond: catch 3 of 4 fish in a net of 5 things, and recall is 3/4 while precision is 3/5. Same haul, two different questions.
Recall, did we miss anything?
relevant found, divided by total relevant. For RAG this usually matters most: a missed passage cannot be recovered later in the pipeline.
Precision, how clean was it?
relevant found, divided by how many you pulled back. It punishes dragging in junk, the cost a bigger k quietly racks up.
Why bigger k is not free.
There is an easy way to make recall@k look great: make k huge. Return the top 1000 and you will almost certainly catch every relevant passage, so recall heads toward 1.0. But you also drag in hundreds of irrelevant passages, which is exactly the noise precision was measuring. That noise is not harmless: every extra passage costs space in the prompt and money in tokens, and it can bury the real answer (the "lost in the middle" effect in Unit 3).
So k is a dial with a real trade behind it. Too small and you miss relevant passages (low recall). Too large and you flood the context with junk (low precision, higher cost). Choosing k well, and later re-sorting the shortlist with a reranker, is how you get high recall without paying for all the noise.
A bigger k raises recall but drags in noise and cost. The skill is catching the relevant passages at the smallest k you can get away with.
Key takeaways
Recall@k is the relevant passages found in the top k, divided by the total relevant passages.
Recall asks what you missed (out of all relevant); precision asks how clean your catch was (out of what you returned).
A bigger k raises recall but drags in noise and cost, so the goal is high recall at the smallest workable k.