Skip to main content

Generative AI and Hallucinations

Premium

Generative AI models, especially large language models (LLMs), are powerful, but they aren’t perfect. One of the biggest challenges is hallucinations: when the AI generates outputs that are incorrect, misleading, or nonsensical.

Understanding hallucinations is crucial because interviewers often probe the limitations of AI and expect you to show responsible usage. Even if the topic isn’t directly asked, a weak grasp of Gen AI’s boundaries can affect your entire interview e.g. leading you to propose unrealistic or unfeasible product ideas.

Types of hallucinations

In LLMs, hallucinations happen when the model outputs information that:

  • Factuality Hallucination: Conflicts with real-world facts.
    • Example: LLM claiming there are 8 continents instead of 7.
  • Faithfulness Hallucination: Doesn’t follow the user’s instructions or context.
    • Example: Generating an image of an orange cat when the prompt requested a black cat.

The tricky part is that hallucinations often look convincing. Even if a model is correct 95% of the time, the 5% of hallucinations can be dangerous, especially in critical fields like healthcare.

Key takeaway: Always validate AI outputs, using human review or automated checks.

Causes of hallucinations

Hallucinations arise across the lifecycle of an LLM: data, training, and prompting.

Hallucination Sources

A. Data

  • LLMs are trained on massive datasets from the web. If the data contains errors, biases, or inconsistencies, the model will reflect those mistakes.
    • Example: If Wikipedia or other sources have conflicting information about a historical event, the model might generate different, contradictory dates.
  • Large datasets are hard to fully curate, so errors scale with model size. This can lead to "inverse scaling" i.e. bigger models sometimes hallucinate more.
  • Knowledge gaps also matter: models often lack specialized or proprietary knowledge. Without this, they may invent facts when asked for something outside their training.
    • Example: Asking an LLM to provide the latest internal hiring rubric from Google will result in fabricated information because that data isn’t publicly available.

B. Training

LLMs go through pre-training (learning from data) and alignment (fine-tuning for behavior and task-specialization).

  • Capability misalignment: If a model is asked to do more than it can handle, hallucinations are more likely.
    • Example: Asking a general-purpose LLM to act as a professional medical advisor may lead to inaccurate diagnoses.
  • Human feedback and reinforcement learning: Can unintentionally encourage the model to "guess" or please humans rather than be strictly factual.
    • Example: If evaluators reward detailed responses, the model might fabricate details to appear helpful.
  • Instruction tuning: Encourages models to provide complete answers, even if the information is uncertain, which can increase hallucinations.
    • Example: If you ask for a summary of an obscure scientific paper, the model might fill in missing details with fabricated content rather than admit it doesn’t know.

C. Prompting

  • Contradictory or unclear prompts: If the input is confusing or internally inconsistent, the model can hallucinate.
    • Example: Asking, "Write a 200-word essay on climate change, but make sure to argue that it is both real and completely fake."
  • Long prompts: Information buried in the middle of a long prompt may be ignored, leading to faithfulness errors.
    • Example: Providing a 10-paragraph research summary and asking for a concise summary might cause the model to omit key points from the middle paragraphs, producing an incomplete or inaccurate summary.

Prompts alone may not provide enough context for accurate outputs. Techniques like Retrieval-Augmented Generation (RAG) help by supplying relevant documents or knowledge to the model, improving reliability and reducing hallucinations.

Conclusion

Understanding hallucinations lets you demonstrate to your interviewer that you can distinguish between issues solvable with better prompting and inherent model limitations. This knowledge shapes how you:

  • Craft effective prompts
  • Design generative AI products
  • Evaluate AI outputs critically

By grasping these limitations, you show that you can use generative AI responsibly, maximizing its benefits while avoiding pitfalls.