Nodes/Comfy DV Nodes/Ollama Option — Seed
ComfyUI Node

Ollama Option — Seed

Lock or randomize your LLM's randomness

By darth-veitcher·Created 2 years ago·Updated about a month ago· 2
Ollama Option — Seed
  • options
  • options
seed0

If you've done any image generation, you know the seed drill: lock it to reproduce, randomize it to explore. Ollama Option - Seed brings exactly that discipline to your local LLM calls. It's a tiny node - a seed number in, an options bundle out - that slots into the chain feeding Chat Completion, and it decides whether the same prompt gives you the same answer twice.

How it works

comfydv's option nodes are composable little dict-builders. Each one takes an optional options input, adds its one key, and passes the merged bundle on. Ollama Option - Seed adds seed to that bundle. Chain a few of these together (Temperature → Seed → Top P → ...), wire the last one into Chat Completion's options input, and every sampler parameter rides into the chat call in one dict.

The seed semantics match what you already know from image generation:

  • seed = 0 means random - the server picks a seed per request, so identical prompts give you different answers. That's the default.
  • Any non-zero seed means deterministic - same prompt, same model, same other options, same output. That's the one you want when you're comparing two prompt tweaks or debugging why a run produced something weird.

Inputs and output

  • seed - an INT, 0 to 4294967295. The only required input.
  • options (optional) - the OLLAMA_OPTIONS bundle from another option node upstream. Chain through it rather than fanning out.
  • Output: options - wire into the next option node or straight into Chat Completion.

Install

Via ComfyUI Manager (search "comfydv"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/darth-veitcher/comfydv.git

Restart, and run Ollama or llama.cpp as your backend. It lives under dv/ollama/options. No model downloads needed beyond what you already have for chatting.

Gotchas

  • A seed only reproduces an answer if nothing else changed. Change the model, the temperature, the prompt, even the backend (Ollama vs. llama.cpp) and the same seed gives different output. That's not the node lying to you - it's how LLMs work. For meaningful comparison, change one thing at a time with the seed locked, which is the same rule the community applies to image seeds.
  • Structured output and retries interact with seeds. Chat Completion's retry path deliberately rolls a new seed on retry attempts, so a structured_output call that needed retries won't come back byte-identical even with a fixed seed. If you need exact reproducibility there, you're fighting the retry mechanism - worth knowing before you chase it.
  • The chain order matters for override, not composition. All the option nodes merge into one dict, so putting Seed after Temperature still produces both keys. There's no real "order" to respect - just wire them in sequence.
Categorydv/ollama/options

Inputs (2)

NameTypeDefaultDescription
seedINT00–4294967295
optionsoptOLLAMA_OPTIONS

Outputs (1)

NameTypeDescription
optionsOLLAMA_OPTIONS