Lab
What happens inside an LLM when you write to it?
We’ve gotten used to treating artificial intelligence as a black box, but what happens inside is much more interesting. This space is for opening the lid. Type any sentence below and watch how the model processes it in real time. No simulations: just the real data and numbers the machine calculates with.
Your sentence breaks into pieces
An LLM doesn’t read letters: it reads tokensChunks of text —a whole word, a fragment or a symbol—. The model doesn’t see letters: it sees these pieces., and gives each piece a number. Type and watch.
GPT-4o tokenizer · 0/600
Loading the tokenizer
Words become coordinates
Before predicting, the model turns each text into an embeddingA list of hundreds of numbers (a vector) that places the text’s meaning in a space. Similar texts land close together.: a list of numbers that captures its meaning. To measure how alike two texts are, it compares their vectors with cosine similarityThe cosine of the angle between two vectors. 1 = same direction (very alike), 0 = unrelated. With real text it rarely reaches the extremes..
Compare with
meaning · vectors
Edit the phrases and press “Compare”.
The bars are scaled against each other so they read well; the number is the real cosine. With real embeddings it rarely drops below 0 or reaches 1 — what matters is the ranking, not the absolute value.
The model doesn’t choose: it computes probabilities
Give it the start of a sentence. The model doesn’t “decide” the next word: it computes each candidate’s probabilityFor every possible word, the model estimates how well it “fits” as the continuation. Then it rolls a die loaded with those probabilities. and rolls a loaded die.
prediction · next token
Type the start of a sentence and press “Predict”.
0 = always the likeliest · high = more chaotic
These are the likeliest candidates. Temperature rescales them right here in your browser, without asking the model again.