RAG & Retrieval · Ground answers in evidence
How do you pack retrieved chunks into the prompt?
Short answer
Order by relevance, keep passages contiguous, label each with its source, and stay within a token budget. Put the strongest evidence where the model is most likely to attend, and never truncate mid-sentence.
Packing is a design step, not string concatenation. The model needs to know where one passage ends and another begins, which source each came from, and how the passages relate. A wall of text with no boundaries makes grounding and citation harder.
- Use clear delimiters with source IDs and titles for each passage.
- Deduplicate and drop low-relevance passages before filling the budget.
- Keep the most relevant evidence near the instruction and avoid cutting sentences.
- Reserve tokens for the answer and enforce a hard limit.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1Would you put the best passage first or last, and why?
- 2How do you handle a passage that exceeds the remaining budget?
- 3How would you test whether packing order affects answers?
Say it in the interview
I pack with structure. Each passage gets a source label and clear delimiters, passages are ordered by relevance, and I drop duplicates before spending tokens. I keep the strongest evidence near the instructions and never cut a sentence in half. The budget includes room for the answer. More context is not better; irrelevant passages cost money and can pull the model away from the evidence that actually matters.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live RAG & Retrieval mock interview and get scored feedback on depth, clarity and confidence.