Prompt Engineering: Grounding
Grounding is giving the model the facts before asking the question. The answer then comes from the facts, not from a guess.
Without the policy
The question alone. The model has no return policy to read.
Can I return the Willow Linen Cushion? I bought the wrong colour.With the policy
The same question, with the returns policy pasted in.
ShopStack returns policy: 30 days, unused items, full refund to the original payment method.
Can I return the Willow Linen Cushion? I bought the wrong colour.Example
ShopStack refunds policy: refunds are processed within 3 to 5 business days after the returned item arrives.
How long does a refund take?Key points
- Grounding is giving the model the facts before asking the question.
- Without the facts, the model guesses. A guess about a policy is often wrong.
- With the facts in the prompt, the answer can copy them. The reply gets shorter and truer.
- The policy in the prompt is the source. The answer must match it on the numbers.
- The same question, run both ways, shows the difference. That difference is the lesson.
This example grounds a second question with its policy. The answer can copy the numbers from the prompt. 3 to 5 business days.
Note
Grounding only works when the facts are in the prompt. A fact the model cannot see cannot be used.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
What does grounding add to a prompt?