Lesson 11 of 30
The model didn't train on your company's internal docs, and it never will — RAG is how you hand it the right answer to look at instead of hoping it already knows one.
13 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
Question 1 of 3
A team wants their support chatbot to answer questions using their internal knowledge base, which changes daily. What does RAG let them avoid doing every time the knowledge base changes?
Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
RAG (Retrieval-Augmented Generation) is a pattern, not a product: instead of asking a model to answer purely from what it learned during training, you first retrieve relevant material from your own data, then hand that material to the model as context and ask it to generate an answer grounded in what you just gave it.
The flow has a fixed shape:
Nothing here retrains the model. The model's weights never change — you're changing what it sees at request time.
// Rough sketch of the RAG steps for "explain closures" against this app's own content
const query = "How do closures relate to useState?";
// 1. Embed the query
// const queryVector = await embed(query);
// 2. Search the vector store for the closest lesson chunks
// const topChunks = await vectorStore.search(queryVector, { topK: 4 });
// 3. Assemble retrieved chunks + query into a grounded prompt
const prompt = `Answer using only this context:\n${"<retrieved chunks>"}\n\nQuestion: ${query}`;
A user asks a question — it needs to be turned into something searchable.
This is the same shape this app's own tutor uses conceptually: lib/ai/prompts/tutor.ts instructs the model to answer only from the lesson context it's given, not from general training knowledge. That's the anti-hallucination guarantee RAG makes possible — the model's answer can be traced back to specific retrieved chunks instead of being an ungrounded guess.
"How would you build a feature that answers questions about our internal documentation?" is a standard system-design-adjacent question, and reaching for embed-retrieve-inject instead of "just fine-tune the model on our docs" is exactly the distinction that separates a candidate who's actually built with LLMs from one who's only read about them.