July 3, 2024

What are the Risks of Hallucinations in AI?

By Nick Berger

With Artificial Intelligence (AI) becoming increasingly sophisticated and prevalent in today’s society, humans are now beginning to wonder: 

Am I replaceable? Will advancements in AI render humankind obsolete? 

We are still years (hopefully on the larger side) away from robot-kind replacing humanity. Yet, AI has recently adopted some pretty humorous human-like characteristics. Hallucinations, a term once reserved for reality-bending psychedelic experiences or the rampant imaginations of mentally troubled individuals, has, more recently, been adapted to describe the fictitious responses that AI language models periodically output. 

The AI hallucination phenomenon is equally disconcerting as it is entertaining. Hallucinations in AI can introduce potentially disastrous risks to organizations or provide a helpful muse for creatives with off-the-beaten-path fantasies.

In this post, we will explore different types of hallucinations in AI and some of the most effective strategies for mitigating them, such as prompt engineering and RAG implementations.

What Are Hallucinations in AI?

Essentially, an AI hallucination is akin to a human telling a lie. Although there may be no malicious intent behind the model’s misinformation, AI hallucinations, nonetheless, consist of false or misleading results generated by AI models.

Part of the harm here lies in the fact that the AI models do not even recognize when they are hallucinating. Rather than intuitively communicating to the user, “Hey, I don’t know the answer to this one,” models will fabricate seemingly truthful responses.

Which AI Models Are Most Vulnerable?

Hallucinations in AI largely pertain to a particular class of AI models known as Large Language Models (LLMs). LLMs are machine learning models that can understand and generate novel text. Although the purpose of this post is not to detail an under-the-hood view of LLMs, here we will provide some high-level context to aid in our understanding of potential sources for AI hallucinations.

LLMs possess a tunable parameter called the temperature parameter. Temperature is a numerical parameter between 0 and 1 that determines the amount of risk a model takes in calculating its algorithm’s output. A higher temperature results in a lower probability or a more creative output, and a lower temperature results in a higher probability or a more predictable output. Accordingly, LLMs with their temperature parameters adjusted to higher temperature values will likely be more susceptible to hallucinations in their responses.

Additionally, models that consist of a greater number of layers or parameters (models of increased complexity) may also have a greater potential for hallucinations. Applications commonly exposed to AI hallucinations include chatbots, cybersecurity, and fraud detection.

Hallucinations Gone Awry: Real-World Examples

There are a handful of instances where AI has generated false information, with consequences ranging in severity from embarrassment and weakened trust to loss of wealth and legal action. Let us take a look at some examples:

Air Canada

A passenger with Air Canada missed a flight due to the death of their grandmother. Subsequently, they used Air Canada’s AI-powered chatbot to research flights and were recommended to apply for a bereavement fee retroactively. Contrastingly, the airline’s Bereavement Fares Policy page states, “Please be aware that our Bereavement policy does not allow refunds for travel that has already happened.” 

When this case went to court, Air Canada lost the claim as the court determined the passenger should be able to trust the information presented on the airline’s website. The judge maintained that the airline “did not take reasonable care to ensure its chatbot was accurate,” and the passenger was awarded $812.02 in damages.

Google Bard

In its debut demo, Google’s Bard AI proclaimed that the James Webb Telescope “took the very first pictures of a planet outside of our own solar system.” In reality, the first such photo was taken 16 years before the James Webb Telescope was deployed. Once the error was uncovered, Google’s stock price fell 7.7%, and the company lost nearly $100 billion on the subsequent trading day.

Microsoft Bing

Oddly enough, the day after Bard’s launch, Microsoft Bing’s Chat AI underwent a similar public demonstration. Complete with factual errors, Bing Chat provided incorrect data regarding GAP’s recent earnings call and Lululemon’s financial standing. These inaccuracies resulted in public embarrassment and weakened trust in Microsoft’s Generative AI capabilities.

Steven A. Schwartz

One lawyer, Steven A. Schwartz, employed ChatGPT to assist in a court case. ChatGPT concocted several fictional court cases for use as legal precedents. The judge attempted to verify Schwartz’s legal brief, only to find that the cited cases did not exist. Consequently, the court issued Schwartz and his team a $5,000 fine.

Best Practices to Mitigate AI Hallucinations

Ensuring 100% accuracy in the output of AI models is an impossible task. The best thing professionals can do is design and build systems that frame model output as imperfect and include mechanisms for feedback. When monitoring AI applications, some important considerations include:

  • Quality Assurance: Check for accuracy, clarity, and correctness of responses.

  • Data Security: Preserve context & intent while intelligently protecting and masking sensitive/proprietary data from leaking to the user.

  • Filters and Guardrails: Filter responses for inappropriate and off-topic outputs.

  • Interaction Logging: Continuously improve your AI applications by logging & leveraging real customer interactions.

  • Cost Monitoring: Track costs, token usage, and performance metrics.

The first and best practice for AI hallucination mitigation is to include an “I don’t know” option in the prompt. If the LLM does not have a reasonable way out of a faulty response, it is more likely to hallucinate. Now, this strategy is not foolproof, yet it stands as an excellent first measure in preventing AI hallucinations.

The underpinning of everything we have discussed in this post is the incredible ability of LLMs to understand and interpret input prompts to generate novel text outputs. This phenomenon is known as in-context learning.

One way to supplement an LLM’s context and reduce the risk of hallucination is to introduce a RAG implementation. RAG stands for Retrieval Augmented Generation, and it is a framework for retrieving information from an external knowledge base to ground LLMs on the most accurate and current information provided to the model. The RAG architecture adds domain-specific knowledge to a pre-trained LLM by feeding both the contextual data repository and the input prompt to the LLM, where the now increasingly informed response is generated.

An organization may have an internal LLM set to answer questions like, “What is our company travel policy on incidental expenses for forgotten items?” A RAG model will use the additional context provided to ensure the LLM’s response pertains particularly to the company’s travel policy and does not incorporate information related to other company policies.

When employing a RAG implementation, an additional measure can be taken to reduce AI hallucinations. Professionals can direct the LLM to quote the source material from the RAG context, which tends to reduce hallucination in RAG-specific cases.

In Conclusion

Society is ushering in a new era of technological advancements in which the powers of Generative AI and the advantages humans reap must be utilized responsibly. If left unchecked, AI hallucinations may result in legal, ethical, and economic issues, dismantling trust in the technology and the establishments that implement it. No matter the industry, AI is becoming paramount to the success and innovation of organizations. Knowledge of how and when to implement AI models is now more important than ever.

If you are interested in turning your AI ambitions into reality, phData will happily provide you with the roadmap. For a limited time, phData AI experts are hosting a series of free Generative AI workshops that explore use cases for Generative AI within your business. Sign up today!


If an AI model has begun to hallucinate, the first corrective measure toward rectifying its behavior would be to inspect the input prompt. Prompt engineering is a crucial consideration when interacting with LLMs. If an input prompt contains a surplus of information or questions, the model might become overloaded or confused when generating its output. Additionally, introducing constraints on the model output can assist in reducing hallucination prevalence. For instance, limiting the length of the model’s response can encourage it to produce more accurate and relevant results.

As the complexity and competence of AI models escalates, users will continue to encounter new challenges, furthering research and development in the space. Industries can strengthen their preparedness by investing in AI training and knowledge for their workforce. Collaborating with leading AI researchers and trusted data experts, such as phData, to navigate the evolving landscape will prove essential for maximizing the benefits and minimizing the risks associated with Generative AI.

Data Coach is our premium analytics training program with one-on-one coaching from renowned experts.

Accelerate and automate your data projects with the phData Toolkit