Nodes/PiD Decoder/PiD Decode
ComfyUI Node

PiD Decode

A VAE decode that actually adds detail — NVIDIA PiD, in your Flux graph

By npiriou·Created 4 months ago·Updated 4 months ago· 1
PiD Decode
  • latent
  • vae
  • pid_model
  • image
prompt
seed0
pid_steps4
cfg_scale1.00
scale4
shift-1.00
degrade_sigma0.00

Here's the deal: a normal VAE decode just reconstructs your latent - it turns the compressed representation back into pixels, and everything you see after that is upscaler territory. PiD Decode replaces that whole "decode then upscale" pipeline with one step. It's a diffusion decoder: it runs your final latent through a distilled 4-step diffusion pass that renders the image at upscaled resolution, inventing detail as it goes. Generate a Flux or Z-Image latent at 512 and get a 2048px image back; do it at 1024 and get 3840. No separate upscaler node in the chain.

That's the headline, and it's worth the salt that comes with it. Because PiD is generative, it doesn't just sharpen - it reinterprets. The community's been loud about this since NVIDIA dropped it: detail that wasn't in the latent (textures, reflections, even eye colors) can get hallucinated in. One r/StableDiffusion thread put it as "PiD can alter the final image and can act as an upscaler, so of course it's going to add detail... that wasn't present in the original output." Great for polish, risky if you need faithful reproduction. Feed it a final, clean latent - never an img2img intermediate or a half-denoised tensor - and it behaves.

How it works

Surprise: you still need a VAE. PiD Decode takes a vae input because it runs your latent through the native Flux VAE first to build a low-resolution conditioning image, then hands that plus the raw latent to the PiD model, which does the 4-step diffusion decode on top. The node also unloads other models from VRAM before it runs - PiD is substantially heavier than a normal VAE decode, and it wants the card to itself. It'll even clean up and give you a friendly OOM message instead of a cryptic traceback if it doesn't fit.

Inputs that matter

  • latent - straight out of your sampler. Final clean latent, batch size 1 (a bigger batch errors out). Square only: the 2k checkpoint wants a 512×512 latent, the 2kto4k one wants 1024×1024. Mismatch = explicit error telling you which variant you need. (Force non-square and you'll get the green/teal cast people keep posting about.)
  • vae - the native Flux/Z-Image VAE. Yes, you're loading a VAE to replace VAE decode. It's only for the conditioning image.
  • pid_model - from PiD Model Loader. Don't improvise here; it must be the real PID_MODEL handle.
  • prompt - optional caption forwarded to PiD's text encoder. Leave blank and it's ignored; fill it and the decode gets a textual nudge.
  • pid_steps - default 4, and you'll rarely move it. This is a 4-step distilled model; that's what it was trained for.
  • cfg_scale - default 1.0, guidance-free. Same as other distilled models: crank it and you're fighting the baked-in guidance.
  • scale - default 4, and effectively fixed: the node rejects anything that isn't the backbone's scale.
  • shift - -1.0 means "use the official checkpoint default." Leave it alone until you've got a specific reason.
  • degrade_sigma - 0 to 1, default 0. This is the "how much may the decoder regenerate" knob. At 0 it stays faithful to the conditioning; nudging it up lets PiD add more of its own detail. Start at 0.
  • seed - reproducibility for the decode pass. Different seeds, slightly different invented detail.

Output: a single image (IMAGE), ready for Save Image / Preview Image.

Wiring and install

Flux/Z-Image sampler → latent → [PiD Model Loader → PiD Decode] → image

Install from ComfyUI Manager (search PiD) or clone https://github.com/npiriou/ComfyUI-PiD into custom_nodes/, pip install -r requirements.txt, and drop the checkpoints plus the ae.safetensors support file under ComfyUI/models/pid/ as the Model Loader article describes. Restart, done.

Troubleshooting

  • "expected a final clean latent compatible with the selected checkpoint variant" - your latent resolution doesn't match the checkpoint family. 512 input → 2k checkpoint; 1024 → 2kto4k.
  • OOM - expected on cards under ~16GB at the 4k variant. The node unloads everything else first and tells you clearly; drop to the 2k checkpoint or bf16.
  • Green/teal cast - you forced a non-square resolution through. This node's variants are square, full stop.
  • Everything's a bit too different from the VAE version - that's the hallucination tradeoff, not a bug. Lower degrade_sigma toward 0 or skip PiD where fidelity wins.
Categorylatent/PiD

Inputs (10)

NameTypeDefaultDescription
latentLATENT
vaeVAE
pid_modelPID_MODEL
promptSTRINGOptional caption forwarded to PiD's text encoder.
seedINT00–18446744073709550000
pid_stepsINT41–16
cfg_scaleFLOAT1.000–20
scaleINT41–8
shiftFLOAT-1.00-1–20Use -1.0 to keep the official PiD checkpoint default.
degrade_sigmaFLOAT0.000–1

Outputs (1)

NameTypeDescription
imageIMAGE