Ollama: How to generate deterministic results

By default, Ollama produces non-deterministic output: The same prompt will yield slightly different results each time. To get reproducible outputs, you must set both temperature: 0 and a fixed seed in the request options.

curl http://localhost:11434/api/chat -d '{
  "model": "qwen3.5:35b",
  "messages": [
    {
      "role": "user",
      "content": "Extract the invoice total from this document",
      "images": ["iVBORw0KGg..."]
    },
  ],
  "options": {
    "seed": 101,
    "temperature": 0
  }
}'

That said, you might not really need reproducible outputs very often. If you chose to use an LLM in production, better get used to non-deterministic behavior.. :-)

Michael Leimstädtner