Back to Home
Inside an LLM

Top-P Sampling

Top-P controls how many likely next words the AI is allowed to choose from.

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

Interactive Playground
0.90
0.1
Narrow
0.5
Moderate
1.0
All words
Sentence So Far
Your sentence will grow here…
Last chosen: Words added: 0
Live Visualization
Cumulative Probability
0% Top-P cutoff: 90% 100%
Word Probabilities
InAllowed OutExcluded
💡
Key Takeaway

Top-P limits the AI to a group of likely words, helping control randomness while still allowing variety.

A low Top-P (e.g. 0.3) means only the top 1-2 words are available. A high Top-P (e.g. 0.95) opens up many more options. Most AI systems use 0.9 by default.