Lesson 5 of 5 Generative AI Concepts

Reducing Hallucinations by Grounding Model Output

This lesson explains why foundation models produce hallucinations, confident but false statements, and the controls that reduce them. Models generate the most plausible continuation of text, not verified facts.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify the causes of hallucination.
  • Order the controls that reduce hallucination from cheapest to most involved, including RAG and contextual grounding checks.

Why models hallucinate

Hallucinations, in which a model produces plausible but incorrect output, have several causes. The following list describes them.

  • The answer was not in the training data, or the data is out of date.
  • The prompt is ambiguous, so the model fills gaps with plausible guesses.
  • The model is asked for specifics (citations, numbers, names) it cannot recall reliably.
  • High temperature increases randomness.
Select all that apply

Causes of hallucination

Exam skills 2.2.2 · 5.1.5

A model gave a confident but false answer.

Log in to try this activity Interactive activities are free with an account.

Controls, from cheapest to most involved

Several controls reduce hallucinations, and the cheapest should be tried first. Clear prompts with context and constraints, such as "answer only from the text below and say you do not know otherwise", cost nothing. A lower temperature makes output less random and more consistent. Retrieval Augmented Generation grounds answers in your current documents, through Bedrock Knowledge Bases, and lets the answer cite its sources.

Guardrails add checks on the answers: the contextual grounding check blocks answers that the source does not support or that do not address the question, and Automated Reasoning checks verify answers against formal rules, such as policies, with mathematical logic. Human review checks high-stakes outputs. Fine-tuning teaches a domain's style and terminology, but it does not keep facts current, so it is paired with RAG for facts. The following table summarises the controls in order of increasing cost and effort.

ControlHow it helps
Clear prompts with context and constraints"Answer only from the text below; say you do not know otherwise"
Lower temperatureLess random, more consistent output
Retrieval Augmented Generation (RAG)Grounds answers in your current documents (Bedrock Knowledge Bases) and enables citations
Guardrails contextual grounding checkBlocks answers that are not supported by the provided source or are not relevant to the question
Automated Reasoning checksVerifies answers against formal rules, such as policies, with mathematical logic
Human reviewPeople check high-stakes outputs before they are used
Fine-tuningTeaches domain style and terminology; does not keep facts current, so pair with RAG for facts
Troubleshooting scenario

Stopping false answers

Exam skills 5.1.5 · 3.1.3

Choose the control that addresses each cause of false answers.

Log in to try this activity Interactive activities are free with an account.
Worked example

A company's HR chatbot built on a foundation model sometimes invents leave policies that do not exist. Policies change several times a year. What is the most effective way to reduce these errors?

Use RAG with a Bedrock knowledge base containing the current policy documents, instruct the model to answer only from retrieved content, and add a guardrails contextual grounding check. Fine-tuning would need repeating each time policies change and still would not guarantee accuracy.

Check yourself

What is grounding?

Show answer

Giving the model trusted source content, for example through RAG, and instructing it to answer only from that content, which reduces hallucinations.

Exam Tips

Remember for the exam

  • Hallucinations are confident, plausible but false outputs.
  • RAG grounds answers in current documents and is the main fix for factual errors.
  • Guardrails contextual grounding checks block unsupported answers.
  • Lower temperature and clear constraints reduce randomness and guessing.
  • Fine-tuning changes style and domain knowledge but does not keep facts current.