← All tools
EDTOOLKITS GUIDES

Top-k and Top-p: Inspect Which Words Survive Sampling

By Team Edtoolkits · AI learning

Compare candidate filtering and renormalized probabilities on ten fixed next-word options.

Use the guide alongside the working tool.

Open Top-k and Top-p: Trim the Word Tail →

Explore the lesson

Watch a cut-off line trim the tail of word odds.

Set k and p and draw words many times.

Flip the memory card and answer the quick check.

A comparison to try

Start with the weather candidates and apply top-k alone, then top-p alone. Combine the two and inspect which words remain before running the seeded draws.

Read the result

Top-k limits candidate count; top-p keeps the smallest leading group reaching the probability threshold. Combined filtering uses the stricter surviving set, then renormalizes its probabilities. Removed words should never be sampled.

A mistake to avoid

The ten odds are invented and stay fixed, while a real model changes a much larger distribution at every token. Removing strange candidates can constrain variety, but does not independently verify factual accuracy or guarantee appropriate text.

Teaching model and privacy

Ten made-up candidate words with fixed odds. A real model has tens of thousands of candidates, and the odds change at every step. Nothing leaves your browser.

Ready to apply this workflow?

Try Top-k and Top-p: Trim the Word Tail →

Explore a related workflow

All practical guides →

Found unclear instructions or an unexpected result? Contact Team Edtoolkits.

YOUR BROWSER, YOUR CHOICE