🖼️ LDM VAE Decode
The last node in the chain, and the one with the magic number on it
- samples
- vae
- IMAGE
At the end of every LDM workflow - after the sampler has done its denoising - the result is still a latent: a 4-channel tensor at 8× downsampling, totally unviewable to a human. This node is the decoder that turns it back into pixels. It's the ComfyUI equivalent of the stock VAE Decode, and if you've built one LDM txt2img workflow you've already seen it sitting between the 🎲 LDM Sampler and Save Image.
One genuinely interesting thing to know about it: the VAE it decodes with is the exact same AutoencoderKL class ComfyUI uses for SD1.x. The pack doesn't ship its own VAE code - the loader instantiates ComfyUI core's autoencoder, because this f8 VAE is the ancestor of the Stable Diffusion VAE. If that feels like cheating for a "historic architecture" pack, it isn't; it's just that this is where the two lineages genuinely share a brain.
The input that will confuse you once
Three inputs: samples (the LATENT from the sampler), vae (the VAE output from Load LDM Checkpoint), and vae_scale - defaulting to 0.18215. That number looks like a typo, but it's the training scale factor this family of VAEs was fit with, and it's the same 0.18215 you'll find across SD1.x latent handling. The node divides the latent by it before decoding, so the UNet's output lands in the right range for the decoder.
Leave vae_scale alone unless the output looks wrong - too dark, too washed out, generally "off." If it does, this is the knob the author built for you to nudge brightness/contrast back into line. Small changes: the step size is 0.00001 for a reason. And if you've adjusted it, make sure the encode side (if you use it) uses the same value, or your img2img round trips will drift.
Output and wiring
One output: IMAGE, in the standard [0, 1] float range, BHWC layout - meaning it plugs straight into Save Image, Preview Image, or any other stock node that eats an IMAGE. That's a nice bit of interop in an otherwise fully custom pack: once you decode, you're back in familiar ComfyUI territory and can use normal upscalers, savers, or post-processing on the result.
Gotchas
- Run it, don't stare at it. The decoder runs in fp32 and clamps to [0, 1]; you can't view a latent directly, so a "black image" out of the sampler means you skipped this step, not that generation failed.
- Chained round trips degrade. Every encode-decode cycle loses a little information - true of all VAEs, this one included. Don't bounce the same image through encode and decode repeatedly.
- Feed it the model's own VAE. Because this pack's VAE is genuinely SD1.x-compatible, you might be tempted to attach a downloaded SD VAE instead. Don't. The one from the loader is the one this checkpoint was trained against, which is the rule that always wins.
Install is the same as the rest of the pack - ComfyUI Manager (search comfyui_compvis_ldm) or git clone https://github.com/Winlensky/comfyui_compvis_ldm into custom_nodes, then restart. There's no model download for this node specifically; the VAE comes out of the checkpoint you loaded.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| samples | LDM_LATENT | Latent tensor from the Sampler node. | |
| vae | LDM_VAE | VAE output from Load LDM Checkpoint. | |
| vae_scale | FLOAT | 0.18220.01–1 | Latent scaling factor. Standard f8 VAE value is 0.18215. Adjust if output brightness looks incorrect. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |