DEV Community

Konstantin Konovalov
Konstantin Konovalov

Posted on

The re-ask test, and four other cheap checks for hallucinated output

The scary hallucinations are not the obvious ones. An obvious one is easy. The model tells you a library has a function it does not have, you run the code, it throws, you move on. The dangerous ones are the confident, plausible, well formatted answers that are simply wrong, and read exactly like the right ones. Those you ship.

I do not have a detector for that. Nobody does. What I have is a handful of cheap habits that shake the answer and see if anything falls off. None of them prove correctness. All of them are faster than getting it wrong in production. Here they are, in the order I actually use them.

Re-ask it reworded, in a fresh session

This is the one I trust most. Take the same question, phrase it differently, and ask again in a clean context with no memory of the first answer.

Here is why it works. When the model actually knows something, the answer is anchored to real structure, so it comes back stable no matter how you word the question. When it is confabulating, it is generating something that fits the shape of your prompt, and a different prompt shape produces a different fabrication. So you watch for wobble. If the two answers agree on the load bearing details, that is a good sign. If the version number, the flag name, or the key fact shifts between phrasings, the model was improvising and you just caught it. Fresh session matters. In the same thread it will just agree with its earlier self to stay consistent, which tells you nothing.

Make it quote the source

I ask for the exact text it is relying on. The specific sentence from the docs. The function signature verbatim. The clause, not a summary of the clause.

Two things happen. Sometimes it produces a real quote and I go check that the quote exists and says what it claims, which is a much smaller job than verifying the whole answer. Sometimes it cannot produce one, and starts talking around the question, and that dodge is the signal. A model that knows the source can hand it to you. A model that is pattern matching produces a quote shaped blur with no crisp edges. The demand for verbatim text separates recall from invention better than almost anything else I do.

Watch confidence rise as the topic gets obscure

This one is a feel you build over time, and it is worth building.

On a common, well documented topic, a good model often hedges a little, because the training data itself contains disagreement and caveats. On a genuinely obscure topic, the honest answer is more uncertainty, not less. So when I ask about some niche corner of a tool and the answer comes back more confident and more specific than the popular stuff did, a flag goes up. Real knowledge gets thinner and more careful at the edges. Confabulation does not know it is at an edge, so it stays smooth and assured right off the cliff. Rising confidence into rising obscurity is backwards, and backwards is the tell.

Check exactly one detail yourself

Not the whole answer. One detail. The one that, if it is wrong, sinks the rest.

Pick the load bearing fact. The flag actually exists. The endpoint returns that field. The number is in the right range. Then verify only that, by hand, against the real thing. This works because hallucinations are rarely surgical. When a model is making things up, it is usually not making up one perfect detail inside an otherwise sound answer. It is generating a whole plausible region, and the errors cluster. So one real probe into that region tends to either come back clean, which raises my trust in the neighbors, or come back wrong, which tells me to distrust the lot. One check, chosen well, buys a lot of information.

Ask what it is least sure about

At the end I ask a plain question. Which part of this are you least confident in, and why.

A model that can locate its own weak spot usually points right at the soft joint, the part where it was interpolating. That is a gift. It hands you the exact place to aim your one manual check from the previous habit. And when it cannot name a weak spot, when everything is presented as equally solid, that flatness is its own warning, because a real answer to a real question has texture. Some parts are certain and some are guesses, and a model reporting uniform confidence across all of it is not reading its own uncertainty. It is performing.

Use them together, not alone

No single check is proof. I want to be clear about that. Any one of these can pass on a wrong answer or flinch at a right one.

But they are cheap, and they are close to independent, so stacking two or three of them catches most of what would have burned me. The re-ask shakes it. The quote demand pins it. The one hand check grounds it. Thirty seconds, before I trust the output enough to build on it. The model is a fast, fluent, confident source that does not know when it is wrong. These habits are how I stay the part of the loop that does.

AGINE Academy is an independent product by AGINE AI (not affiliated with Anthropic). We teach building with Claude by doing the work, not watching lectures.

Top comments (0)