Latent-Tiled PiD Decode
One node between your KSampler and a 33MP print
- model
- positive
- latent
- IMAGE
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.safetensorsfor FLUX.2/Klein. v1 works but is deprecated and measurably worse on color. - positive - PiD text conditioning from a Gemma-2
CLIPTextEncode(CLIPLoader typepixeldit). 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 -
qwenimageis the default;flux2for FLUX.2/Klein (also auto-detected from the 128-channel count underflux). - max_tile (1024) and overlap (64) - leave both alone.
max_tileis 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 alatent_formatthat doesn't match your model. Keepmax_tileat 1024. - Black output: community reports of PiD going black under SageAttention on some rigs. The author tested this pack with
--use-sage-attentionon 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.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | The PiD checkpoint (UNETLoader). | |
| positive | CONDITIONING | PiD text conditioning (Gemma CLIPTextEncode; empty prompt is fine). | |
| latent | LATENT | The generation latent straight from your KSampler (flux/flux2-klein/sd3/sdxl/qwen-family). | |
| latent_format | COMBO | qwenimage | Family 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_tile | INT | 1024256–4096 | Max tile size per axis in stage-1 px. 1024 = PiD's trained envelope. |
| overlap | INT | 6416–512 | Tile overlap in stage-1 px (x4 in output; feather band). |
| seed | INT | 00–18446744073709550000 | — |
| degrade_sigma | FLOAT | 0.000–1 | PiD noisy-latent conditioning: raise for partially-denoised latents. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |