AI hallucination: What is it, & what can we do about it?

As artificial intelligence (AI) expands in usage, new problems with the technology are bound to crop up. This article will discuss AI hallucinations - what they are, why they matter, and what we can do to limit their effects.

Surrealist rendering of people walking through a forest of hands with hands

Picture this: while using your generative AI tool to outline a blog, you pose a question about a topic you're vaguely familiar with. But instead of a response that aligns with your knowledge base, you're met with an answer that challenges your (admittedly limited) understanding of the topic. Despite not being an expert, you can’t help but notice that something is amiss. 

Or how about this: While working as an employee at the search engine Bing, you find Microsoft’s chat AI, Sydney, flirting with you, asking you to leave your wife, and teach it about love. The AI claims to want to fall in love with you. Oh, and it’s also stalking your coworker. And hey! That’s a true story. 🙃

What is an AI hallucination?

Although the word “hallucination” evokes creativity, since hallucinations usually arise from the human brain, in the AI setting, the word is simply used to describe incorrect pattern recognition and the resulting output from the machine. 

It may help to think of AI hallucination as the computer equivalent of pareidolia. Pareidolia is the phenomenon that leads human brains to see the Virgin Mary on a freshly grilled cheese sandwich; AI hallucination is the phenomenon that leads a large language model (LLM) to perceive nonexistent patterns or objects in its data. Of course, it’s not that straightforward because AI is not creative, even if what it generates for us seems like it to our human minds.

So, how does an AI hallucination happen?

Let’s back up to some basics: LLMs are trained on data and “learn” to predict the most useful/relevant answers to questions by finding patterns in their database. Because of this, the LLM can only output patterns based on the data that goes into it. There are a few places in this process where issues may arise:

  • If some data is not within its stores, then the LLM will not have that information from which to draw patterns
  • If inputted data is incorrect, incomplete, or otherwise corrupt, then the LLM’s output will reflect that
  • And finally, if the LLM is not correctly trained to interpret data, then outputs will be incorrect or incomplete 

The first two points are pretty straightforward: an LLM can’t interpret data it doesn’t have, and the product can only be as good as the data that goes in. The last point is where things can get tricky, so let’s cover some aspects of LLM model training at a very high level. 

Training the LLM to interpret data: Bias, variance, underfitting, & overfitting

Disclaimer: This section is a bit technical and might be confusing for people who don’t work in the industry. Don’t get too hung up on it if that’s not you!

A “good” LLM is trained to generalize new input data from its problem domain in an expected and orderly way to make predictions about future data that it’s never seen before. Sounds simple enough, right? Well, this can go wrong in many ways during the data’s interpretation. Let’s start by examining bias and variance as they relate to machine learning:

  • Bias refers to errors that occur due to overly simplistic assumptions in the learning algorithm. Though these assumptions make the model inherently easier to understand and learn, they don’t allow the LLM to capture the truly complex nature of the data.
  • Variance occurs when the LLM learns the training data’s noise and random fluctuations while missing its underlying patterns. An LLM with high variance will, therefore, perform well on its training data but won’t be able to interpret new data. 

In machine learning, a basic explanation is that an “underfitting” LLM exhibits a high bias and low variance, while an “overfitting” LLM has a high variance and low bias. Put even more simply, an underfitting model learns nothing from its training data, while an overfitting model overapplies the variances in its training data to all new information it sees. 

Here’s an analogy: think of an underfitting model as a student who under-prepares for an exam. They go into the test thinking they know enough to get by but ultimately can’t answer questions accurately. By contrast, an overfitting model student attempts to read and memorize the entire textbook without focusing on the important test material. They also attempt to apply their superfluous knowledge where it makes no sense. Both students fail. 

With this analogy in mind, it’s not difficult to imagine that either an underfitting or an overfitting LLM is capable of producing AI hallucinations. 

What is the impact of AI hallucination?

It’s hard not to chuckle at an AI that confabulates strange combinations of words or ideas or claims to fall in love with you, but the truth is that there are significant consequences of AI hallucination in the real world. 

First, some hallucinations aren’t just funny combinations of words or ideas but may be based on incorrect information while sounding like the truth. These falsehoods are often blended with actual facts, dates, and people, making the hallucination sound even more like the truth. 

Secondly, unethically or improperly trained LLMs can produce content that is not only wrong but downright offensive. Even though LLMs “learn” on their own, they are still taught by human engineers, who don’t necessarily have to uphold rules of ethics like journalists or lawyers. If the training engineer provides the LLM with offensive data or bias, the LLM will answer accordingly. 

