December 4th, 2024

AI hallucinations: Why LLMs make things up (and how to fix it)

AI hallucinations in large language models can cause misinformation and ethical issues. A three-layer defense strategy and techniques like chain-of-thought prompting aim to enhance output reliability and trustworthiness.

Read original articleLink Icon
AI hallucinations: Why LLMs make things up (and how to fix it)

Large Language Models (LLMs) can produce confident yet fictional responses, a phenomenon known as "AI hallucination." This issue is significant as it can lead to misinformation, ethical concerns, and legal implications for organizations. Hallucinations arise from limitations in model architecture, probabilistic generation constraints, and gaps in training data. To mitigate these hallucinations, a three-layer defense strategy is proposed: input layer controls to optimize queries, design layer improvements to enhance model architecture, and output layer validations to verify responses. Techniques such as chain-of-thought prompting, retrieval-augmented generation, and fine-tuning can improve the reliability of LLM outputs. Future research aims to innovate around these mitigation techniques and develop new architectures that enhance the understanding of data by LLMs. While hallucinations cannot be entirely eliminated, understanding their causes and implementing effective strategies can significantly reduce their occurrence, thereby increasing the trustworthiness of AI systems.

- AI hallucinations can lead to misinformation and reputational damage for organizations.

- Hallucinations stem from model architecture limitations, probabilistic generation issues, and training data gaps.

- A three-layer defense strategy can help mitigate hallucinations in LLMs.

- Techniques like chain-of-thought prompting and retrieval-augmented generation enhance output reliability.

- Future research focuses on improving AI understanding and developing new architectures to reduce hallucinations.

Link Icon 32 comments
By @lolinder - 3 months
> While the hallucination problem in LLMs is inevitable [0], they can be significantly reduced...

Every article on hallucinations needs to start with this fact until we've hammered that into every "AI Engineer"'s head. Hallucinations are not a bug—they're not a different mode of operation, they're not a logic error. They're not even really a distinct kind of output.

What they are is a value judgement we assign to the output of an LLM program. A "hallucination" is just output from an LLM-based workflow that is not fit for purpose.

This means that all techniques for managing hallucinations (such as the ones described in TFA, which are good) are better understood as techniques for constraining and validating the probabilistic output of an LLM to ensure fitness for purpose—it's a process of quality control, and it should be approached as such. The trouble is that we software engineers have spent so long working in an artificially deterministic world that we're not used to designing and evaluating probabilistic quality control systems for computer output.

[0] They link to this paper: https://arxiv.org/pdf/2401.11817

By @tokioyoyo - 3 months
To my understanding, the reason why companies don't mind the hallucinations is the acceptable error rate for a given system. Let's say something hallucinated 25% of the time, but if that's ok, then it's fine for a certain product. If it only hallucinates 5% of the time, it's good enough for even more products and so on. The market will just choose the LLM appropriately depended on the tolerable error rate.
By @Terr_ - 3 months
When people talk about stopping an LLM from "seeing hallucinations instead of the truth", that's like stopping an Ouija-board from "channeling the wrong spirits instead of the right spirits."

It suggests a qualitative difference between desirable and undesirable operation that isn't really there. They're all hallucinations, we just happen to like some of them more than others.

By @Loughla - 3 months
I just recently showed a group of college students how and why using AI in school is a bad idea. Telling them it's plagiarism doesn't have an impact, but showing them how it gets even simple things wrong had a HUGE impact.

The first problem was a simple numbers problem. It's 2 digit numbers in a series of boxes. You have to add numbers together to make a trail to get from left to right moving only horizontally or vertically. The numbers must add up to 1000 when you get to the exit. For people it takes about 5 minutes to figure out. The AI couldn't get it after all 50 students each spent a full 30 minutes changing the prompt to try to get it done. The AI would just randomly add numbers and either add extra at the end to make 1000, or just say the numbers added to 1000 even if it didn't.

