YedaAI Blog
Yeda AI Tips · #005

Your AI Has Creativity Dials

When a language model writes, it doesn't "choose" the next word — it computes a probability for every possible next token and then samples one. The sampling parameters are your dials over that choice. Most developers ship with the defaults and then wonder why their extraction pipeline is flaky or their brainstorming bot is boring.

The three dials

  1. Temperature — scales the probability distribution before sampling. Low (0–0.3): the likeliest token almost always wins — predictable, factual, repetitive. High (0.8–1.0+): unlikely tokens get real chances — creative, surprising, occasionally unhinged.
  2. Top-K — hard-caps the candidate pool: "only ever pick from the K likeliest tokens." top_k: 5 on "the sky is ___" means the model chooses among ~blue, cloudy, dark, clear, falling — and nothing weirder. Blunt but effective.
  3. Top-P (nucleus sampling) — the adaptive version: pick from the smallest pool of tokens whose probabilities sum to P. With top_p: 0.9, a confident model might have a 2-token pool; an uncertain one might have 15. It flexes with the model's own confidence, which is why it generally beats top-k in practice.

Rules of thumb

TaskSetting
Data extraction, JSON outputtemperature ≈ 0–0.2
Code generationtemperature ≈ 0–0.4
Summaries, support answerstemperature ≈ 0.3–0.6
Brainstorming, creative copytemperature ≈ 0.8–1.0
Fighting weird outputstop_p 0.9 (don't stack with high temperature)

Set temperature or top_p, not both — on Claude 4+ models passing both is an error, and elsewhere it's just fighting yourself.

The power-user caveat: the newest models removed the dials

Claude Opus 4.7+, Opus 4.8, Sonnet 5, and Fable 5 reject temperature, top_p, and top_k entirely (HTTP 400). On those models you steer with:

If you were using temperature: 0 for "determinism" — it never guaranteed identical outputs anyway. Tighter prompts + low effort is the modern equivalent.

Resources

Building an AI feature? Yeda AI designs, audits, and ships production LLM systems.

Talk to us · Read the blog