Choosing k: quality gain against cost
The hit rates are example numbers. Measure your own with the harness of Topic 9.9. Prices are examples: check your provider.
How to argue a choice instead of reciting a preference: chunk size, k, hybrid or not, re-rank or not, which store, RAG or long context. Each is a table of costs and a measurement.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Option A scores precision 5, cost 2. Option B scores precision 3, cost 5. With weights precision 2 and cost 1, print the weighted total of each and the pick.
A team sends 5 passages of 300 tokens per question and considers 3. For 20,000 questions a day at an input price of 0.50 dollars per million tokens, print the dollars saved per day.
Explain it without notes
Give the four-part structure of a trade-off answer.
How would you choose a chunk size and defend it?
How do you decide between hybrid search and vectors only?
When is long context a better answer than RAG?
Expected output
k=1 hit 55% tokens 500 $0.64 per 1000 gain +55
k=2 hit 72% tokens 800 $0.79 per 1000 gain +17
k=3 hit 81% tokens 1100 $0.94 per 1000 gain +9
k=4 hit 85% tokens 1400 $1.09 per 1000 gain +4
k=5 hit 86% tokens 1700 $1.24 per 1000 gain +1
k=6 hit 86% tokens 2000 $1.39 per 1000 gain +0
pick: k=3 (the next passage adds under 5 points)