// the rule
Qwen3's model card, thinking mode:
DeepSeek R1's card:
Temperature 0 is greedy decoding: llama.cpp's sampler, for example, handles temp <= 0 by keeping only the single highest-scoring token. Greedy can fall into repetition on these models. It doesn't always.
Why it runs so long
Ollama's Modelfile docs list num_predict as "(Default: -1, infinite generation)". In the code, open-ended output is bounded at ten context windows, so a stuck answer stops eventually, but only after ten windows' worth of the same paragraph. The exact token count scales with your context size.
The fix, and where the trap is
- Stock Ollama is fine: the library's qwen3 and deepseek-r1 params ship temperature 0.6 (qwen3.8:27b ships 1).
- The trap is an override: your code, your client, or a Modelfile that sets
temperature 0. - Use the card's setting for the exact model you pulled. Qwen3: 0.6 thinking, 0.7 non-thinking. DeepSeek R1: 0.6. Qwen3.8: 1.0 thinking.
- Set a generous output cap (
num_predict). Generous means generous: the Qwen3 card recommends 32,768 output tokens for most queries, so a tight cap cuts the reasoning off.
A correction to our own video
Our temperature explainer said to go near zero for facts, code and extraction, and to tune temperature or top p but not both. For thinking models, the model card overrides both: use its temperature, and its top p and top k, together.
Sources: Qwen3-8B, DeepSeek-R1 and Qwen3.8-27B model cards (Hugging Face); Ollama Modelfile docs and library params; llama.cpp sampler source. Verified 2026-10-31.
One concept a week. Free.
The deeper, copy-paste version of each ToolCall short — in your inbox.
// total: 0.00 · spam: void · unsubscribe: one click
