What is a Hallucination?
A hallucination occurs when an AI system generates an output that is factually incorrect, logically flawed, or entirely fabricated, despite presenting it with high confidence and authoritative tone.
How does it work?
Language models do not "know" facts stored in a database. They calculate the statistical probability of which word should come next based on their training data. Sometimes, the most statistically probable sequence of words forms a sentence that sounds grammatically perfect and highly plausible, but happens to be completely false in the real world.
What is it commonly confused with?
Do not define hallucination merely as "confidently stating false information as fact." It is broader than that. An AI might hallucinate a broken software library that does not exist, or hallucinate a completely unsupported conclusion from a document you provided. It is an output that is unsupported by reality or the provided context.
Why does it matter?
Hallucinations are the primary obstacle to deploying AI in high-stakes environments like law, medicine, or finance. While they cannot be completely eliminated from current LLM architectures, they can be heavily mitigated using techniques like Retrieval-Augmented Generation (RAG) and strict prompt engineering.