Building with AILesson 38 of 80

Module 4 · Retrieval and the knowledge problem

Reranking, and how many chunks to actually send

In this lesson

  • 9 min read
  • 7 reading sections
  • Knowledge check
  • Lesson 7 of 11 in this chapter

This chapter’s goalBuild a retrieval pipeline from raw documents to a ranked set of chunks (embed, index, fuse with keyword search, rerank, filter by permission) measure its recall on a gold set of your own questions, and say from cost and quality numbers whether a given corpus should be retrieved or simply placed in the context window.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available
More context is not more accuracy050100120Chunks sent to the modelQuestions answered correctly, per cent—— Factual question answeringMeasured on 120 gold questions after reranking. The curve flattens near five to eight and falls attwelve, because irrelevant passages are distractors and the middle of a long context is attended toleast. Each extra chunk is another 400 tokens on every query, forever.
Measured on 120 gold questions after reranking. The curve flattens near five to eight and falls at twelve, because irrelevant passages are distractors and the middle of a long context is attended to least. Each extra chunk is another 400 tokens on every query, forever.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 8Free · no account needed
Lesson steps

Two kinds of encoder

Everything so far has used a bi-encoder: the query is embedded on its own, each passage was embedded on its own months ago, and they meet at a dot product. That separation is what makes search fast, because the passages are pre-computed. It is also why the ranking is approximate. The model that embedded the passage never saw the question. It encoded what the passage is about, and “about the same thing as the question” is not “answers the question”.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Python, from Zero, for AI exam.

Stuck on something?Ask Sayali, your AI tutor

How to cite: Addaly (2026) ‘Reranking, and how many chunks to actually send’, in Building with AI. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/building-with-ai/reranking-and-how-many-chunks (Accessed: 29 November 2026).