How ChatGPT, Claude and Gemini actually work
Tokens, next-word prediction, temperature, context windows, and why hallucination is built in.
A large language model (LLM) is a neural network trained on a huge amount of text to do one thing: predict the next piece of text. It does not look facts up in a database. It has learned which words tend to follow which, so well that the output reads like reasoning.
The pieces of text are called tokens. A token can be a whole word, part of a word or a punctuation mark.
At every step the model scores every token it knows and picks one. Then it adds that token to the text and does it again. A setting called temperature controls how adventurous the pick is.
The model produces the most plausible continuation, and a plausible-looking citation, dose or trial name is exactly that. Newer models hallucinate less, especially when they can search or are given the source text, but no model is free of it. For anything you will act on, check against the primary source.
Check yourself
Educational material, not clinical advice. Interactive numbers are teaching examples unless a source is named.