Nodes/Latent-Tiled PiD/Latent-Tiled PiD Decode
ComfyUI Node

Latent-Tiled PiD Decode

One node between your KSampler and a 33MP print

By BennyDaBall930·Created about a month ago·Updated 17 days ago· 15
Latent-Tiled PiD Decode
  • model
  • positive
  • latent
  • IMAGE
latent_formatqwenimage
max_tile1024
overlap64
seed0
degrade_sigma0.00

NVIDIA's PiD (Pixel Diffusion Decoder) is the decoder swap people reach for when a model's VAE over-smooths the output - Krea 2 with its Qwen VAE is the poster child. It keeps your latent and replaces the VAE decode with a short diffusion run in pixel space, and it adds real synthesized detail instead of just reconstructing. There's one catch, and it's the whole reason this node exists: PiD is only trained for the 1024→4096 envelope. Push a 2MP latent through it in a single shot and the midtones collapse - whites go pink, chroma noise everywhere. The model isn't broken; you're just asking it to work outside its contract.

Latent-Tiled PiD Decode fixes that by tiling your generation latent, not the decoded pixels. Every tile stays a normal in-envelope PiD job, then the tiles get feather-blended together. The rule to internalize: output resolution is always 4x your latent. 1MP latent → 1 tile → 16MP. 2MP → 4 tiles → 33MP. 15.2MP → 16 tiles → 244MP. There's no tile-mode switch - the latent size is the mode, and the planner grows the grid to cover whatever you feed it. The node prints its plan to the console every run, so you can see what it decided.

How it works

Slice the latent into overlapping tiles (each ≤ max_tile stage-1 pixels, default 1024), decode each tile as a normal-sized PiD job, then stitch with a raised-cosine feather whose weights sum to exactly 1 - that's why there are no seams. The checkpoint's distilled 4-step schedule (0.999, 0.866, 0.634, 0.342, 0) runs with lcm at cfg 1.0 internally, which is the reference PiD config; don't expect other schedules to work on a DMD2-distilled student. PiD's sigma-gated LQ injection keeps tiles globally coherent, and because it crops the actual generation latent, every tile conditions on the bit-exact thing the sampler produced. Bonus: it slices latents rank-agnostically, so it sidesteps the core LatentCrop bug that silently corrupts 5-dim qwen/Wan latents. No temp files, per-tile progress bar, interruptible.

The inputs that matter

  • model - the PiD checkpoint via UNETLoader. Use v1.5 for your family: pid_1.5_qwenimage_... for Krea 2/Qwen, pid_1.5_flux2_1024_to_4096_4step_bf16.safetensors for FLUX.2/Klein. v1 works but is deprecated and measurably worse on color.
  • positive - PiD text conditioning from a Gemma-2 CLIPTextEncode (CLIPLoader type pixeldit). Empty prompt is fine; same encoder for every family.
  • latent - your generation latent straight off the sampler (flux / flux2-klein / sd3 / sdxl / qwen-family).
  • latent_format - qwenimage is the default; flux2 for FLUX.2/Klein (also auto-detected from the 128-channel count under flux).
  • max_tile (1024) and overlap (64) - leave both alone. max_tile is the only VRAM knob: lowering it shrinks tiles without changing output size.
  • seed - tile i noises with seed + 101*(i+1).
  • degrade_sigma - 0.0 for clean latents; only raise it if you're decoding deliberately half-denoised latents.

Output is one IMAGE, straight into SaveImage.

Install

ComfyUI Manager works - search "ComfyUI-Latent-Tiled-PiD". Or the manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/BennyDaBall930/ComfyUI-Latent-Tiled-PiD

Restart ComfyUI; nodes land under latent/pid. Requires ComfyUI ≥ 0.28 (PiD is core) and no python dependencies. What you do need to download: the PiD checkpoints from NVIDIA (they're under the NVIDIA License - non-commercial, read it before pointing anything at a client) and the Gemma-2 text encoder.

Troubleshooting

  • Color collapse: you pushed past the envelope (max_tile > 1024) or fed a latent_format that doesn't match your model. Keep max_tile at 1024.
  • Black output: community reports of PiD going black under SageAttention on some rigs. The author tested this pack with --use-sage-attention on a 5090 and it worked - but if you get black tiles, that flag is the first thing to flip.
  • Treat PiD as a detail reinterpreter, not a lossless decoder. That's the standing caveat (Stable Cascade's hallucinating second decoder is the precedent). If you need faithful reconstruction, keep the VAE; if you want more detail at huge sizes, this node is the reason to reach for PiD.
  • Changed resolution or model? Wire in the pack's QA node and trust its numbers over vibes.
Categorylatent/pid

Inputs (8)

NameTypeDefaultDescription
modelMODELThe PiD checkpoint (UNETLoader).
positiveCONDITIONINGPiD text conditioning (Gemma CLIPTextEncode; empty prompt is fine).
latentLATENTThe generation latent straight from your KSampler (flux/flux2-klein/sd3/sdxl/qwen-family).
latent_formatCOMBOqwenimageFamily of the STAGE-1 latent. 'flux2' = FLUX.2 dev + Klein 4B/9B (128-ch, 16x); Flux2 is also auto-detected under 'flux' from the channel count, matching core PiDConditioning.
max_tileINT1024256–4096Max tile size per axis in stage-1 px. 1024 = PiD's trained envelope.
overlapINT6416–512Tile overlap in stage-1 px (x4 in output; feather band).
seedINT00–18446744073709550000
degrade_sigmaFLOAT0.000–1PiD noisy-latent conditioning: raise for partially-denoised latents.

Outputs (1)

NameTypeDescription
IMAGEIMAGE