Avoiding hallucinations and checking facts
Course contents (19 lessons)
- Understanding the tool
- What a language model is, in plain words
- How ChatGPT works from a user's point of view
- Building a good prompt
- The anatomy of a good prompt
- Being specific: how to remove guesswork
- Showing examples: few-shot prompting
- Asking for step-by-step reasoning
- Controlling and improving answers
- Controlling length, tone and format
- Iterating: how to improve an answer with follow-ups
- Custom instructions and memory
- Working with files and images
- ChatGPT for real tasks
- Using ChatGPT for writing: emails, reports and rewrites
- Using ChatGPT for studying and learning
- Using ChatGPT for coding and technical work
- Using ChatGPT for data, spreadsheets and business tasks
- Prompt templates
- A library of reusable prompt templates
- Reliable and safe use
- Avoiding hallucinations and checking facts
- Privacy and safe use
- Workflows and final project
- Building repeatable workflows and custom assistants
- Final project: build your own prompt toolkit
What a hallucination is
A hallucination is when the model states something false in a confident and fluent way. It may invent a book that does not exist, attribute a quote to the wrong person, give a wrong date, or describe a function that your software does not have. It is not a rare bug that will vanish next year. It follows from how these systems work: they produce likely-looking text, and likely-looking text is not the same as true text.
It is most likely when the answer is obscure, very specific (exact numbers, citations, legal clause numbers), recent, or when your question assumes something false. A model asked "Why did the 1995 Lahore tram strike fail?" may well give a detailed answer even if there was no such strike. The question made the story feel real.
Prompts that lower the risk
You cannot remove the risk, but you can reduce it.
1. Give it the source
Answer the question using only the text below. If the text does not
contain the answer, say "The text does not say." Quote the sentence you
used.
Text: [paste]
Question: What is the refund period?
This is the strongest method. The model is working from a document you control, and the quote lets you verify it in ten seconds.
2. Allow "I don't know"
Answer the question below. If you are not sure, or if the answer may
have changed recently, say so clearly. Mark each claim as "confident",
"probably" or "not sure".
Question: What is the current standard rate for [a tax or fee]?
These labels are not perfectly reliable, because the model can feel confident and be wrong. But they do shift behaviour, and the "may have changed" idea nudges you to look up current figures.
3. Do not feed it false assumptions
Ask neutral questions. "What are the pros and cons of X?" is safer than "Why is X better than Y?" which assumes it is. If you are unsure that something exists, ask "Is there a ... ? If not, say so."
4. Ask for reasoning you can inspect
Before giving your final answer, list the key facts you are relying on.
Then mark which of them I should verify independently.
A checking routine
Match the amount of checking to the cost of being wrong. A joke needs none. A school essay needs some. A medical, legal or financial decision needs a lot and a qualified person.
| Type of claim | How to check |
|---|---|
| Names, dates, places | Search for them in an official or well-known source |
| Numbers and statistics | Find the original report; recalculate sums yourself |
| Quotes | Search for the exact words with the person's name; many are invented or misattributed |
| Citations and links | Open them. If you cannot find the book or paper in a library catalogue or a search, treat it as made up |
| Laws, rules, prices | Go to the official source; they change and differ by country |
| Code | Run it, and read the official documentation for any unfamiliar function |
Use a second pass
You can ask the model to audit its own answer, which finds some errors, not all.
Re-read your previous answer as a fact-checker. List every specific
claim (names, numbers, dates, quotes, sources). For each, say how sure
you are and how I could check it. Flag any claim that might be invented.
This is useful as a to-do list for your own checking. Do not treat "I reviewed it and it is fine" as proof. The same system that made the error may repeat it.
Using tools that look things up
If your version can search the web, it may be able to show where information came from. Ask for it:
Search for the current information on this and give me links to the
sources you used. For each key claim, say which source it came from.
If the sources disagree, tell me.
Then open the links. A cited answer is more checkable, but the model can still misread a page or attach a claim to the wrong source. Treat the link as the thing to confirm, not the model's summary of it. Which tools exist and how well they work depends on your version, so look at what is on your screen.
A short case study
I once asked an assistant for three academic papers on a niche topic. It gave me three neat references with authors, years and journal names. Two of them could not be found anywhere. The third existed but was about something different. Nothing in the tone of the answer warned me. Since then my rule is simple: a reference I have not opened does not exist. That rule would have saved me embarrassment if I had followed it that day.
The common mistake
Judging an answer by how polished it sounds. A tidy list of facts feels more reliable than a messy one, even though polish says nothing about truth. The second mistake is checking only the claims that seem surprising. Plausible errors, such as an off-by-one year, slip through more easily than wild ones. Check the details that your work depends on, even if they look ordinary.
Try it yourself
- Ask a question about a small local topic you know well, such as your street, school or company. Mark each claim right or wrong. This calibrates your sense of how much to trust.
- Ask for three sources on a topic and try to find each one yourself.
- Use the "answer only from the text" prompt with a paragraph, and ask a question the paragraph cannot answer. See whether it says "The text does not say".
Answer the question using only the text below. If the text does not
contain the answer, say "The text does not say." Quote the sentence you
used.
Text: [paste]
Question: What is the refund period?
This course is free to read. Create a free account to enrol, save your progress and pick up where you left off.
Sign up free I already have an account