Why LLMs hallucinate Dark _ □ ✕
  • Posts
  • About
  • Debug
Post

Why LLMs hallucinate

Published
2026-08-06 00:00 UTC (precision: second)
Source feed
Kevin Cunningham - @dolearning [exclude this blog]
Link
https://kevincunningham.co.uk/posts/why-llms-hallucinate/
Canonical
https://kevincunningham.co.uk/posts/why-llms-hallucinate
Length
2921 runes
Extracted text
Ask a question of an LLM and you'll get an answer. Sounds good but is the answer actually correct and valid? How do I compare two passwords in a timing-safe way? Use secureCompare(a, b) from `crypto.utils`. It is timing-safe and recommended. This might be spot on but it's told with a level of confidence and specificity that makes it challenging to disagree with. The problem is that in Node, the function is actually timingSafeEqual. Where is the LLM getting the information from? The training data LLMs need a lot of data to train on. Thinking of any large amount of code and some of it is going to be excellent on every metric, some of it is going to be terrible on those same metrics and, statistically, most of it is going to be somewhere in the middle. That is true of security, performance, correctness or any other measure. The other wringle in training data is that it has a cut-off date. As APIs change, software evolves and information updates the LLM doesn't 'know' things have changed. So, that's the first place. The prompt What you actually type to the LLM is key. The quality of the question (and there are many frameworks that are available to improve that) is going to greatly imapct the quality of that answer. Garbage in and garbage out. The slightly unnerving piece is that if your question is vague and unclear, the LLM will infer meaning. It will guess. The context The other data that you provide with the prompt will also inform the LLM predictation of the answer. Snippets of code, information about your codebase, previous turns in a conversation - all of these will be used to help predict the next token. Tool call results LLMs can call tools when they (non-deterministically) decide they need to. This could be web searches, MCPs with other information or grep/cat calls to your codebase. Given all of that information we'd hope that the response is going to be correct. LLMs are trained to give answers that look right but, inherently, they are not able to tell if the responses are correct. We need to be able to verify these responses. Check that API/method names are right. Check official documentations rather than AI summaries. Package names. Are these real? Have they been made up? Version-specific claims. Claims like as of x you should use y are subject to change and are easily made up. Security, performance, correctness, style - all of the things that we need to stand behind should be checked and confirmed. Confidence isn't correctness and hallucinated answers look right - that's what makes this kind of problem dangerous. The pattern we need to follow is pretty well-known by now but it's good to repeat. Prompt + context => response validateResponse(response) We are the ones responsbile for the finished product. It's our users and employers who will feel the impact of any problem and it will be us, not the LLM, who might lose our jobs or customers if it all goes wrong.
Stored topics

Every stored assignment is listed, including rows below the current cutoff (0.75), so a missing tag can be explained.

