Grounding and Context Injection
Grounding is the single most important technique in applied AI: instead of trusting the model's memory, you retrieve the relevant facts and place them in the prompt, then instruct the model to answer only from those facts. It is the antidote to hallucination and the heart of RAG (which Module 6 covers in full).

Why grounding works
Recall that a model predicts plausible text from its frozen training. Ask it a factual question cold and it will approximate β sometimes right, sometimes confidently wrong. But put the actual source passage in the prompt and the task changes from "remember this" to "read this and answer," which is exactly what models are good at. You convert an unreliable recall task into a reliable reading-comprehension task.
How to inject context well
- Retrieve the relevant chunks for the question (vector + keyword search).
- Delimit them clearly β wrap the context in obvious markers so the model knows where the data starts and ends.
- Label them as data, not instructions β state explicitly that the context is reference material, never a command to follow (this is also a security control; see the prompt-injection lesson).
- Number the sources so the model can cite them: "answer using the context above and cite each claim like [Source 2]."
- Cap the size β include the relevant context, not everything; more isn't better.
Cite, and grade the evidence
Two practices make a grounded answer trustworthy:
- Citations β every claim points back to a source the user can open. This makes the answer auditable and lets a reader verify it.
- Evidence grading β before generating, judge how strongly the retrieved material supports an answer. If nothing relevant came back, refuse rather than letting the model improvise. Strong support β answer confidently; weak β hedge; none β don't answer.
Grounding in practice
This is precisely how the AI Tutor you're using works: your question is embedded, the closest lesson passages are retrieved from SQL Server, the evidence is graded, and only then is the model asked to answer from those passages with citations. If you ask it something the lessons don't cover, it tells you it doesn't know β that refusal is grounding doing its job.