Nodes/ComfyUI-piFlow/pi-Flow Sampler
ComfyUI Node

pi-Flow Sampler

The 4-step sampler that doesn't flatten every seed into the same image

By Lakonik·Created 10 months ago·Updated 17 days ago· 186
pi-Flow Sampler
  • model
  • conditioning
  • latent_image
  • LATENT
seed0
steps4
substeps128
final_step_size_scale0.50
diffusion_coefficient0.00
gm_temperatureauto
manual_gm_temperature1.00
denoise1.00

pi-Flow Sampler is the engine of the whole pack - the node that turns a pi-Flow model into 4-step generation that keeps seed diversity. Where most speedup techniques (Lightning, Turbo, DMD2-style adapters) trade variety for speed and can make "every seed is the same image," pi-Flow frames the model as predicting a policy - a Gaussian mixture over possible velocity directions - and the sampler integrates that policy instead of following a single velocity. That's the whole difference, and it's why the pi-Flow release threads got 148+ upvotes in days: quality at 4 steps, but the seeds still vary like a full model.

You replace your KSampler with this node in a pi-Flow workflow. Don't try to run a pi-Flow model through a normal sampler - the author is blunt that pi-Flow doesn't use standard diffusion samplers, and the model outputs a policy a KSampler has no idea what to do with.

The inputs that matter

You'll set maybe four of these and never touch the rest.

  • steps - default 4. The 4-step adapter works at 4 or more; the community finds 8 steps noticeably better for coherence on complex scenes while staying way faster than base. Anything ≥ 4 is fair game.
  • seed - standard noise seed.
  • conditioning - your positive prompt conditioning. Wire the FluxGuidance node in front of it and don't change its value: 3.5 for FLUX.1, 4.0 for FLUX.2. Wrong guidance = noisy output, and the workflow marks it "(DO NOT MODIFY)" for a reason.
  • latent_image - the empty latent to denoise (EmptySD3LatentImage in the shipped workflows).
  • denoise - default 1.0. Lower it for img2img-style work; it preserves the structure of the input latent.

Then the policy internals: substeps (128) is how many sub-integrations each network step gets along the policy rollout - leave it. final_step_size_scale (0.5) shrinks the last step relative to the others - leave it. diffusion_coefficient (0) controls stochasticity; 0 is fully deterministic, 1 is standard DDPM-style noise - most people leave it at 0. gm_temperature (auto) and manual_gm_temperature (1.0) shape the Gaussian mixture; auto picks a sensible value from your step count.

Output: a single LATENT that goes into VAE Decode.

Install and models

cd ComfyUI/custom_nodes
git clone https://github.com/Lakonik/ComfyUI-piFlow

Restart ComfyUI (or ComfyUI Manager → search "ComfyUI-piFlow"). Requires ComfyUI 0.17.0+; current releases pin a newer floor, so update ComfyUI first. Model files come from the Load pi-Flow Model node's README section - base model, text encoder, VAE, and the small GMFlow adapter per family. On an 8GB card people do run pi-Flow (Flux.2 at 4 steps in under a minute, per one 3060 Ti report), but expect offloading slowness - pi-Flow uses as much VRAM as the base model.

Troubleshooting

Noisy output at 4 steps: check your FluxGuidance value first - this is the #1 cause, not the sampler. Contrast looks wrong: you're probably running a 4-step adapter at 8 steps (or vice versa) - adjust adapter_strength on the loader (1.0–1.4) rather than the sampler. And if the image looks structurally broken at high resolution, that's the adapter's 1MP training resolution showing - bump to 8 steps or upscale progressively.

CategoryLakonLab

Inputs (11)

NameTypeDefaultDescription
modelMODELThe model used for denoising the input latent.
seedINT00–18446744073709550000The random seed used for creating the noise.
stepsINT41–10000The number of network steps used in the denoising process.
substepsINT1281–10000The number of policy sub-steps used in the denoising process.
final_step_size_scaleFLOAT0.500–1The size of the final step relative to other steps.
diffusion_coefficientFLOAT0.000–1000000The coefficient controlling the stochasticity of the sampling process. 0.0 is deterministic. 1.0 is standard DDPM stochasticity.
gm_temperatureCOMBOautoThe GMFlow temperature setting.
manual_gm_temperatureFLOAT1.000–1The GMFlow temperature to use if gm_temperature is set to manual.
conditioningCONDITIONINGThe conditioning describing the attributes you want to include in the image.
latent_imageLATENTThe latent image to denoise.
denoiseFLOAT1.000–1The amount of denoising applied, lower values will maintain the structure of the initial image allowing for image to image sampling.

Outputs (1)

NameTypeDescription
LATENTLATENTThe denoised latent.