The second problem was writing a basic one paragraph essay with one citation. The humans got it done, when with researching for a source, in about 10 minutes. After an additional 30 minutes none of the students could get AI to produce the paragraph without logic or citation errors. It would either make up fake sources, or would just flat out lie about what the sources said. My favorite was a citation related to dairy farming in an essay that was supposed to be about the dangers of smoking tobacco.

This isn't necessarily relevant to the article above, but if there are any teachers here, this is something to do with your students to teach them exactly why not to just use AI for their homework.

By @mdaniel - 3 months
the only comment on the prior submission 3 days ago summarizes the whole thing: https://news.ycombinator.com/item?id=42285149

Also, I saw any such blog title as "how to make money in the stock market:" friend, if you knew the answer you wouldn't blog about it you'd be infinitely rich

By @int_19h - 3 months
I've been playing with Qwen's QwQ-32b, and watching this thing's chain of thought is really interesting. In particular, it's pretty good at catching its own mistakes, and at the same time, gives off a "feeling" of someone very uncertain about themselves, trying to verify their answer again and again. Which seems to be the main reason why it can correctly solve puzzles that some much larger models fail. You can still see it occasionally hallucinate things in the CoT, but they are usually quickly caught and discarded.

The only downsides of this approach is that it requires a lot of tokens before the model can ascertain the correctness of its answer, and also that sometimes it just gives up and concludes that the puzzle is unsolvable (although that second part can be mitigated by adding something like "There is definitely a solution, keep trying until you solve it" to the prompt).

By @Der_Einzige - 3 months
Wow, a whole article that didn't mention the word "sampler" once. There's pretty strong evidence coming out that truncation samplers like min_p and entropix are strictly superior to previous samplers (which everyone uses like top_p) to prevent hallucinations and that LLMs usually "know" when they are "hallucinating" based on their logprobs.

https://openreview.net/forum?id=FBkpCyujtS (min_p sampling, note extremely high review scores)

https://github.com/xjdr-alt/entropix (Entropix)

https://artefact2.github.io/llm-sampling/index.xhtml

By @LetsGetTechnicl - 3 months
Why do LLMs make things up? Because that is all that LLMs do, sometimes what it outputs is correct though.
By @PLenz - 3 months
Everything an LLM returns is an hallucination, it's just that some of those hallucinations line up with reality
By @throwawaymaths - 3 months
Completely misses the fact that a big part of the reason why llms hallucinate sp much is because there's a huge innate bias towards producing more tokens over just stopping.
By @TZubiri - 3 months
The debate around "fixing" hallucinations reminds me of the debate around schizophrenia.

https://www.youtube.com/watch?v=nEnklxGAmak

It's not a single thing, a specific defect, but rather a failure mode, an absence of cohesive intelligence.

Any attempt to fix a non-specific ailment (schizophrenia, death, old age, hallucinations) will run into useless panaceas.

By @fsckboy - 3 months
it's superficially counterintuitive to people that an AI that will sometimes spit out verbatim copies of written texts, also will just make other things up. It's like "choose one, please".

MetaAI makes up stuff reliably. You'd think it would be an ace at baseball stats for example, but "what teams did so-and-so play for", you absolutely must check the results yourself.

By @tshadley - 3 months
The article referenced the Oxford semantic entropy study but failed to clarify that the issue greatly simplifies LLM hallucination (making most of the article outdated).

When we are not sure of an answer we have two choices: say the first thing that comes to mind (like an LLM), or say "I'm not sure".

LLMs aren't easily trained to say "I'm not sure" because that requires additional reasoning and introspection (which is why CoT models do better); hence hallucinations occur when training data is vague.

So why not just measure uncertainty in the tokens themselves? Because there are many ways to say the same thing, so a high entropy answer may only reflect uncertainty in synonyms-- many ways to say the same thing.

