Senior interview question
How would you decide where a question should be answered from in a RAG system?
Model answer
Route before retrieving:
Scroll sideways to see the whole diagram
Before searching, decide whether the question needs a search at all, and which source can answer it.
Text version
- Before searching, decide whether the question needs a search at all, and which source can answer it.
- Some messages need no retrieval: answering them directly saves a search and keeps irrelevant text out of the prompt.
- Questions about how things work go to the document index.
- Questions about numbers in a table (“how many units sold last week?”) need a SQL query written from the schema and executed, not a text search.
- Whatever the route, the generator answers from what came back.
- No search for messages like “thanks”: a search always returns something, which then competes for attention.
- Documents for how things work.
- Tables for numbers: text-to-SQL from the schema, run it, answer from the result; with many tables, first predict which ones.
- Multi-query or multi-hop when one search can't answer it.
A wrong route fails before any ranking happens, so evaluate the router too.
Practise the rest
6 RAG basics questions, 492 in all, each with a model answer. Free.