Determinism and Current Claude Models
Same Prompt, Different Answers
Because generation samples tokens, the same prompt can give different wording each time. With a fixed random seed and the same table, our toy sampler is fully repeatable; real hosted LLMs are not guaranteed to be, even with temperature 0, because of batching and hardware details.
Example
Same seed → same output; different seed → different output:
import random
options = ["on the way", "being packed", "out for delivery"]
weights = [0.5, 0.3, 0.2]
for seed in (42, 42, 7):
rng = random.Random(seed)
print(seed, [rng.choices(options, weights)[0] for _ in range(3)])Output
42 ['being packed', 'on the way', 'on the way'] 42 ['being packed', 'on the way', 'on the way'] 7 ['on the way', 'on the way', 'being packed']
How Current Claude Models Handle It
Note: On current Claude models (Claude Opus 5.5, Sonnet 5.5, Haiku 5.5) the sampling parameters temperature, top_p and top_k are rejected with a 400 error (non-default values on Sonnet and Haiku, any value on Opus). Learn them as concepts (they are still used by many other APIs and by open models in Ollama), but control Claude's output with clear prompts, examples, max_tokens, stop sequences and the effort setting.
response = client.messages.create(
model="claude-opus-5-5",
max_tokens=2000,
output_config={"effort": "low"}, # low | medium | high | xhigh | max
messages=[{"role": "user", "content": "Classify: 'Payment debited but order not placed'"}],
)- effort controls how much the model thinks before answering:
lowis fast and cheap for simple tasks,high/maxfor hard reasoning. - For repeatable outputs: fixed instructions, a strict output format (JSON schema, covered in the medium level), and checks in your code.