Back to Home
Inside an LLM

Next Word Prediction

Language models generate text by predicting the next token again and again.

This is a simple learning demo using predefined predictions, not a real AI model.

Interactive Playground
Live Visualization
Current Sentence
Enter text and click Predict…
Possible Next Words

Predictions will appear here

Statistics
Current Tokens
0
Generated Tokens
Pred. Options
Top Prediction
0
Current Step
How It Works
📝
Text
🔤
Tokens
🤖
Predict
Add Token
🔁
Repeat
AI doesn't plan ahead, it picks the next token without knowing what it will write later. Yet coherent text still emerges!
This is why AI streams text gradually, each token is generated one at a time and sent as it's produced.
💡
Key Takeaway

AI responses are built one token at a time by repeatedly predicting what should come next.

Each prediction is made by looking at everything written so far so every new word changes what comes next.