Dev.to AI 🤖 Ai 👁 0 📖 4 min read

PiD: Decoding a Low-Resolution Latent Straight to 4K Instead of Upscaling the Image

PiD: Decoding a Low-Resolution Latent Straight to 4K Instead of Upscaling the Image Every upscaler shares an assumption: you have an image, and you want a bigger one. PiD breaks that assumption. It decodes a low-resolu

PiD: Decoding a Low-Resolution Latent Straight to 4K Instead of Upscaling the Image

Every upscaler shares an assumption: you have an image, and you want a bigger one. PiD breaks that assumption. It decodes a low-resolution latent directly at high resolution, so the 4K output is produced in one pass rather than produced small and then enlarged.

That is not a semantic difference. An upscaler invents detail from a finished image; a decoder invents detail from the latent the model actually reasoned in. The four workflows in this set apply the same approach across four different base models.

The PiD node family

The mechanism is five nodes:

Node Role Example widgets
PiDPrepare Selects model family and resolution lane ['flux', '2kto4k', 4, 0, True, True, '']
PiDTextPrompt Carries the prompt into the decode path prompt text
PiDKSamplerCapture Captures the base sampler state to replay at target resolution [seed, 'fixed', 28, 1, 'euler', 'simple', 1, 26]
PiDSample Runs the multi-block decode [4, 1, seed, 'fixed', True, 'sequential_blocks_aggressive']
PiDFinalize Produces the final image —

The PiDPrepare first argument is the model family — flux, zimage, and so on. That is why the same node group works across different base models: the family selector tells the decoder what latent convention to expect.

The PiDSample last argument, sequential_blocks_aggressive, is the block scheduling strategy. This is where the actual quality/speed trade in a PiD decode lives, and it is the parameter to experiment with first.

Base generation stays small

The important structural detail: base latents are small.

  • FLUX.1, SD3.5, Z-Image: EmptySD3LatentImage at 1024×1024
  • FLUX.2: EmptyFlux2LatentImage at 576×1024 (9:16)

And the Z-Image workflow's own note says base generation at 512×512 for best 2K quality mode. The point is consistent — you are not generating at 4K, you are decoding at 4K.

Per-model configurations

FLUX.1 Dev

  • CheckpointLoaderSimple → flux1-dev-fp8.safetensors
  • FluxGuidance at 3.5
  • PiDKSamplerCapture → 28 steps, euler/simple, CFG 1.0
  • Two outputs saved: flux_2k_to4k_1024_base_enhanced_ and ..._native_

The graph's own note explains the CFG: Flux dev has no negative prompt, so CFG must be 1.0. Setting it higher does not strengthen the prompt, it corrupts the output.

Z-Image Turbo

  • UNETLoader → z_image_turbo_bf16.safetensors
  • CLIPLoader → qwen_3_4b.safetensors with type lumina2
  • VAELoader → ae.safetensors
  • ModelSamplingAuraFlow at 3
  • PiDKSamplerCapture → 9 steps, euler/beta
  • VAEDecodeTiled at 512/64/64/8

Nine steps against FLUX's 28 is the turbo model doing what it says. The tiled VAE decode is necessary here because the turbo path produces a full-frame decode that does not fit in one allocation.

FLUX.2 Dev

  • UNETLoader → flux2_dev_fp8mixed.safetensors
  • CLIPLoader → mistral_3_small_flux2_fp8.safetensors (type flux2)
  • VAELoader → flux2-vae.safetensors
  • Latent at 576×1024 — vertical framing, not square

FLUX.2 needing its own VAE and its own text encoder (Mistral 3 Small rather than CLIP) is why it gets its own 19-node graph instead of reusing the FLUX.1 lane.

SD3.5 Large

The smallest graph in the set at 13 nodes. Same EmptySD3LatentImage base, same PiD decode path, no extra reference plumbing.

The paired outputs are the point

Each workflow saves two images: one _enhanced_ and one _native_. That covers the honest comparison — PiD decode versus the model's own decode at the target resolution, from identical latents and seeds.

If you are evaluating whether PiD is worth the extra nodes, those two files are the test. Everything else in the graph is shared setup.

Where this changes your workflow

It removes a decision. With an upscaler you choose between a fast pass and a good pass, then upscale. With PiD there is one decode at the target size, and the block strategy is the knob.

It changes what "resolution" costs. A 1024×1024 base generation plus a PiD decode is not the same compute profile as a 4K generation. The base pass stays cheap; the cost moves into the decoder.

It does not fix bad composition. If the base latent is wrong, decoding it at 4K gives you a large wrong image. That is exactly the same failure an upscaler has, and it is worth stating because "direct 4K" reads like a quality claim when it is a resolution claim.

Troubleshooting notes

  • FLUX output looks burned or over-contrasted — check CFG is 1.0. Flux dev has no negative prompt; raising CFG is the most common mistake in these graphs.
  • Z-Image OOM at decode — the tiled VAE decode (512/64/64/8) is the lever, not reducing the latent size.
  • PiD decode produces mush — start with the block strategy. sequential_blocks_aggressive is one point on a curve, not a default that suits every model family.
  • Wrong texture convention for the model — PiDPrepare's first argument must match the loaded checkpoint family. A flux prepare against a zimage model will run and produce something, which is worse than failing.
  • Resolution mismatch between the two saved files — both outputs come from the same latent; if they differ in framing, the PiDPrepare resolution lane does not match the latent geometry.

Workflows

Four graphs, one per base model. All published on RunningHub with invite code rh-v1111:

  • Z Image Turbo — PiD direct 4K, fast build
  • SD3.5 Large — PiD direct 4K
  • FLUX.1 Dev — PiD direct 4K
  • FLUX.2 Dev — PiD direct 4K

Files

The ComfyUI workflow exports are in the companion repository:

https://huggingface.co/AI-KSK/ksk-video-252-comfyui-workflows

Video walkthrough (Chinese): https://youtu.be/nPt4IJ03Y9Q
Bilibili: https://www.bilibili.com/video/BV1tsVH6kEBJ/

Notes

  • Workflow files only. Model weights are not included; each model keeps its own licence.
  • These are tutorial exports, not a packaged product. Node parameters match the walkthrough.
  • Node counts and widget values quoted above are read from the published JSON files.
  • Independent AI-KSK release. Not affiliated with or endorsed by Black Forest Labs, Stability AI, Tongyi or RunningHub.
📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.