Computer Science · Interactive demo

How does an AI chatbot pick its next word?

Move temperature and a deterministic sample point to see illustrative next-token logits become narrow or surprising probabilities.

Created by ExplainerTools.

About this explainer

Made by
ExplainerTools
Format
Interactive demo
Subject
Computer Science
Where it runs
Plays here
Full tool
Open the tool page
Published
Added to collection
  • language models
  • tokens
  • softmax
  • temperature

How the model works

1 See

A chatbot does not write a paragraph in one leap. It repeatedly scores possible next tokens, selects one and adds it to the context.

2 Change
  • Temperature0.1 · concentrated → 2.0 · spread out
  • Sample point0 → 1

Presets Predictable · T 0.2Balanced · T 1.0Rare draw · T 1.8

Model · illustrative token logits

Five invented token logits and a deterministic sample point illustrate softmax temperature; they are not output from a named chatbot or measured prompt.

Model notes and sources

Model. Five illustrative next tokens have fixed scores (logits) z. Temperature T turns them into probabilities with softmax: pi = exp(zi/T)/Σjexp(zj/T). Lower T concentrates probability on the largest logit; higher T spreads it out. The sample point from 0 to 1 selects the interval it lands in, making the choice deterministic and inspectable in this tool.

Illustrative only. “The moon rose over the …” and the logits for horizon, trees, city, water and piano were written for this explainer. They are not output from a named model, are not calibrated, and must not be read as a benchmark. Real tokenizers often split words into smaller pieces, real vocabularies contain tens or hundreds of thousands of tokens, and products may use greedy decoding, top-k, top-p, repetition penalties or other sampling rules.

What temperature cannot do. A lower temperature does not make a model factually correct; it only changes how sharply it favors the scores already produced. A higher temperature does not create knowledge; it raises the chance of lower-scored continuations. The photo is an AI-generated illustration with a blank screen; every visible word, number and probability is code-drawn.

Sources: Google for Developers, Softmax (scores mapped to a probability distribution); Hinton, Vinyals and Dean (2015), Distilling the Knowledge in a Neural Network (softmax temperature); Holtzman et al. (2020), The Curious Case of Neural Text Degeneration (decoding and nucleus sampling).

An ExplainerTools Original.

Watch it move

See how the world works.

Explore interactive ideas in space, science, math, and more. Try a demo, read an interactive article, watch a short video, and follow what makes you curious.

Find your next rabbit hole

New Originals

Change one thing and see why.

The three newest models, each with a short film. Watch the question, then play with the answer.

All Originals

Follow your curiosity

A collection of small doors into big ideas.

Format

Subject

Topic

Sort by

Rankings count activity here on ExplainerTools. Newest means added to this collection.

Loading collection…

Opening the collection…

Make something click.

Made an explainer, or found one you love? Give it a place in the collection.

Your next question

What do you wish someone would explain?

Send one question. If it becomes an ExplainerTools Original, you can hear when it is ready.

One weekly email with new explainers. We send a confirmation link first, and you can unsubscribe at any time.

We save your question, your email if you add one, and whether you asked to subscribe. Privacy

Share something worth understanding.

An interactive demo, an interactive article, or an educational video. Every suggestion is reviewed before it joins the collection.

Submit the creator’s original link. We credit creators and link to their work.

A collection for the curious.

ExplainerTools collects interactive explainers, visual essays, and educational videos that help an idea make sense. Browse by subject, follow a topic, or find a creator whose way of explaining speaks to you.

The work belongs to its creators.

Every entry credits its original creator. Supported experiences play here, with a link to the creator’s original work available in the player. Inclusion does not imply a partnership or endorsement.

How rankings work

Views, likes, and bookmarks count activity on ExplainerTools. They don’t include views or likes from a creator’s website or social accounts. Newest means most recently added to this collection. Ties are ordered by date added, then our curated catalog order.

Your collection

New likes and bookmarks require a free account and sync across devices when sign-in is available. Previously saved items from this browser may remain visible here.

Browse the catalog data or read about privacy.