hemshield
Two dials that control how an AI picks its next word, and why they matter more than you think.
Imagine a student answering a quiz. At temperature = 0, they always write the safest, most obvious answer, "The capital of France is Paris." At temperature = 2, they've had three energy drinks: they might still say Paris, but could also say "the city where croissants rule the universe." The knowledge is the same, what changes is how willing they are to take a risk on an unusual answer.
Imagine a chef choosing a dish for tonight's special. Before deciding, they first write a shortlist: the most likely options that together cover 90% of what guests might want. Anything below that, the pickled seaweed ice cream, gets crossed off entirely, no matter what. Top_p is that shortlist threshold. At top_p = 1.0, nothing is crossed off. At top_p = 0.1, only the top one or two dishes survive.
Reshapes all probabilities. High temp = flat curve. Low temp = steep curve.
Walks down the reshaped list, adds up probabilities, cuts off the tail.
Randomly draws one word from what's left, weighted by its probability.
Key differences at a glance
| Property | temperature | top_p |
|---|---|---|
| What it does | Reshapes probabilities, stretches or squashes the whole curve | Hard filters, removes words below a cumulative threshold |
| Analogy | A student's risk appetite on an exam | A chef's shortlist before choosing tonight's special |
| At minimum | 0 → always picks the single most likely word | ~0 → only one word survives the cut |
| At maximum | 2 → all words become nearly equally likely | 1.0 → every word in the vocabulary is allowed |
| Changes %? | Yes, every word's probability shifts up or down | No, probabilities stay the same, words just get removed |
| Common default | 1.0 | 1.0 (effectively off) |
| Use both? | Generally no, adjust one at a time. Temperature is your main dial; top_p is a safety net. | |