RAG interview question

Generative AIRAGbasic

What is retrieval-augmented generation (RAG)?

  1. ARetraining the LLM's weights on the company's documents so the model memorizes them before it answers any question.
  2. BHaving the LLM generate many candidate answers and then retrieving the one that appears most often among them.
  3. CRetrieving relevant passages from an external knowledge source at query time and adding them to the LLM's prompt.
  4. DCompressing the training data into a search index that replaces the LLM, so answers are returned with no generation.
Show the answer and explanation

Correct answer: C, Retrieving relevant passages from an external knowledge source at query time and adding them to the LLM's prompt.

Explanation RAG

Retrieval-augmented generation (Lewis et al., 2020) combines a retriever with a generator. At query time the system searches an external knowledge source (documents, a wiki, a database) for passages relevant to the question, puts them into the prompt, and the LLM writes an answer grounded in that context.

Why the other descriptions are wrong:

  • Retraining the weights on documents is fine-tuning; RAG leaves the model weights unchanged.
  • Sampling many answers and picking the most frequent one is self-consistency, a decoding strategy with no external retrieval.
  • RAG still uses the LLM to generate the answer; a pure search index would be classic information retrieval.

Benefits: it can use private or recent data without retraining, it reduces (but does not eliminate) hallucination, and it lets answers cite their sources.

Interview tip: define it as "retrieve, then generate with the retrieved text in the prompt", and name grounding, freshness and citations as the main reasons to use it.

Practice it as a quiz

Answer this and the other free questions with instant grading, streaks and weak-topic tracking, or unlock all 4,000 questions.

More Generative AI questions

  1. What does it mean to fine-tune a pretrained LLM?
  2. A chatbot's conversation history is growing longer than the model's context window. What is a common way to handle it?
  3. Asked for "revenue and number of orders that contain electronics, by customer segment", a text-to-SQL bot generated the query below. The Gold segment has…
  4. The table shows the next-token distribution at one decoding step for the context "The customer wants to ___". With top-p = 0.9 (nucleus sampling, no top-k),…
  5. A team reports that a new prompt raised RAGAS faithfulness on a 300-question set from 0.81 to 0.86: the old score is from last month, the new one was computed…