The Token Prediction Playground

A language model has one job: look at the text so far and guess the next token (here, a word). It does this by counting patterns it saw in its training data — nothing more. Play with the tiny model below to see where that works beautifully, and where it falls apart.

Temperature 0 = always pick the top word (safe, but loops). Higher = more random (creative, but wanders). This is the same knob you set on a real model.

The model's guesses for the next word

Try these — capability vs. limitation

Click a starter, then press Predict a few times and watch the confidence bars.

What you're seeing

An unplugged-style, in-browser demo for CS357: Foundations of Artificial Intelligence. It trains a small trigram word model (with bigram/unigram back-off) entirely in your browser on the short sample text below — no network, no real LLM. The point is the mechanism, not the scale. View source to read the ~60 lines of model code. Released under CC BY-NC-SA 4.0.