Comfy-Org / Comfy-Org/ComfyUI

Possible Non-Deterministic Behavior on rerun with Previously Used Settings

Open
#14,479 1 comment 1 reaction 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

### Custom Node Testing

- [ ] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)

### Expected Behavior

I have a zimage workflow that uses two ModelSamplingAuraFlow nodes: 1 set to 3.1 for the base generation, and another set to 1.5 for the FaceDetailer.

Image

Load Diffusion Model

Load Lora Node

├─ ModelSamplingAuraFlow (shift=3.1)
│ ↓
│ KSampler (Base Generation)

├─ ModelSamplingAuraFlow (shift=1.5)
│ ↓
│ KSampler (FaceDetailer)

I'm confused because, when I rerun the workflow with the exact same settings, it can produce different outputs.

For example:

Initially, the FaceDetailer stage used ModelSamplingAuraFlow 1.5 with a denoise value of 0.33, and it produced some skin artifacts.

Image

Then I decreased the denoise value to 0.30, and it gave me a much cleaner output.

Image

After that, I simply increased the denoise value back to 0.33, and the output much cleaner and noticeably different from the first run.

Image

Another example:

In this run, I started with denoise 0.3 and ModelSamplingAuraFlow 1.5, and it produced some artifacts and strange skin.

Image

Then I increased the denoise to 0.33, and it gave a cleaner output with better skin.

Image

Then I decreased it again to 0.3, and the output is noticeably different from the first run at denoise 0.3, and much cleaner.

Image

I'm not sure whether this is a bug or simply how it works, but as a user, I would expect identical settings to reproduce the same output. This is especially confusing because all these runs were performed in the same ComfyUI session, not across different sessions or machines.

I was wondering if this could be related to patcher behavior, like Could it be caused by model offloading or patch reuse, where the FaceDetailer stage is still using patches from the first ModelSamplingAuraFlow node (shift=3.1)? Is it possible that the patches are being shared or mixed between branches?

https://github.com/user-attachments/assets/52ce4899-d9a4-49c3-8346-912a1b9347b7

### Actual Behavior

.

### Steps to Reproduce

.

### Debug Logs

```powershell
[INFO] got prompt
[INFO] gguf qtypes: F32 (145), BF16 (26), Q8_0 (227)
[WARNING] Dequantizing token_embd.weight to prevent runtime OOM.
[INFO] CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16
[INFO] Using pytorch attention in VAE
[INFO] Using pytorch attention in VAE
[INFO] VAE load device: cuda:0, offload device: cpu, dtype: torch.bfloat16
[INFO] model weight dtype torch.float16, manual cast: None
[INFO] model_type FLOW
[WARNING] WARNING: No VAE weights detected, VAE not initalized.
[INFO] CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16
[INFO] Requested to load SAM3ClipModelWrapper
[INFO] Model SAM3ClipModelWrapper prepared for dynamic VRAM loading. 674MB Staged. 0 patches attached. Force pre-loaded 98 weights: 196 KB.
[INFO] Requested to load AutoencodingEngine
[INFO] Model AutoencodingEngine prepared for dynamic VRAM loading. 159MB Staged. 0 patches attached. Force pre-loaded 108 weights: 182 KB.
[INFO] Model AutoencodingEngine prepared for dynamic VRAM loading. 159MB Staged. 0 patches attached. Force pre-loaded 108 weights: 182 KB.
[INFO] Model AutoencodingEngine prepared for dynamic VRAM loading. 159MB Staged. 0 patches attached. Force pre-loaded 108 weights: 182 KB.
[INFO] Requested to load ZImageTEModel_
[INFO] loaded completely; 5324.48 MB usable, 4816.76 MB loaded, full load: True
[INFO] model weight dtype torch.bfloat16, manual cast: None
[INFO] model_type FLOW
[INFO] Requested to load Lumina2
[INFO] Model Lumina2 prepared for dynamic VRAM loading. 11738MB Staged. 166 patches attached. Force pre-loaded 205 weights: 1045 KB.
100%|████████████████████████████████████████████████████████████████████████████████████| 9/9 [00:29<00:00, 3.28s/it]
[INFO] Requested to load AutoencodingEngine
[INFO] 0 models unloaded.
[INFO] Model AutoencodingEngine prepared for dynamic VRAM loading. 159MB Staged. 0 patches attached. Force pre-loaded 108 weights: 182 KB.
[INFO] Requested to load SAM3
[INFO] Model SAM3 prepared for dynamic VRAM loading. 989MB Staged. 0 patches attached. Force pre-loaded 385 weights: 4608 KB.
[INFO] 0 models unloaded.
[INFO] Model AutoencodingEngine prepared for dynamic VRAM loading. 159MB Staged. 0 patches attached. Force pre-loaded 108 weights: 182 KB.
[INFO] 0 models unloaded.
[INFO] Model AutoencodingEngine prepared for dynamic VRAM loading. 159MB Staged. 0 patches attached. Force pre-loaded 108 weights: 182 KB.
[INFO] Model Lumina2 prepared for dynamic VRAM loading. 11738MB Staged. 166 patches attached. Force pre-loaded 205 weights: 1045 KB.
100%|████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:10<00:00, 2.16s/it]
[INFO] 0 models unloaded.
[INFO] Model AutoencodingEngine prepared for dynamic VRAM loading. 159MB Staged. 0 patches attached. Force pre-loaded 108 weights: 182 KB.
[INFO] 0 models unloaded.
[INFO] Model AutoencodingEngine prepared for dynamic VRAM loading. 159MB Staged. 0 patches attached. Force pre-loaded 108 weights: 182 KB.
[INFO] 0 models unloaded.
[INFO] Model AutoencodingEngine prepared for dynamic VRAM loading. 159MB Staged. 0 patches attached. Force pre-loaded 108 weights: 182 KB.
[INFO] Requested to load Lumina2
[INFO] Model Lumina2 prepared for dynamic VRAM loading. 11738MB Staged. 166 patches attached. Force pre-loaded 205 weights: 1045 KB.
100%|████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:06<00:00, 2.24s/it]
[INFO] 0 models unloaded.
[INFO] Model AutoencodingEngine prepared for dynamic VRAM loading. 159MB Staged. 0 patches attached. Force pre-loaded 108 weights: 182 KB.
[INFO] Prompt executed in 93.57 seconds
[INFO] got prompt
[INFO] Model Lumina2 prepared for dynamic VRAM loading. 11738MB Staged. 166 patches attached. Force pre-loaded 205 weights: 1045 KB.
100%|████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:06<00:00, 2.03s/it]
[INFO] 0 models unloaded.
[INFO] Model AutoencodingEngine prepared for dynamic VRAM loading. 159MB Staged. 0 patches attached. Force pre-loaded 108 weights: 182 KB.
[INFO] Prompt executed in 10.71 seconds
[INFO] got prompt
[INFO] Model Lumina2 prepared for dynamic VRAM loading. 11738MB Staged. 166 patches attached. Force pre-loaded 205 weights: 1045 KB.
100%|████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:05<00:00, 1.97s/it]
[INFO] 0 models unloaded.
[INFO] Model AutoencodingEngine prepared for dynamic VRAM loading. 159MB Staged. 0 patches attached. Force pre-loaded 108 weights: 182 KB.
[INFO] Prompt executed in 10.04 seconds
```

### Other

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.