Michalina Graczyk

When a hallucination becomes the truth: On lucky guesses of algorithms and the nightmare of LLM evaluation

5 min read
🇬🇧
LLMHallucinationEvalsAIEdge Case

This post is translated from Polish. Read the original

Spain is definitely my place on earth. My last holiday fell exactly on the day of the Spain-Austria match, and knowing the local culture a bit, I decided to ask Gemini whether there was a fan zone anywhere. Something like the ones we remember from Euro 2012.

So I ask, as the most ordinary user, whether something is going on today. The model answers with confidence: of course, for sure! There is a huge screen on Platja de la Fossa beach, the match starts at 21:00, crowds are gathering.

I ask for the source.

The model does a 180-degree turn. It admits that it made it all up. It combined the fact that the match really takes place with typical summer attractions in Spanish resorts, and with no basis it invented the details about a big screen on Platja de la Fossa. It checked the search engine. The official calendar of events of the town of Calpe for July did not mention any fan zone or beach event. A hallucination. A classic, textbook one. The model confessed without a fight.

So I went to watch the match in a small bar nearby. I walk along the promenade, and there:

The screen was there. Exactly where the model said.

What would an ordinary user do? They would be delighted. What does an LLM tester do? They start to worry, because they just ran into one of the trickiest edge cases in the AI world: a probabilistic hit that should be an error in evaluation metrics, but in reality turned out to be true 🤯.


Anatomy of a “lucky guess”, or how non-determinism works

From the point of view of LLM architecture, the model did not “know” that the screen was there. Models have no intuition and no hidden eyes in the physical world. What happened is pure math and the probability distribution of tokens in a vector space.

When the neural network built the answer, the algorithm had to map the intent of the question onto geographic reality. Calpe is a town with a limited number of big landmarks. In the training data, the word combination “Calpe + event + beach” correlates most strongly with Platja de la Fossa, which statistically dominates in the context of summer tourist attractions. And the human logic of event organizers works similarly to the model’s statistical weights - if you set up a big fan zone in Calpe, you set it up on the biggest, most accessible beach.

The model did not search for anything. It generated the most probable scenario, and reality fit that scenario perfectly.


An evaluation nightmare: Pass or Fail?

For people who work on test automation and evaluation of LLM-based systems, a situation like this is a pure paradox. Let’s look at it through the metrics we use in AI evaluation systems.

Faithfulness / Grounding - if our evaluation system compared the model’s answer with the context document - the official town calendar of Calpe for July - the result would be clear: 0/1, FAIL. The model invented an entity that was not in the provided context.

Real-world Accuracy - if someone went to check on site: 1/1, PASS. The screen was there.

The same output. Two different evaluation results.

And here comes the fundamental question: how do you evaluate systems that give correct answers for completely wrong reasons?

This is the core of the paradox. Hallucination Detection worked correctly - it was a TRUE POSITIVE. The mechanism was wrong: the model had no grounding and invented an entity with no support in the sources. The eval pipeline evaluated the original answer, before the model admitted the hallucination when asked for a source. The grounding eval gave a FAIL, and rightly so. But the content of the answer turned out to match reality - and the user standing in front of the screen would give it a PASS. In assistant systems this is a funny anecdote. In medical, legal or financial systems - a deadly danger. A “lucky guess” in drug dosage is still a critical system error, even if the patient felt better.

Lessons from the beach in Calpe

The non-determinism of generative AI can charm and surprise. But as quality engineers we cannot let this success go to our heads.

When we design production systems, our job is to eliminate lucky guesses in favor of repeatable, provable truth. Because tomorrow the model can point with the same confidence to a screen on a beach that does not exist at all - and then, instead of a fan zone, the user will find only the sound of the waves.

A few questions worth asking yourself when you design evaluations:

  • Does your eval measure only grounding, or also real-world accuracy? If only one of them - you already know your blind spots.
  • Do you have a way to mark answers as “not verifiable at evaluation time”? Without this category you get false conclusions about the quality of the system.
  • Do you distinguish a mechanism error from a result error? An accidentally correct answer is not a success - it is a gap in predictability.

A hallucination that turned out to be true is a rare edge case. But it is exactly moments like this that show whether your evaluation system is really well thought through.

Vamos España! And happy testing to everyone. 🇪🇸

Stay up to date with LLM and QA! 🚀

Practical notes on testing, QA processes and modern quality strategy. No fluff - for testers and leaders who want to get quality right. The newsletter is in Polish.

When you join, you agree to receive news from me. You can unsubscribe at any time.