Skip to content
Articles
TechnicalReproducibilityImage ModelsComfyUI

Why the Same Seed Can Produce a Different Image

A controlled Z-Image-Turbo experiment about starting noise, pixel equality, workflow provenance, runtime versions, and GPU determinism.

Published Jul 22, 2026Updated Jul 23, 202615 min readDifficulty: Intermediate3/5
In this article
Diagram showing seed, workflow, runtime, and hardware converging on decoded image pixels
A seed controls the random starting point. Reproducing an output also requires the same graph, model files, numeric settings, software behavior, and comparison method.

The Short Answer

A seed selects a repeatable stream of pseudo-random numbers. In a latent image workflow, those numbers usually construct the starting noise. The seed does not contain a hidden picture, and it does not identify a universal image that every model can recover.

A better definition

A seed is one input to a deterministic recipe. It is not the recipe. Change the model, prompt encoding, dimensions, scheduler, sampler, denoise strength, runtime, or hardware behavior and the same integer can lead somewhere else.

What The Seed Actually Controls

Pseudo-random number generators turn a compact state into a long sequence of values. Setting the same seed resets the generator to the same state, so calls made in the same order can produce the same random tensor. For text-to-image generation, that tensor becomes the initial noisy latent.

g = PRNG(seed)
zT = sampleNormal(g, shape)
image = Decode(Sample(zT, conditioning, schedule, model))
The seed initializes a generator that produces the starting latent noise.

The shape matters. A 768 by 512 latent consumes random values in a different arrangement than a 1024 by 1024 latent. Changing batch size can also change how the random sequence is consumed.

A Controlled Sage3 Experiment

We ran Z-Image-Turbo on Sage3 with one prompt, no LoRA, nine steps, CFG 1, the res_multistep sampler, and a 768 by 512 latent. The first two runs used the same seed and settings. The third changed the seed by exactly one. The fourth restored the original seed but changed the scheduler from simple to normal.

Four Z-Image-Turbo robot generations comparing an exact repeat, a seed change, and a scheduler change
Repeat A and Repeat B decode to exactly the same RGB pixels. Adding one to the seed changes the robot and framing. Keeping the seed but changing the scheduler preserves the broad concept while substantially changing detail and image quality.

The seed-plus-one result is not a nearby edit. Pseudo-random sequences are designed so neighboring seeds do not produce neighboring noise fields. The normal-scheduler result begins with the original seed but visits a different sequence of noise levels, so its denoising path diverges.

The PNG Files Differed, But The Pixels Did Not

The two repeated outputs had different SHA-256 hashes as complete PNG files. That initially looked like a failed repeat. We then decoded both images to raw RGB bytes and hashed those buffers. The pixel hashes were identical:

repeat_a file SHA-256: edc1733d...f15998f8f
repeat_b file SHA-256: 213ccef5...36ef6034

repeat_a RGB SHA-256: 25e7d1cf...d3eb16932
repeat_b RGB SHA-256: 25e7d1cf...d3eb16932

exact file match:  false
exact pixel match: true

ComfyUI embeds workflow information in PNG metadata. Repeat B added a second identical ModelSamplingAuraFlow wrapper with shift 3. This changed the graph hash and forced a fresh sampler execution while leaving the effective sampling patch unchanged. The container metadata changed, but the decoded picture did not. A regression test must say whether it expects the same file bytes, the same decoded pixels, a small numeric tolerance, or only a perceptually equivalent image.

The Reproducibility Dependency Stack

  1. Prompt bytes and encoding. Whitespace, templates, tokenizer versions, and encoder weights can matter.
  2. Model files. Record exact filenames and preferably cryptographic hashes.
  3. Graph structure. Node types, connections, custom-node versions, and hidden defaults belong to the recipe.
  4. Sampling inputs. Seed, steps, CFG, sampler, scheduler, denoise, shift, dimensions, and batch size.
  5. Numeric execution. Dtype, quantization, attention implementation, and offloading can alter rounding.
  6. Runtime. ComfyUI, PyTorch, CUDA, driver, and custom-node versions.
  7. Hardware. CPU and GPU backends may choose different kernels or accumulation behavior.

This is why sharing only a seed is weak provenance. Sharing a workflow JSON is better. Sharing the workflow, model hashes, environment versions, and input asset hashes is much stronger.

Why GPU Work Can Be Nondeterministic

Parallel hardware may perform reductions in different orders. Floating-point addition is not perfectly associative, so a different accumulation order can alter low bits. Some CUDA operations deliberately use nondeterministic algorithms because they are faster.

PyTorch provides torch.use_deterministic_algorithms(True) to select deterministic implementations or raise an error where none is available. Its reproducibility guide still states that complete reproducibility is not guaranteed across releases, commits, platforms, or CPU and GPU execution.

Tiny numeric changes can grow

Generative sampling is iterative. A small difference at one denoising step becomes input to the next step. The final pixels can diverge even when the initial discrepancy was below visual significance.

What A Reproduction Manifest Should Record

{
  "model": {
    "file": "z_image_turbo_bf16.safetensors",
    "sha256": "..."
  },
  "text_encoder": "qwen_3_4b.safetensors",
  "vae": "ae.safetensors",
  "prompt_sha256": "...",
  "seed": 918273645,
  "steps": 9,
  "cfg": 1.0,
  "sampler": "res_multistep",
  "scheduler": "simple",
  "width": 768,
  "height": 512,
  "comfyui": "0.28.2",
  "pytorch": "2.9.0+cu128",
  "gpu": "NVIDIA GeForce RTX 3090"
}

For private user inputs, store secure asset identifiers and hashes rather than exposing files or signed URLs in public logs. Provenance should make a run explainable without weakening privacy.

A Practical Testing Method

  • Freeze one baseline workflow and input set.
  • Run it twice in the same process and compare decoded pixels.
  • Run it after model unload and process restart.
  • Run it after dependency upgrades and record any divergence.
  • Use exact comparison for deterministic paths and documented tolerance for nondeterministic paths.
  • Keep one perceptual metric or human review step for changes that are numerically different but visually harmless.

Frequently Asked Questions

Does the same seed guarantee the same image?

Only inside a sufficiently controlled environment. The model, workflow, prompt encoding, dimensions, scheduler, sampler, runtime, libraries, kernels, and hardware can all affect the result.

Why did two identical images have different PNG hashes?

The PNG containers held different embedded workflow metadata. Their decoded RGB pixel buffers had the same hash. File equality and pixel equality answer different questions.

Should production systems force deterministic algorithms?

Use deterministic execution for regression tests and controlled comparisons when practical. It can reduce performance, and complete reproducibility across releases and devices is not guaranteed.

Sources

The experiment manifest is published with the article assets. These primary references define the reproducibility limits.

Keep reading

Related articles

All guides
Matrix diagram showing a frozen weight matrix plus the product of two narrow LoRA matrices
TechnicalImage Models

How LoRA Changes a Model With Two Small Matrices

See the matrix math behind LoRA, calculate exact parameter savings, understand rank and alpha, and learn how adapters train, merge, stack, and fail.

16 min readDifficulty 4/5
Why the Same Seed Can Produce a Different Image | Movey