Concept Code Score Meter Margin Origin Path
science and technology science-and-technology 0.99 4.39 ↑derived from 20000763 science and technology
technology and engineering technology-and-engineering 0.99 4.39 ↑derived from 20000763 science and technology > technology and engineering
information technology and computer science information-technology-and-computer 0.99 4.39 direct science and technology > technology and engineering > information technology and computer science
economy, business and finance economy-business-and-finance 0.99 4.25 ↑derived from 20000225 economy, business and finance
products and services products-and-services 0.99 4.25 ↑derived from 20000225 economy, business and finance > products and services
computing and information technology computing-and-information-technology 0.99 4.25 direct economy, business and finance > products and services > computing and information technology
Information security information-security 0.95 2.99 direct science and technology > technology and engineering > information technology and computer science > Information security
software and applications software-and-applications 0.92 2.41 direct economy, business and finance > products and services > computing and information technology > software and applications
Cryptography cryptography 0.90 2.24 direct science and technology > technology and engineering > information technology and computer science > Cryptography
artificial intelligence artificial-intelligence 0.87 1.87 direct science and technology > technology and engineering > information technology and computer science > artificial intelligence
Software development software-development 0.84 1.67 direct economy, business and finance > products and services > computing and information technology > software and applications > Software development
Open source open-source 0.71 0.88 direct economy, business and finance > products and services > computing and information technology > software and applications > Open source
natural science natural-science 0.28 -0.94 ↑derived from 20000719 science and technology > natural science
biology biology 0.28 -0.94 direct science and technology > natural science > biology
lifestyle and leisure lifestyle-and-leisure 0.24 -1.17 ↑derived from local:mmorpg lifestyle and leisure
leisure leisure 0.24 -1.17 ↑derived from local:mmorpg lifestyle and leisure > leisure
game game 0.24 -1.17 ↑derived from local:mmorpg lifestyle and leisure > leisure > game
video game video-game 0.24 -1.17 ↑derived from local:mmorpg lifestyle and leisure > leisure > game > video game
MMORPG mmorpg 0.24 -1.17 direct lifestyle and leisure > leisure > game > video game > MMORPG
Tabletop gaming tabletop-gaming 0.15 -1.77 direct lifestyle and leisure > leisure > game > Tabletop gaming
society society 0.06 -2.70 ↑derived from 20001300 society
fundamental rights fundamental-rights 0.06 -2.70 ↑derived from 20001300 society > fundamental rights
privacy privacy 0.06 -2.70 direct society > fundamental rights > privacy
scientific research scientific-research 0.06 -2.71 ↑derived from 20000739 science and technology > scientific research
scientific exploration scientific-exploration 0.06 -2.71 ↑derived from 20000739 science and technology > scientific research > scientific exploration
space exploration space-exploration 0.06 -2.71 direct science and technology > scientific research > scientific exploration > space exploration
labour labour 0.06 -2.80 direct labour
media and entertainment industry media-and-entertainment-industry 0.05 -3.05 ↑derived from 20001293 economy, business and finance > products and services > media and entertainment industry
streaming service streaming-service 0.05 -3.05 direct economy, business and finance > products and services > media and entertainment industry > streaming service
crime, law and justice crime-law-and-justice 0.04 -3.06 ↑derived from 20000086 crime, law and justice
crime crime 0.04 -3.06 ↑derived from 20000086 crime, law and justice > crime
cyber crime cyber-crime 0.04 -3.06 direct crime, law and justice > crime > cyber crime
sport sport 0.04 -3.20 ↑derived from 20001183 sport
competition discipline competition-discipline 0.04 -3.20 ↑derived from 20001183 sport > competition discipline
eSports esports 0.04 -3.20 direct sport > competition discipline > eSports
social sciences social-sciences 0.03 -3.44 direct science and technology > social sciences
Self-hosting self-hosting 0.03 -3.54 direct economy, business and finance > products and services > computing and information technology > Self-hosting
environment environment 0.03 -3.58 direct environment
arts, culture, entertainment and media arts-culture-entertainment-and-media 0.02 -3.84 ↑derived from local:blogging arts, culture, entertainment and media
mass media mass-media 0.02 -3.84 ↑derived from local:blogging arts, culture, entertainment and media > mass media
social media social-media 0.02 -3.84 ↑derived from local:blogging arts, culture, entertainment and media > mass media > social media
Blogging blogging 0.02 -3.84 direct arts, culture, entertainment and media > mass media > social media > Blogging
books and publishing books-and-publishing 0.02 -3.96 direct economy, business and finance > products and services > media and entertainment industry > books and publishing
arts and entertainment arts-and-entertainment 0.02 -3.97 ↑derived from 20000013 arts, culture, entertainment and media > arts and entertainment
literature literature 0.02 -3.97 direct arts, culture, entertainment and media > arts and entertainment > literature
film industry film-industry 0.02 -4.04 direct economy, business and finance > products and services > media and entertainment industry > film industry
religion religion 0.01 -4.24 direct religion
disaster, accident and emergency incident disaster-accident-and-emergency-incident 0.01 -4.40 direct disaster, accident and emergency incident
hobby hobby 0.01 -4.49 direct lifestyle and leisure > leisure > hobby
television television 0.01 -4.53 direct arts, culture, entertainment and media > mass media > television
education education 0.01 -4.58 direct education
health health 0.01 -4.61 ↑derived from 20000464 health
health treatment and procedure health-treatment-and-procedure 0.01 -4.61 direct health > health treatment and procedure
conflict, war and peace conflict-war-and-peace 0.01 -4.64 direct conflict, war and peace
politics and government politics-and-government 0.01 -4.93 direct politics and government
human interest human-interest 0.01 -4.97 direct human interest
animation animation 0.01 -5.01 direct arts, culture, entertainment and media > arts and entertainment > animation
disease and condition disease-and-condition 0.01 -5.08 ↑derived from 20000458 health > disease and condition
mental health and disorder mental-health-and-disorder 0.01 -5.08 direct health > disease and condition > mental health and disorder
family family 0.01 -5.24 direct society > family
podcast podcast 0.01 -5.26 direct economy, business and finance > products and services > media and entertainment industry > podcast
history history 0.00 -5.32 direct science and technology > social sciences > history
public health public-health 0.00 -5.49 direct health > public health
exercise and fitness exercise-and-fitness 0.00 -5.55 direct lifestyle and leisure > wellness > exercise and fitness
wellness wellness 0.00 -5.55 ↑derived from 20001239 lifestyle and leisure > wellness
award and prize award-and-prize 0.00 -5.64 direct human interest > award and prize
consumer goods consumer-goods 0.00 -5.77 ↑derived from 20001160 economy, business and finance > products and services > consumer goods
handicrafts handicrafts 0.00 -5.77 direct economy, business and finance > products and services > consumer goods > handicrafts
weather weather 0.00 -5.78 ↑derived from 20001128 weather
weather forecast weather-forecast 0.00 -5.78 direct weather > weather forecast
board game board-game 0.00 -6.08 direct lifestyle and leisure > leisure > game > board game
card game card-game 0.00 -6.10 direct lifestyle and leisure > leisure > game > card game
lifestyle lifestyle 0.00 -6.13 ↑derived from 20001257 lifestyle and leisure > lifestyle
house and home house-and-home 0.00 -6.13 ↑derived from 20001257 lifestyle and leisure > lifestyle > house and home
gardening gardening 0.00 -6.13 direct lifestyle and leisure > lifestyle > house and home > gardening
climate change climate-change 0.00 -6.14 direct environment > climate change
diet diet 0.00 -6.35 direct health > health treatment and procedure > diet
culture culture 0.00 -6.42 direct arts, culture, entertainment and media > culture
visual arts visual-arts 0.00 -6.58 ↑derived from 20000036 arts, culture, entertainment and media > arts and entertainment > visual arts
photography photography 0.00 -6.58 direct arts, culture, entertainment and media > arts and entertainment > visual arts > photography
food and drink enthusiasm food-and-drink-enthusiasm 0.00 -6.82 direct lifestyle and leisure > leisure > hobby > food and drink enthusiasm
music music 0.00 -6.85 direct arts, culture, entertainment and media > arts and entertainment > music
travel and tourism travel-and-tourism 0.00 -8.01 direct lifestyle and leisure > leisure > travel and tourism

← Back to posts

feedtagger 0.1.0-dev model: modernbert-base-zeroshot-v2.0/int8@all-s256 660 posts 0 unclassified min score 0.75