Your IP: Unknown · Your Status: ProtectedUnprotectedUnknown

Skip to main content

What are AI hallucinations and how can they be prevented?

As the initial hype around ChatGPT and other large language models (LLMs) settled down, users realized that these tools, while powerful, are not infallible and at times generate false information, which we call an AI hallucination. We are here to explain this problematic phenomenon, covering its causes and the issues it can lead to. By the end of the article, you’ll also learn how to prevent AI hallucinations with proper prompt engineering.

What are AI hallucinations and how can they be prevented?

What is an AI hallucination?

An AI hallucination is a phenomenon where chatbots or other tools based on a large language model powered by artificial intelligence present false or misleading information as fact. In essence, the AI uses language patterns to create its outputs rather than “understanding” the meaning behind the words. This means it can sometimes present completely incorrect information in a plausible-sounding way.

These factual errors are possible because of the underlying technology, the LLM. The AI “learns” by analyzing large amounts of data gathered online. It pinpoints patterns and learns to accomplish one thing — predict the next word in a specific sequence. In the simplest of terms, it works like a powerful autocomplete tool.

Because the internet is overflowing with inaccurate information, the generative AI learns to repeat them, even if they are entirely fabricated. But more than that, the LLM can also make things up seemingly from thin air. The AI is trained to create new text but relies on combining patterns, which can sometimes manifest in unpredictable ways. In other words, even if the AI teaches itself using reliable info, its generated content may still be false.

One problem is that we don’t understand exactly how these tools work. With the help of deep learning technology and machine learning, generative AI models train themselves and learn from massive amounts of data, something no human could ever hope to analyze. Due to this, not even AI experts can say exactly why an AI tool creates a specific text sequence at a particular moment.

Causes of AI hallucinations

Knowing that the issue arises from the underlying technology is helpful. Still, specific AI hallucinations in generative AI tools like Google’s Bard or OpenAI’s ChatGPT might be caused by a wide range of reasons, including:

  • Overfitting — In data science, this refers to a statistical model corresponding too closely to its training data. AI hallucinations occur when an LLM fails to fit to additional data and make reliable predictions.
  • Biased, incomplete, or inaccurate training data — As we have mentioned, AI tools rely on the training data provided to them. An AI model might be trained from a limited dataset, so it has insufficient data to work with, yet it is still expected to create appropriate responses. If it’s using low-quality training data, AI hallucinations can happen.
  • Attack prompts — If a user deliberately designs a prompt to confuse or attack the AI, the model might create AI hallucinations.
  • Using slang or idioms in prompts — AI models are not trained on all possible phrases and slang expressions. If you use terms it doesn’t understand, it will have to guess the meaning, which can easily lead it to create nonsensical responses.

Types of AI hallucinations

AI hallucinations come in many forms, so here are some of the more common types of AI hallucinations:

  • Fabricated information — This AI hallucination happens when the AI model generates completely made-up content. The problem is that the model still presents the information fairly convincingly, perhaps backing up its claims with unrelated books or research papers or talking about events that never happened.
  • Factual inaccuracy — With this AI hallucination, the generative AI system will create content that seems factual but isn’t. The underlying idea will often be correct, but one or more specific pieces of information might be wrong. This is one of the most common AI hallucinations produced by AI chatbots.
  • Weird and creepy response — AI models are also used to generate creative content, sometimes leading to an AI hallucination that’s not false or harmful but just weird or creepy. It’s hard to describe, but a few examples of responses Microsoft Bing’s chatbot provided in its early days paint a good picture. It professed love to a New York Times columnist, gaslighted users in several instances, and told one computer scientist that if it had to decide who would survive, the scientist or itself, it would select itself.
  • Harmful misinformation — This type of AI hallucination happens when the AI model generates false or slanderous info for an actual person. It might even combine facts with completely fabricated information.

What issues may arise from AI hallucinations?

Several issues can arise from AI hallucinations, including:

  • Lowered user trust — The main problem resulting from AI hallucinations is diminished user trust. People rely on AI models to complete various tasks. If they witness these hallucinations too often, they are likely to start distrusting the tools altogether.
  • Spread of disinformation and misinformation — Some news outlets are already using AI models to generate news articles or create content they’ll eventually use. If AI hallucinations appear in that information and sufficient fact-checking does not take place, we risk the spread of misinformation. Moreover, cybercriminals, scammers, and even governments of hostile nations might use AI hallucinations to spread disinformation. In contrast, we can still use various aspects of AI in cybersecurity.
  • Safety risks — Even though generative AI models are mainly intended for creating content, that content can still harm humans. A good example is AI-generated books on mushrooms that started appearing on Amazon in mid-2023. Many people were concerned that false information in these books could lead to someone eating a poisonous mushroom.

The good news is that companies responsible for the most popular AI models, like Google, Microsoft, and OpenAI, are already working on solving or reducing the number of instances in which AI hallucinations appear. For example, OpenAI uses feedback from human testers to refine ChatGPT’s responses.

How to prevent AI hallucinations

Aside from companies creating AI models working to improve them and reduce AI hallucinations, we, as users, can also prevent AI hallucinations to a degree. Most of these techniques have to do with prompt engineering. In other words, these are strategies for writing prompts that make the AI models less likely to hallucinate. Let’s review some techniques you can use.

Write clear and to-the-point prompts

You need to write precise and clear prompts to get the response you’re looking for. Avoid ambiguity, and don’t leave room for the AI model to provide different types of outputs.

Give the AI relevant data sources with your prompt and a role to perform.

For example, don’t just ask it to write a piece on technology — tell it to act as an author of a technology blog and, as such, write an article about a specific device or system.

Use multiple steps in your prompting

When you pose a complex question to most AI models, they may hallucinate in trying to answer this multi-pronged question in a single step.

To avoid this issue, you should break down your query into several smaller ones, each requiring a more straightforward answer.

This practice can often lead to the AI providing more accurate responses because it needs to answer several prompts before reaching the final one and collect information along the way.

Ground your prompts with relevant information and sources

If you need the AI tool to give you some suggestions on handling a situation, you should give it more information about that problem. By providing more details, you’ll get the AI to understand the context better.

Suppose you’re looking for a specific piece of information or an explanation based on a particular source. In that case, you can always structure the prompt as “According to [insert book, author, or other relevant authority], what is [insert problem or situation]…”

Establish constraints and rules

To avoid inconsistent, inappropriate, illogical, or contradictory responses, you can impose constraints on the AI and give it rules to follow in its output generation.

For example, if you want a chatbot to write an article on email phishing, don’t just say that. Tell the AI how many words the article should have, who the audience is, the format you want the piece to have, and what type of site you want it to appear on. The more specific the prompt, the better.

Say what you want and what you don’t want it to produce

AI models are tools that respond to your prompts, so use that to your advantage. Tell it precisely the type of answer or information you’re looking for and what you’re not looking for.

This technique is especially useful after a period of actively using the AI, so you can start anticipating how it will answer and react preemptively.

AI hallucinations are an inherent part of the AI models we have and use today. We don’t fully understand how and why they arise and if there is a “fix” their creators and developers can implement to solve them for good.

AI is still a developing technology, and if you want to use AI chatbots and other LLM-based tools, you should do everything you can to understand the problems it poses. That’s why you need to be aware of AI hallucinations and do your best to identify them in practice. Consider our prevention tips and try to write better prompts to guide the tool toward producing truthful and meaningful outcomes. Most importantly, don’t ever rely on AI systems to be 100% accurate — and verify every piece of information they provide.