Tuning the model's creativity
The model outputs a distribution: how do we pick a word?
The idea inside
Greedy vs. sampling; temperature, top-k, top-p, penalties.
After this lesson
You can explain temperature, top-k and top-p, and the precision–creativity trade-off.
Where it leads
Long chats get slow and the model 'forgets'…
Inside this lesson
That's the real lesson stage, paused. Claim your pass to operate it.
See how AI actually works, end to end.
This lesson is one stop on the full arc. Unlock all of it, and keep it for life.
What you get
- The 34-lesson main path, a finishable route from a word to agents
- Goal tracks for using AI at work and building AI features
- Boss labs that make you apply a whole act, not just recognize it
- Spaced recall that brings each idea back before you forget
- Course memory: every term defined, with links to where it first appears
- A shareable capability card when you finish the main path
- Lifetime access on every device, every future lesson included
Not videos to watch. You predict, operate the machine, then prove it. That is why it stays.
99 interactive lessons and challenges. No videos, no code.
Free launch pass: lifetime access, no card needed
New here? The first lessons are free to try. Start with lesson 0.1
What this lesson shows
Greedy vs. sampling; temperature, top-k, top-p, penalties.
The question it opens with
The model outputs a distribution: how do we pick a word?
The walkthrough, in the lesson's own words
- The model ranks every next word. Keep tapping the ★ #1 word and watch what it writes.
- One pick, slowed down. Watch how the choice actually happens.
- Now you drive. Move the dial, roll a few words, feel the change.
- Same model, very different vibes, it's all in the knobs.
- See the loop? Greedy is deterministic: the same context keeps scoring the same word #1, so it repeats itself (“...relax and relax and relax”) and sounds robotic. To write like a person, the model has to sometimes pick a runner-up.
- The safest move is to always grab the ★ #1 word. Try it: tap “relax”.
- Keep tapping the same ★ word, the model would too. Watch the sentence.
- Instead of always taking #1, the model rolls a weighted die, each word's odds are its share of the rolls. That's sampling.
- Temperature flattens or sharpens the odds, low = safe and repetitive, high = creative but risky. These knobs tune the model's personality.
- Top-k keeps only a fixed number of top words; top-p keeps the top words until their odds add up to p, both just trim the unlikely tail before sampling, so a stray bad word can't slip in.
- Turning the temperature up makes the model smarter or more capable.
- Temperature only controls randomness in how the next token is picked. Higher is more varied, lower is more focused, but the model's underlying capability is unchanged.
- The same prompt gives a boring identical answer one day and a wild creative one the next. Which knob changed, and which way would you turn it for extracting data from invoices?
- Temperature, the sampling knob. Higher temperature spreads probability for variety; lower concentrates it for consistency. For data extraction or anything that must be exact and repeatable, turn it down; for brainstorming, turn it up.
Key takeaway
I control creativity vs. determinism.
What you can do after this lesson
You can explain temperature, top-k and top-p, and the precision–creativity trade-off.
Check yourself: What does the temperature knob control?
- How predictable vs creative the output is(correct)
- The model's size
- The context length
- The training cost
Temperature flattens or sharpens the probabilities: low keeps the top pick (predictable), high spreads the odds so it takes risks (creative).
Prefer reading first? This lesson has a companion explainer: Temperature
Where it leads: Long chats get slow and the model 'forgets'…
This is the written summary. The lesson itself is interactive: you predict, drag and operate the mechanism above, and the reveal answers you.