Hallucinations and grounding
Models sometimes state things that are fluent, confident and false. See why a hotel bot invents a checkout time, and how grounding it in real documents fixes the answer.
A hallucination is an answer that sounds right but isn’t: a made-up date, a wrong policy, a link to a web page that never existed. Google Cloud lists causes such as gaps or flaws in training data and a lack of grounding: the model has no connection to the real facts it’s being asked about.
It helps to remember what an LLM does (see What is an LLM?). It predicts the most likely next token. When the true answer isn’t in its training data or its prompt, the most likely-sounding text still comes out, and it sounds just as confident as a correct answer. The model doesn’t check facts unless you give it facts to use.
The fix is grounding: put trusted information into the prompt and tell the model to answer from it. When the information comes from searching your own documents, this pattern is called retrieval-augmented generation (RAG).
Press Play to see the hotel bot guess. Then switch Try it to Grounded in your documents, and then to Not in the documents: say so.
- Ask
- Retrieve
- Generate
- Made up
- Grounded answer
Press Play to watch it run, or step through with ← →.
Conversation
No messages yet. Press Play.
What to notice
- Confidence tells you nothing. The wrong answer and the right answer sound equally sure. You can’t spot a hallucination from the tone.
- Asking again doesn’t ground anything. “Are you sure?” adds no new facts to the context, so the model may repeat or defend its guess.
- Grounding changes what’s most likely. With the policy passage in the prompt, copying the fact becomes the most likely continuation. The model hasn’t become smarter; it has better context.
- Citations make answers checkable. An answer that points to “stay policy §4” can be verified by a person or an automated check.
- Permission to say “I don’t know” is a feature. Tell the model what to do when the sources don’t cover the question, such as hand over to a person. Otherwise it will often fill the gap.
Grounding with Google Search
For public, up-to-date facts, the Gemini API can ground answers in Google Search. You enable the google_search tool, and the model decides whether a search would help, writes and runs the queries, and answers with citations. The Gemini docs list the goals as factual accuracy (reducing hallucinations), real-time information, and citations that show the sources for the model’s claims. In the response, each citation links a span of the answer to a source URL and title.
Your documents (RAG)
Private, company-specific facts: policies, product manuals, order data. You control what’s searchable.
Google Search grounding
Public, changing facts: news, prices, opening hours, recent events. Results come with web citations.