Mid-level interview questionAsked at C3 AI · interview write-up
Compare tokenization choices and dense versus sparse retrieval for search and RAG, then design and evaluate a hybrid retriever.
Model answer
Sparse retrieval like BM25 matches tokens, so its tokenization matters: words with stemming suit English prose, while code, part numbers and other languages need subwords or character n-grams. Dense retrieval embeds meaning, so it catches paraphrases but misses rare exact strings. A hybrid fuses both rankings, say with reciprocal rank fusion, then reranks the top. Evaluate on labelled queries with recall at k and NDCG, broken down by query type, against each retriever alone.
Scroll sideways to see the whole diagram
Search your own documents for passages related to the question, with keywords, embeddings or both.
Text version
- Search your own documents for passages related to the question, with keywords, embeddings or both.
- A reranker reads the question with each candidate and keeps the few that actually answer it.
- The kept passages go into the prompt, with instructions to answer only from them.
- The model answers from evidence in its context instead of memory alone, so the answer can be checked against its sources.
The pattern of Lewis et al. (2020), Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks, as used in production systems.
Practise the rest
22 RAG questions, 492 in all, each with a model answer. Free.
More from C3 AI interview questions.
More RAG interview questions
- What is retrieval-augmented generation, and how does it reduce hallucination?
- How do you choose a chunking strategy for RAG?
- Why combine keyword and embedding search, and where does a reranker fit?
- How do you evaluate a RAG pipeline?
- Your RAG chatbot keeps giving wrong answers. How do you find out why, and fix it?
- Design a RAG system that has to meet strict latency and cost targets while serving many tenants.