NeuralLoot Behind the Scenes

Be the LLM: guess a language model's next word, change temperature and top-p, and see why models hallucinate

Level 1 · Be the LLMGuess the AI's top next word.
Score 0
Prompt
Round 1/3
Level 1Be the LLM

The AI scores every possible next word. Which one wins?

What's real? Real math vs toy parts, sources

The mechanism is real. A language model reads the text so far and gives every token in its vocabulary a score (a "logit"). Softmax turns scores into probabilities: pi = exp(zi/T) / Σj exp(zj/T). Then one token is drawn at random in proportion to those probabilities, appended, and the loop repeats. This page runs exactly that math in your browser: real softmax with temperature T, and real top-p (nucleus) truncation, the smallest set of top tokens whose probabilities add up to at least p, renormalized before the draw (Holtzman et al. 2019, Eq. 2 and 3). The orb is a weighted random draw from the bars you see.

The probabilities are toy. No model ran here. Each prompt has 8 to 12 hand-written candidates with illustrative probabilities (we treat them as the T = 1 distribution, so logits are their logs). Real models score their whole vocabulary: GPT-2's has 50,257 tokens. Tokens are often word pieces, not whole words. "Tomas Ferrel" is a made-up person.

Level 1, picking. Picking the single top word every time is greedy decoding; it is what temperature 0 approaches. Holtzman et al. found greedy text from GPT-2 Large repeated itself in 73.66% of generations (human text: 0.28%), one reason chat apps sample instead.

Level 2, temperature. Dividing scores by T below 1 sharpens the odds toward the favorite; above 1 flattens them so long shots get real chances. It reshapes odds, it never adds knowledge. OpenAI's API accepts temperature from 0 to 2 (default 1). Anthropic's API accepts 0 to 1 (default 1.0), and its docs now say models released after Claude Opus 4.6 no longer support setting temperature or top_p.

Level 3, top-p. Holtzman et al. (2019) proposed nucleus sampling because a model's distribution has an "unreliable tail" of tens of thousands of low-probability tokens that, added together, get picked too often. Cutting it keeps text coherent without making it repetitive. In their tests nucleus sampling with p = 0.95 scored best on HUSE, a combined human and statistical quality measure (0.97).

Level 4, hallucination. Kalai, Nachum, Vempala and Zhang (OpenAI and Georgia Tech, Sept 2025) argue models hallucinate because training and evaluation reward guessing over admitting uncertainty. Facts with no pattern, like a birthday seen once, can't be learned from patterns, so a well-trained model spreads its bets across plausible answers, and sampling always outputs one of them, fluently. Asked for a birthday three times, DeepSeek-V3 gave three different wrong dates. On accuracy-only tests, a guess beats "I don't know", which always scores zero. OpenAI's SimpleQA comparison: o4-mini 24% right, 75% wrong, 1% abstained; gpt-5-thinking-mini 22% right, 26% wrong, 52% abstained.

Real numbers vs toy parts

FigureValueSource
GPT-2 vocabulary size50,257 tokensRadford et al. 2019, Sec. 2.3
Greedy decoding repetition (GPT-2 Large)73.66% of generations vs 0.28% for human textHoltzman et al. 2019, Table 1
Temperature rangeOpenAI API 0 to 2, default 1; Anthropic API 0 to 1, default 1.0OpenAI API reference; Anthropic Messages API docs
Nucleus sampling, best HUSE scorep = 0.95, HUSE 0.97Holtzman et al. 2019, Table 1
Birthday asked 3 timesDeepSeek-V3 gave 3 incorrect datesKalai et al. 2025, Sec. 1
SimpleQA, o4-mini24% right, 75% wrong, 1% abstainOpenAI, "Why language models hallucinate", Sept 5 2025 (from the GPT-5 system card)
SimpleQA, gpt-5-thinking-mini22% right, 26% wrong, 52% abstainsame
Prompts, candidate words, their probabilities, the person "Tomas Ferrel"hand-written, illustrativeToy
Score, levels, goals ("top word ≥ 80%")game designToy
Softmax with temperature, top-p cutoff, weighted random drawexact math, run liveHoltzman et al. 2019, Eq. 2 to 4