Q: What are hallucinations, and can you prevent them?
A hallucination is when an LLM confidently states something false. Not "I'm not sure, but..." — a fluent, specific, wrong answer, delivered in exactly the same tone as a correct one.
It happens because of what generation is. The model doesn't look answers up in a database; it produces the most plausible continuation of the text. Usually the most plausible continuation is true. Sometimes it's a convincing invention: a citation that doesn't exist, an API that was never released.
You can't eliminate hallucinations at the source, but you can engineer them down to rare. Ground the model with RAG so it answers from retrieved documents instead of memory. Give it an explicit escape hatch: "If the answer is not in the provided context, say you don't know" — without permission to say that, models fill gaps with inventions. Keep temperature low for factual tasks. Ask for sources so claims are checkable. And measure with evals, because you can't reduce what you don't track.