Pattern 19 · Trust & safety

Hallucination guardrails

A fluent answer with one invented fact is worse than no answer — and users cannot spot which sentence is wrong.

By Aleksey StepikinUpdated October 20263 min readLive demo
Live demo · try it

An interactive mock built in plain HTML, CSS and JavaScript. Data is fictional; no model is called.

FitWhen to use it — and when not

Use it when

  • Answers over contracts, policies, medical or financial documents
  • Customer-facing assistants speaking for your company
  • Any RAG product where "not in the source" is a valid answer

Skip it when

  • Brainstorming and creative writing — invention is the point

AnatomyThe parts of the pattern

  1. CheckEach claim checked against retrieved sources.
  2. Supported marksClaim linked to the passage that supports it.
  3. Unsupported flagClearly marked, never silently kept.
  4. Strict modeAnswer only from sources; say "not found" otherwise.

GuidelinesDo & don’t

Do

  • Make "the document does not say" a first-class answer.
  • Flag the specific sentence, not the whole answer.
  • Default to strict mode in high-stakes products.

Don’t

  • Show a green "verified" badge you did not earn.
  • Silently drop unsupported claims without telling the user.
  • Rely on a disclaimer at the bottom as your only guardrail.

In the wildReal-world examples

NotebookLMPerplexityGleanHarvey

Products named for reference only — no affiliation, and the demo above is an original illustration, not a copy of their UI.

For engineersImplementation notes

  • Run a cheap verifier pass (NLI model or a second LLM call) that labels each claim supported / unsupported against retrieved chunks.
  • Instruct the generator to answer "not found" and test that it does — add those cases to evals.
  • Log unsupported-claim rate as a quality metric per release.

Trust & safetyRelated patterns

All 26 LLM UX patterns

Building an AI product?

I design and ship AI products end to end — LLM interfaces, agents, RAG, billing — from concept to a live product in weeks, not quarters. Tell me what you are building and get a fixed estimate.

Get an estimateBook a call

Create bold.
Deliver better.

See our workGet in touch