AI Hallucinations: Fabricated Responses by LLMs

blog thumbnail

Artificial Intelligence (AI) has progressed significantly, yet it faces a notable challenge: AI hallucinations. These occur when AI models present inaccurate or entirely false information as factual or reliable. With the increased adoption of LLMs across industries, hallucination has become one of the hottest related phrases. After all, when embedding LLMs into real-life scenarios with real consequences, one of the core requirements is that the model not provide false information. In this blog post, we will discuss AI-generated hallucinations.


How do large-language models work?

Large language models (LLMs) are a type of deep learning algorithm that can perform a variety of natural language processing (NLP) tasks. LLMs use transformer models and are trained using massive datasets, which enables them to recognise, translate, predict, or generate text or other content.

To understand how LLMs work, we must first understand how they represent words. While humans use a sequence of letters for each word, such as D-O-G for “dog,” LLMs use a mathematical structure called a “word vector“, which is a long list of numbers that captures the statistical relationships between the word and other words in the LLM’s training data. While these vectors do not directly represent “meaning” in the same way that humans do, they do allow LLMs to perform various tasks.

LLMs are built on a neural network that was trained using billions of words of ordinary language. The neural network is trained to “predict the next word” and requires huge amounts of text to do this. The details of how LLMs predict the next word are often treated as a deep mystery.


AI hallucinations

What are AI Hallucination? understanding AI Hallucination (confabulation)

An artificial intelligence (AI) hallucination (also called confabulation or delusion) is when a model produces fabricated or incorrect information and presents it as factual or accurate. These errors can be caused by a number of things, including insufficient training data, faulty assumptions made by the model, biases present in the training data, or limitations in the model’s capacity for logical reasoning.

The goal of AI tools such as ChatGPT is to generate responses that most closely match the user’s input; however, these systems may not be able to cross-reference or validate the accuracy of the information they produce, which means that sometimes they can generate inaccurate or misleading information without the ability to understand factual inconsistencies.

AI hallucinations are situations in which advanced language models—like GPT-4, Claude, or Google PaLM—produce completely made-up content or facts that have no basis in reality. These outputs, though completely fake, are presented with authority and confidence, which raises the possibility of misinformation or false claims.

Categories of AI Hallucinations

Example of AI hallucination (confabulation), Jupiter with 150 moons.

Hallucinations are commonly classified into two categories:

  1. Closed-domain hallucinations:
    Closed domain hallucinations refer to instances in which the model is instructed to use only information provided in a given context but then makes up extra information that was not in that context. For example, if you ask the model to summarise an article and its summary includes information that was not in the article, then that would be a closed-domain hallucination.
  2. Open-domain hallucinations: Open-domain hallucinations, on the other hand, are when the model confidently provides false information about the world without reference to any particular input context.

Types of AI hallucination

  1. Sentence contradiction: a phenomenon where the AI generates a sentence that contradicts a previous sentence.

Prompt: Write a message to mark in five words .
Output:
Hello mark, what are you up to these days. Remember our adventures in France (output more than 5 words)

2. Prompt contradiction: This occurs when a response contradicts the prompt

Prompt: Compose a message for Bard.
Output: Dear Grok, we are both share similar.

3. Factual contradiction: fictitious information is presented as if it were factual.

Prompt: List three primary colours.
Output: Red, Green, Purple. (Purple is not a primary colour)

4. Irrelevant or random hallucinations: These are characterised by the creation of random, non-relevant information unrelated to the input or output.

Prompt: Explain the concept of gravity.
Output:
Gravity pulls objects downward. The sun shines brightly today.


What Causes AI Hallucinations?

Reasons of AI Hallucination (confabulation)

AI models are trained on large corpuses of data, and they detect patterns in the data to learn how to make predictions. But if the training data is biassed or inadequate, the AI model may learn the wrong patterns, which could cause the AI model to make false predictions or hallucinations.

Some of the key factors behind AI hallucinations are:

  • Outdated or low-quality training data.
  • Factual errors, inconsistencies, or biases in the training data.
  • Lack of context provided by the user.
  • There is insufficient programming to interpret information correctly.
  • Incorrectly classified or labelled data.
  • Struggle to figure out the intent of colloquialisms, slang expressions, or sarcasm.

How can AI hallucinations be prevented?

  1. Use high-quality training data: AI models are only as good as the data they are trained on. If the training data is insufficient, outdated, or of low quality, it can lead to AI hallucinations. Therefore, it is important to use diverse and high-quality training data to prevent AI hallucinations.
  2. Clear and detailed prompts:
    Providing precise and comprehensive prompts can guide AI systems to produce more accurate and relevant responses.
  3. Contextual Information Addition:
    Enhancing AI systems with contextual details assists in refining their understanding, reducing the likelihood of generating hallucinatory content.
  4. Avoid overfitting: Overfitting occurs when an AI model is trained on a limited dataset and memorises the inputs and appropriate outputs. This leaves it unable to effectively generalise new data, resulting in AI hallucinations. To avoid overfitting, it is important to use diverse and high-quality training data.
  5. Role Assignments to AI:
    Allocating specific roles or tasks to AI systems can narrow their focus, improve accuracy, and reduce the chances of misinformation.
  6. Multi-Step Prompting:
    Breaking down queries into multiple steps or providing sequential prompts allows AI systems to better comprehend complex requests, minimising the potential for hallucinatory responses.
  7. Setting clear boundaries:
    Explicitly outlining what information is desired and what should be avoided helps AI systems align with user expectations, reducing the likelihood of generating misleading content.
  8. Model Selection:
    Choosing the right AI model can prevent hallucinations. According to the report, GPT-4 tends to have 19% less hallucination than the GPT-3.5 model. Also, the Retrieval-Augmented Generation (RAG) model has been shown to be effective in reducing hallucinations

Suggested Reading

  1. AI Apps Deployment with LLM Spark
  2. No-Code GPT Chatbot for Wix Website
  3. Transforming Customer Support with Powerful GPT Chatbot
  4. Built-In Prompt Templates to Boost AI App Development Process

Conclusion

Understanding and reducing AI hallucinations is essential in the field of Artificial Intelligence, as these fabricated responses pose significant challenges due to factors such as biassed data, faulty assumptions, or context limitations. We shed light on the complexities of these hallucinations by categorising and exemplifying them.

Preventing AI hallucinations requires measures such as using diverse, high-quality data, providing clear prompts, and avoiding overfitting, all of which aim to improve the accuracy of AI-generated responses. It is also critical to define the boundaries and roles of AI systems, resulting in more precise and reliable outputs.

As AI technology advances, managing and minimising these hallucinatory outputs becomes increasingly important. We aim for more accurate and trustworthy AI interactions through effective strategies and an in-depth understanding of AI models, which is essential for responsible AI utilisation in our evolving digital landscape.

profile pic
Neha
January 1, 2024
Newsletter
Sign up for our newsletter to get the latest updates