Decoding the Mirage: Understanding Hallucinations in GenAI

Decoding the Mirage: Understanding Hallucinations in GenAI

When Generative AI (GenAI) first burst into the public spotlight in 2022, it was closely followed by its darker counterpart: hallucinations. Errors in artificial intelligence are not new, nor are they inherently dramatic. Traditional AI systems – as well as GenAI systems - rely on probabilistic models to recognize patterns and make predictions, inherently accepting a certain margin of error. This margin is often viewed as a necessary trade-off in making AI more human-like, as "to err is human." Nevertheless, minimizing potential errors remains a critical goal, leading us to a fundamental question:


What is a Hallucination?

In the realm of GenAI, hallucinations refer to outputs that are confidently incorrect or nonsensical, failing to meet our expectations. This could manifest as the depiction of a sixth finger on a hand in an AI-generated image or factually incorrect statements from a GenAI-based chatbot. A large language model (LLM) typically cannot verify whether its output aligns with reality, presenting all information—truthful or not—with the same level of confidence. This stems from the design of LLMs, which were primarily developed to generate new output based on patterns in training data, not to convey absolute truth. We ask an LLM to be creative, perhaps to invent a bedtime story where dragons play soccer, and simultaneously demand a thoroughly researched essay on the 2008 financial crisis.


How Do Hallucinations Occur?

Firstly, it's important to understand that there isn't just one type of hallucination. Instead, there's a wide array of reasons why hallucinations occur in LLMs:

  1. Creativity: In some cases, we intentionally accept hallucinations, particularly when creativity is desired. Creativity in the form of a multifaceted response is generated in LLMs through the model's stochastic nature, producing output token by token. However, unwanted creativity can also occur.
  2. Interpretation Leeway: If I, as a user, do not express important aspects precisely, an LLM will fill this gap with creativity. For example, prompt "Write me an email" and see the surprising results, or be more specific by prompting "Write me an email to a project team member, politely but firmly urging them to meet the deadline for the deliverable ‘HO-HO’ by 24.12.2024."
  3. Sparse Training Data: LLMs generate output based on trained patterns from previously seen training data. If a specific fact wasn't prominently present in the training data, there won't be a reliable pattern for it. If you ask an LLM who "Nicolas Konnerth" is, you'll receive a biography pieced together from various resumes. However, if you inquire about the key aspects of the GDPR, you're likely to get a more reliable answer.

Besides these potential causes of hallucinations, there are some phenomena that may seem like a hallucination, but are factually a correct, yet unwanted behavior of the model:

  1. Statistical Bias: If you ask an LLM what makes a good CEO based on criteria like gender, skin color, and age, you might receive a politically incorrect response if no safety mechanisms are in place, because the model finds a flawed statistical pattern from the past and projects it into the future.
  2. Faulty Training Data: Generative AI was trained on massive, human-created datasets, typically without distinguishing between fictional, factually correct, or incorrect information. Consequently, GenAI's output will reflect these categories.?


How Can Hallucinations Be Reduced?

While it's impossible to completely eliminate hallucinations due to the probabilistic nature of these models, several techniques can help control them:

  1. Adjusting Stochastic Parameters: Parameters like "temperature" and "top_p" can be tuned to control the randomness and creativity of the output. A lower temperature and top_p value reduce the likelihood of unlikely tokens being chosen, but they must be balanced to maintain creativity.
  2. Prompt Engineering: Effective prompt engineering can prevent many hallucinations. Techniques include assigning roles to the model, clarifying tasks, providing examples, and using advanced concepts like "Chain of Thought" prompting to encourage deeper reasoning.
  3. Grounding: Grounding involves validating information from external sources to verify an LLM's response. Larger models now connect to search engines to cross-reference answers with online search results, enhancing accuracy.
  4. Ensemble Models: Using ensemble algorithms, multiple models tackle the same problem, and an overarching model selects the most likely correct result, often through majority voting.
  5. Retrieval Augmented Generation (RAG): In RAG systems, models are provided with specific information to rephrase rather than generate answers independently. This reduces hallucinations, although it introduces new challenges if incorrect information is provided.
  6. Model Fine-tuning: Fine-tuning involves further developing a pre-trained model to better understand specific terminology and domains, reducing domain-specific hallucinations.
  7. Human-in-the-Loop: Human oversight of AI-generated content ensures high accuracy, though scalability and potential biases remain challenges.
  8. Hybrid Systems: GenAI can enhance existing rule-based systems, mapping inputs to predefined rules to mitigate the impact of hallucinations.

At the end of the day, we must accept that an LLM on its own is not a knowledge base (except for RAG), but rather a phantastic tool that generates content – regardless of whether said content is true. The question should not be whether generative AI will ever be error-free, but rather when it will make fewer mistakes than a human.

Juan Pablo Bojacá Barrero.

Business Developer - European Expansion at IndyKite | Strategic Thinker, Sales Strategist, Business Innovator

3 周

Great insights, Nicolas! How are you tackling prompt injection and data exposure in RAG systems?

赞
回复

Very good read. I think no7 is a must when it comes to using the tool in a critical area - knowing that humans make errors too...

要查看或添加评论,请登录

Nicolas Konnerth的更多文章

  • Who let the Bots Out?

    Who let the Bots Out?

    Haben Sie schon einmal von Large Language Models (LLMs) geh?rt? Falls nicht, haben Sie mein vollstes Verst?ndnis, denn…

    6 条评论
  • Kann eine KI meine Meinung anhand von Tweets erkennen?

    Kann eine KI meine Meinung anhand von Tweets erkennen?

    Mark Aurel sagte einmal, dass man sich immer auch erlauben darf, zu einem Thema keine Meinung zu haben. So weise diese…

    3 条评论
  • Megatrend Voice mitgestalten!

    Megatrend Voice mitgestalten!

    Kannst Du dir vorstellen, Sprachassistenten neue F?higkeiten rund um Versicherungen beizubringen? Ich suche noch…

社区洞察

其他会员也浏览了