VAE Decode (Batched)
VAE Decode (Batched) — the drop-in that stops decode-time OOMs
- samples
- vae
- IMAGE
Here's a pattern you've probably hit: the sampling finishes fine, and then the very last step - decoding the latent batch to pixels - is what kills the run. ComfyUI's VAE Decode decodes the whole latent batch in one call, so eight images means eight times the peak decode memory, all at once. This vsLinx node is the same node with one extra field: batch_size. It decodes a few latents at a time and concatenates the results, so peak VRAM drops in proportion to how many you decode per call. That's the whole trick, and it's a genuinely useful one.
How it works
The implementation is as honest as it gets: it subclasses ComfyUI's own VAEDecode, keeps every input and behavior, and splits the latent batch along its first dimension into chunks of batch_size, calling the real decode on each chunk and stacking the results back into one output batch. The default batch_size is 1 - one image decoded per VAE call. Values equal to or greater than your batch size are a single decode, byte-for-byte identical to the built-in node. That last part is the license to just leave this node in every workflow forever: there is no scenario where it's worse, only the option to be gentler.
The inputs that matter
samples(LATENT) - the latent to decode.vae(VAE) - your model's VAE.batch_size(default 1, 1–4096) - how many latents per decode call. That's the only new thing.
Output: IMAGE, same batch shape as the input.
When it actually helps
- Generating a batch or a preview grid: instead of one 8-image decode that spikes VRAM (or pushes ComfyUI into its slower tiled fallback), you get eight small decodes.
- Chaining img2img on a stack of images where the encode/decode stages are the memory pressure point.
- Video latents: decoding frame-batches at
batch_size1 keeps the tail of the run cheap.
On many setups it also speeds things up - a single oversized decode can spill or trigger a fallback path that's slower than just doing it sequentially. The trade is only more sequential calls, and on a small batch you won't notice.
Install
Part of the vsLinx pack. ComfyUI Manager → search "ComfyUI vsLinx Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/vslinx/ComfyUI-vslinx-nodes.git comfyui-vslinx-nodes
Restart, find it under vsLinx/latent as "VAE Decode (Batched)". No extra dependencies.
The honest take
This and its tiled sibling (VAE Decode Tiled (Batched)) are the quiet MVPs of the pack for anyone on a 6–8 GB card. The two solve different problems: this one controls how many latents per call, the tiled one controls how one huge latent is split spatially - and if you're decoding a big single image on low VRAM, you want the tiled one; if you're decoding a big batch, you want this one. Together they cover most decode-time OOMs. Not flashy, but the kind of node that pays for itself on the first large batch.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| samples | LATENT | The latent to be decoded. | |
| vae | VAE | The VAE model used for decoding the latent. | |
| batch_size | INT | 11–4096 | How many latents to hand to the VAE per decode call. Lower values reduce peak VRAM at the cost of more sequential calls; the default of 1 decodes one image at a time. Values >= the batch size behave exactly like the built-in node (single decode). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | The decoded image. |