All jobs / AI engineer / RAG — Retrieval-Augmented Generation
AI engineer interview question · 3–5 years
The right chunk is nearly always in your top 50 results but rarely in the 5 you send to the model. What do you add, and what does it cost?
The strongest answer
A reranker: retrieve wide and cheap, then score each query–passage pair with a model that reads both together — a cross-encoder, say — and keep the top few. It adds latency per candidate, so I cap the pool
Why it works
Right — recall is fine and precision at the top is the problem, which is exactly what a reranker is for. It is slower per pair than a vector comparison, hence two stages.
What a good answer covers
- Good recall, poor top-5: rerank.
- Retrieve wide, rerank narrow.
- Rerankers read query and passage together.
- Cap candidates; measure the latency.
Answers that fall short
- Close, but not the strongest: Send the top 20 instead of the top 5, so that the right chunk usually makes it into the prompt
It can work, but you pay for it on every request in tokens and latency, and the right chunk now sits among many distractors. - Weak: Switch to an embedding model with more dimensions; bigger vectors rank more accurately
Maybe, maybe not — and it means re-embedding everything. The measurement says first-stage recall is already good; ranking is what is off. - Red flag: Tune the ranking by hand on the questions the stakeholders will try in the demo
Tuning to the demo questions is overfitting with an audience. It passes the demo and fails the users.
Who gets asked this
More RAG — Retrieval-Augmented Generation questions
- You own the RAG system. What do you ask for before this merges?
- Leadership wants one assistant over all internal documents — HR, legal, finance, engineering — for every…
- Since you added “answer only from the retrieved context, otherwise say you don’t know”, the assistant refuses…
- Walk me through a RAG system, from a document being uploaded to a user getting an answer.
- Why do we split documents into chunks before embedding them, instead of making one vector per document?
- What is chunk overlap for, and what does too much of it cost?
- Users paste the error code “E-4012” into the support assistant. It returns passages about errors in general…
- A policy document was updated yesterday and the assistant still quotes the old text, with a citation. Where…