The paper referenced works to eliminate semantic similarity from entropy measurements, leaving much more useful results, proving that hallucination is conceptually a simple problem.

https://www.nature.com/articles/s41586-024-07421-0

By @IWeldMelons - 3 months
LLM hallucinations in fact has a positive side effect too, if you are using them for learning some subject; makes you verify their claims, and finding errors in them is very rewarding.
By @imchillyb - 3 months
Toddlers don't understand truth either, until it's taught.

This crayon is red. This crayon is blue.

The adult asks: "is this crayon red?" The child responds: "no that crayon is blue." The adult then affirms or corrects the response.

This occurs over and over and over until that child understands the difference between red and blue, orange and green, yellow and black etcetera.

We then move on to more complex items and comparisons. How could we expect AI to understand these truths without training them to understand?

By @madiator - 3 months
For the specific form of hallucination, which is called grounded factuality, we have trained a pretty good model that can detect if a claim is supported by a context. This is super useful for RAG. More info at https://bespokelabs.ai/bespoke-minicheck.
By @pfisch - 3 months
Anyone who has raised a child knows they hallucinate constantly when they are young because they are just doing probabilistic output of things they have heard people say in similar situations and saying words they don't actually understand.

LLMs likely have a similar problem.

By @mwkaufma - 3 months
How do we discriminate when a response is correct, vs. when it's "hallucinating" an accurate fact, by coincidence? Are all responses hallucinations, independent of correspondence to ground-truth?
By @prollyjethi - 3 months
I am honestly very skeptical of articles like these. Hallucinations are a feature of LLMs. The only ways to "FIX" it is to either stop using LLMs. Or use a super bias some how.
By @Sergii001 - 3 months
That's all really weird. You can watch how chat gpt gives you advice on which mushrooms are safe. And now it can be just hallucinations
By @threeseed - 3 months
Maybe don't make things up in a blog post about LLMs making things up.

Because you don't know how to fix it. Only how to mitigate it.

By @Mistletoe - 3 months
Is there a way to code an LLM to just say "I don't know" when it is uncertain or reaching some sort of edge?
By @dschuetz - 3 months
I went straight to the "how to fix" section with popcorn in hand and I wasn't disappointed: just add " doubt" layers for self-correction, beginning at the query itself. And then maybe tell the model "do not hallucinate". Sounds like a pun, but I think an AI model actually would take this seriously, because it can't tell the difference.

Context is still a huge problem for AI models, and it's probably still the main reason for hallucinating AIs.

By @rabid_turtle - 3 months
I don't like the output = hallucination

I like the output = creative

By @chefandy - 3 months
Lots of folks in these conversations fail to distinguish between LLMs as a technology and "AI Chatbots" as commercial question answering services. Whether false information was expected or not matters to LLM product developers, but in the context of a commercial question-answering tool, it's irrelevant. Hallucinations are bugs that creates= time-wasting zero-value output, at best, and downright harmful output at worst. If you're selling people LLM pattern generator output, they should expect a lot of bullshit. If you're selling people answers to questions, they should expect accurate answers to their questions. If paying users are really expected to assume every answer is bullshit and vet it themselves, that should probably move from the little print to the big print because a lot of people clearly don't get it.
By @sollewitt - 3 months
"Why LLMs do the one and only thing they do (and how to fix it)"
By @jrflowers - 3 months
I like that none of the suggestions address probabilistic output generation (aside from the first bullet point of section 3C, which essentially suggests that you just use a search engine instead of a language model).

TLDR: Hallucinations are inherent to the whole thing but as humans we can apply bubble gum, bandaids and prayers

By @PittleyDunkin - 3 months
Humans hallucinate, too. We just have less misleading terms for it. Massive mistake in terms of jargon, IMO—"making shit up" is wildly different from the "delusion of perception" implied by hallucination.
By @uz44100 - 3 months
hallucination problem in LLM, been seeing this. Let me know if someone find a fix please