LESSON · 1 OF 4

Grounding answers in your data

Grounding answers in your data

A model only knows what was in its training data, and that data has a cutoff. It never saw your repo, your runbooks, last week's incident notes, or the config on the machine you are logged into. Ask it about any of that cold and it does the only thing it can: it generates a plausible-sounding guess. That is exactly where hallucinations come from.

There is a simple fix, and it is the most useful habit in this whole skill: put the relevant facts into the prompt, then ask your question. When the answer is sitting right there in the text you sent, the model doesn't have to reach into fuzzy training memory. It reads what you gave it and answers from that. This is called grounding the model.

Why grounding works

Two things change the moment you paste the facts into the prompt:

  • It cuts hallucination. The model is now working from real text instead of a guess. If the fact is in the prompt, it can quote it. If it isn't, a grounded prompt makes it far more likely to say so rather than invent one.
  • It answers about current and private things. Training cutoff and "it never saw your systems" both stop mattering, because you are supplying the information at question time. Your internal notes, today's log output, a file that didn't exist when the model was trained - all fair game once it's in the prompt.

The pattern

The shape is always the same: give the facts, then ask.

bash
claude -p "Notes: billing-api deploys every Tuesday at 10:00 UTC. Question: what day does billing-api deploy?"

The model answers "Tuesday" because you told it, not because it knew. Swap in your own notes and your own question and the same thing happens. The facts can come from a file you read in, the output of a command, or text you paste - as long as they land in the prompt before the question.

When the model still shouldn't know

Grounding only helps for facts you actually put in the prompt. If the answer depends on something you didn't include, the model is back to guessing. So the real skill is picking the right facts to hand it. When there's more source material than fits in one prompt, you retrieve just the relevant parts first - which is the next node.


Your lab setup

This VM comes preconfigured with your AI keys - just type claude to get started. Your key and URL are already set as $OPENAI_BASE_URL and $OPENAI_API_KEY.

Spin up a fresh environment and practice live.
linux-basic-ai · fresh machine · ready in under a minute