Use AI safely

Hallucinations and uncertainty

Recognize plausible inventions and build a workflow that verifies claims where being wrong matters.

A model can give you a confident answer that’s simply false. We call this a hallucination. The word is dramatic. The reality is quieter and more dangerous: the invention fits.

db.users.findByEmail() sounds like a real method. It’s the kind of name a database client would have. Your installed client just doesn’t have it. You won’t notice until it fails, or until a reviewer asks where it came from.

This follows from how models work. They produce what fits the context, not what they’ve verified. We covered that in the first module. Here’s what to do about it.

The usual shapes

Watch for:

  • an invented API, option, package, quote, or citation
  • a real API from a different version
  • a correct general fact applied to the wrong project
  • a missing limitation, edge case, or failure path
  • a conclusion stronger than the evidence supports

Not every wrong answer comes from missing knowledge. The model can have the correct file in context and still misread it. It can call the right tool and draw the wrong conclusion from what came back.

Labels help, but they’re not evidence

I often ask a model to separate observed facts, inferences, and open questions. It makes reviewing much faster, because I can see which claims need checking.

But a model can label a false sentence fact. The label describes how the answer is organized. It doesn’t verify anything.

Same for confidence numbers. 95% confident is generated text unless it comes from a calibration method you tested for that exact task. Treat it as a style choice.

Check harder where it costs more

Verify a claim more aggressively when it’s:

  • unfamiliar or surprising
  • version-sensitive
  • about security or privacy
  • expensive, public, or hard to reverse
  • something several later decisions depend on

For the invented database method: read the installed types or source, check the primary docs for your version, and run a one-line example. Asking the same model are you sure? is not independent evidence. It will often say yes.

Browsing and retrieval tools reduce missing-information errors. They don’t eliminate hallucinations. The model can fetch the wrong page, skip a condition, or misquote the result.

Here’s a small exercise I recommend once. Take a generated answer and pull out five factual claims. For each one, write down what evidence would verify it. If you can’t name any, either remove the claim or mark it as unresolved. Doing this a few times rewires how you read AI output.

Lesson completed