Nodes/ComfyUI-PiD/PiD Decode
ComfyUI Node

PiD Decode

Swap your VAE Decode for a pixel-diffusion decoder

By Merserk·Created 3 months ago·Updated 2 months ago· 122
PiD Decode
  • latent
  • image
versionv1
backbonezimage
pid_ckpt_type2k
pid_steps4
scale0
cfg_scale1.0
sigma0.000
seed0
auto_downloadtrue
model_precisionbf16
unload_comfy_before_pidtrue
aggressive_cleanuptrue
caption

The one-node PiD experience. PiD Decode takes a LATENT, a caption, and a sigma, and produces an IMAGE - no separate VAE Decode node, no staged pipeline. It's the cleanest way to test whether NVIDIA's Pixel Diffusion decoder is for you: replace your decode step and see what comes out.

The idea is simple. Your model's VAE decoder is deterministic: latent in, pixels out, and whatever the autoencoder smoothed away is gone for good. PiD instead runs pixel diffusion - a distilled diffusion model that treats "decode" as a small denoising problem conditioned on your caption, and in doing so combines the decode with a 4x upscale. That's why a 512-class latent can come out as a 2048x2048 image. The trade, which you should internalize: it doesn't reconstruct faithfully, it reinterprets. Detail that was never in the latent can appear. Think of it as an upscaler-shaped decoder, not a lossless swap.

How the decode works

PiD Decode is the whole pipeline in one node. It validates your latent against the chosen backbone (channel count and downscale must match), loads the native Comfy-Org PiD diffusion model plus the Gemma text encoder, and runs the distilled 4-step decode. It pulls the effective sigma from the latent if it carries one (see PiD KSampler Capture), otherwise from the sigma input. Then it converts the pixel-space result back into a ComfyUI image.

Inputs a beginner actually sets

  • latent - from your sampler. If it came out of PiD KSampler Capture, the node uses the captured pid_sigma automatically; otherwise set sigma yourself.
  • backbone - the model family your latent belongs to. This is the one that bites people: a Flux latent is 16-channel, Flux2 is 128-channel, SDXL is 4-channel, and each has a different downscale. Feed the wrong one and the node errors immediately rather than guessing.
  • pid_ckpt_type - 2k (512-class latent → ~2048 out) or 2kto4k (1024-class latent → ~4096 out).
  • pid_steps - the decode's denoising steps, default 4. These checkpoints are 4-step distilled, so 4 is the sweet spot; other values get a warning that you're out of distribution.
  • cfg_scale - default 1.0, which is the right call for a distilled model. This is not your LDM CFG; leave it alone unless you're experimenting.
  • scale - 0 or 4 are the recommended values (4 is the native checkpoint scale; 0 is the latent resolution itself).
  • caption - PiD is conditioned on text, so a caption helps a lot. Wire PiD Text Prompt or PiD Caption Creator in.
  • model_precision - bf16 for quality; fp8 only where supported (Flux1-family and Flux2 2k); int8 for v1.5.

There's also unload_comfy_before_pid and aggressive_cleanup, both default true, which free the main model's VRAM before PiD loads and aggressively clear memory after. Leave them on; they're why the node survives on mid-range cards.

The workflow

model + KSampler -> LATENT -> PiD Decode -> Save Image

Or the capture-first variant if you want PiD to start from a partially denoised latent:

PiD Text Prompt -> CLIP Text Encode -> PiD KSampler Capture -> PiD Decode -> Save Image

Setup and gotchas

Install once for the whole pack: ComfyUI Manager → search "ComfyUI-PiD", or

cd ComfyUI/custom_nodes
git clone https://github.com/Merserk/ComfyUI-PiD.git
cd ComfyUI-PiD
python -m pip install -r requirements.txt

then restart. Requirements: recent ComfyUI with native PixelDiT support (0.28.0+), Python 3.10+, NVIDIA GPU. Models auto-download to ComfyUI/models/diffusion_models/nvidia_pid/ and text_encoders/nvidia_pid/ on first run with auto_download on.

Common issues: a 4K decode eats VRAM, so prefer 2k first; unsupported backbone/model_precision combos error instead of falling back (that's intentional - don't fight it, just switch to bf16); and remember PiD can add detail that wasn't in the latent, which is a feature for upscaling and a bug if you expected a faithful decode.

CategoryPiD

Inputs (14)

NameTypeDefaultDescription
latentLATENT
versionCOMBOv12 options: v1, v1.5
backboneCOMBOzimage10 options: zimage, zimage-turbo, flux, flux2, flux2-klein-4b, flux2-klein-9b, +4
pid_ckpt_typeCOMBO2k2 options: 2k, 2kto4k
pid_stepsINT41–64
scaleINT00–8
cfg_scaleFLOAT1.00–20
sigmaFLOAT0.0000–1000
seedINT00–2147483647
auto_downloadBOOLEANtrue
model_precisionCOMBObf163 options: bf16, fp8, int8
unload_comfy_before_pidBOOLEANtrue
aggressive_cleanupBOOLEANtrue
captionSTRING

Outputs (1)

NameTypeDescription
imageIMAGE