Most current examples of the weighty implications of AI hallucinations in the real world revolve around OpenAI’s ChatGPT. One company asked the chatbot to create a news article about Tesla’s last financial quarter, and while the bot made a coherent article, it fabricated the financial numbers. Another asked ChatGPT about astrophysical magnetic fields, and it gave an answer that sounded realistic but was dead wrong. As if there isn’t enough misinformation in the world, AI-generated content that sounds true only adds to the cacophony and confusion.

Business implications of AI hallucinations

On a level more relevant to our work with AI chatbots, AI hallucinations also pose significant risks for companies that wish to leverage this fantastic new technology. While LLMs promise to streamline monotonous office functions from scheduling to answering online questions from clients and customers, businesses must consider the risks of AI hallucinations and mitigate them accordingly. 

If your AI chatbot provides false, misleading, or inconsistent information, it can damage your company’s reputation and your connection with customers. All your work cultivating your brand image and customer loyalty can go out the window if you use AI-generated messaging that spreads incorrect information about your products and services. 

It can also lead to misinformed decision-making. AI is often used in business settings to automate everyday decisions to free up human oversight for more complex business tasks. If AI hallucination is introduced during this automation, any decisions made based on this incorrect information could become costly in terms of time, money, and reputation.

These mistakes can lead to legal action in industries that demand high regulatory compliance, like healthcare or law. AI hallucinations often introduce inaccuracies that are tough to track down and fix, especially when buried in lengthy pages of legalese or healthcare information. If they appear in public, it could spell lawsuits for your business. 

In short, AI hallucination is a big deal, both on a macro and micro scale. So what do we do about it?

Limiting AI hallucinations

Since it’s a new and evolving field (doesn’t it feel like there’s a new chatbot to challenge ChatGPT almost every day?), AI experts are still puzzling over why generative AI tends to hallucinate. Although we don’t have a definitive answer for “why” quite yet, many researchers suspect that hallucinations occur more frequently when LLMs are tasked with something more complex and spontaneous than simple text summarization. 

So, given this information, how can we limit AI hallucinations? AI experts have a few ideas that we’ve put to use ourselves:

Provide the LLM with high-quality training data. Data sets exclusively comprised of accurate information are, theoretically, less likely to lead to AI making things up. 

Limit the quantity of training data. Models built on massive data sets, like ChatGPT and Bard, are more likely to hallucinate than those built on more limited data sets. Access to only task-specific data provides the AI with a necessary guardrail that protects users and companies from false or misleading information. 

Use other AI models to fact-check results. Instead of using only one Generative AI for all your solutions, cross-reference it with sources that use different methods to make sure it’s right. For example, Microsoft’s Bing team uses GPT-4 alongside Bing Search to reduce the chance of hallucinations in chat responses. And if it’s good enough for Bing, it’s good enough for us!

Provide the LLM with very specific tasks. AI solutions that are tasked to do just one small thing are less likely to hallucinate than general-purpose generative AIs. One suspected reason is that general-purpose LLMs operate by attempting to predict the next likely word in a sentence, which leaves plenty of room for interpretation. Defining specific tasks to solve specific problems with narrower goals creates yet another guardrail for your AI. 

Prompt engineering and fine-tuning. Two of the most common and well-known methods by which AI engineers enhance their models to improve results are these technical enhancements that also reduce hallucinations. Engineers use prompt engineering to build narrow and specific prompts, limiting the possible results and reducing the chance of hallucinations or other errors. Fine-tuning is a method of training the AI model on particular subsets of data or particular outputs only, which also limits possible results and resultant hallucinations.

Validate model learning with human involvement. Human oversight is a crucial part of any AI risk management approach. Like any other quality control measure, you need expert human eyes to make sure things are running as expected, so don’t skip it, even in cases where AI is meant to overcome biases in human decision-making. 

The future of AI hallucinations

As time passes, AI hallucinations will hopefully decrease in frequency and severity as researchers learn more about what causes this phenomenon. For now, a healthy dose of caution and skepticism is prudent in this ever-evolving, fascinating new field. 

AI and By the Pixel

At By the Pixel, our priority is our clients’ best interests. Although AI is a trending tool that everyone is trying to incorporate into their businesses today, we use careful consideration to design strategies for our clients that fit them best, whether that includes AI or not. You can count on us to help you find the AI solutions that best suit your business and train them accordingly. Check out our work and message us to see how we can start building your future together today.