Nodes/ComfyUI Model Bending/Model VAE Bending
ComfyUI Node

Model VAE Bending

Bend the VAE, not the UNet

By abuzreq·Created about a year ago·Updated 3 months ago· 21
Model VAE Bending
  • vae
  • bending_module
  • VAE
path

Every other bending node in this pack attacks the UNet. Model VAE Bending is the odd one out: it aims the same bending modules at the VAE instead - the autoencoder that squashes images into latents on the way in and rebuilds pixels on the way out. Give it a VAE, a module path, and a BENDING_MODULE, and the chosen VAE submodule's output gets bent every time the VAE runs.

Why would you? Because the VAE is where the image becomes pixels. A bend there isn't a sampling-time style nudge - it's a structural change to how latents get decoded, and it shows up as color, texture, and geometry artifacts baked into every single output. It's the layer of the stack people rarely think to break, which is exactly why it produces effects nobody else's workflow has. The obvious sibling node for finding your target path is Model VAE Inspector, which prints the VAE's module tree the way Model Inspector does for the UNet.

How it works

The mechanism is a little different from the UNet path, because a VAE isn't patched the same way. The node:

  1. Shallow-copies the VAE wrapper and clones its patcher - so your bend is isolated to this copy and doesn't touch the shared model.
  2. Resolves the submodule at your path (again through process_path, which here also strips AutoencoderKL and TAESD prefixes).
  3. Wraps it: nn.Sequential(original_submodule, bending_module).
  4. Installs that via patcher.add_object_patch, so the bend is active during patch_model() and cleanly removed on unpatch_model().

The result: a VAE you can hand to VAEDecode (or encode). Zero weight duplication - the original tensors stay put, the bend is a wrapper.

Inputs and outputs

  • vae (VAE) - from your VAE loader.
  • path (STRING) - dot-separated path into the VAE, found via Model VAE Inspector. A VAE is small, so this is a short tree to read.
  • bending_module (BENDING_MODULE) - any (Bending) module node.

Output is the patched VAE, wired into VAEDecode or VAEEncode as usual. Classic first try: a Multiply Scalar Module (Bending) at 0 on a mid-decoder conv - it ablates that piece of the decoder and you'll see exactly what it was contributing.

Installing

Ships in the ComfyUI-Model-Bending pack:

cd ComfyUI/custom_nodes
git clone https://github.com/abuzreq/ComfyUI-Model-Bending

Restart ComfyUI and refresh, or search ComfyUI-Model-Bending in ComfyUI Manager. Deps are just kornia + scikit-learn; no model downloads. Clone folder name should be ComfyUI-Model-Bending, not the stale ComfyUI-Web-Bend-Demo the README's snippet suggests.

Where people get tripped up

Because the VAE runs only once or twice per image (encode + decode), your bend isn't repeated across denoising steps - it's a one-shot transformation. Effects therefore tend to be bold and can slide straight into broken colors or mush; keep magnitudes small and preview often. Also, VAE bending applies to whatever flows through the bent submodule, so if you switch from decode to encode use, re-read your path - a decoder path is not a useful encoder target. And on pixel-space models (no VAE at all), there's nothing to bend; this node is for the latent-family models.

Categorymodel_bending

Inputs (3)

NameTypeDefaultDescription
vaeVAE
pathSTRING
bending_moduleBENDING_MODULE

Outputs (1)

NameTypeDescription
VAEVAE