ComfyUI Node

VAE Latent Bending

Corrupt the latent itself, leave the model alone

By DavidPiazza·Created about a year ago·Updated 9 months ago· 0
VAE Latent Bending
  • samples
  • samples
operationadd_noise
intensity0.10
channel_specificfalse
target_channels0,1,2,3

Network Bending edits the model's weights; VAELatentBending edits the latent. It takes whatever tensor your VAE encoded - image or audio, it doesn't care - and runs one of seven corruption operations on the data itself, so the artifacts appear at decode time without a single checkpoint being touched. It's the lighter-touch cousin in the family: no model surgery, no per-run cloning of a giant network, just raw tensor vandalism. If your goal is "this image but slightly cursed," this is usually the fastest way to get there.

How it works

The node clones the input latent and applies the operation:

  • add_noise - Gaussian noise scaled by intensity. The gentle default.
  • channel_swap - swaps random pairs of channels; intensity controls how many swaps. Good for color-smear weirdness.
  • frequency_filter - an FFT low-pass in the frequency domain (1D for audio, 2D for images). intensity toward 1 keeps more of the high frequencies; toward 0 mangles the fine detail into mush.
  • spatial_corruption - corrupts regions of the latent grid directly.
  • value_quantization - snaps values to discrete levels, giving a banded/posterized feel.
  • dimension_warp - warps the tensor's spatial relationships.
  • temporal_shift - shifts content along the time axis (the one that's meaningful for audio and animation latents).

The two-channel controls are where the surgical power lives: channel_specific (default false) plus target_channels (a comma-separated string like 0,1,2,3). Flip channel_specific on and the operation only hits the listed channels - which is how you corrupt the color channels of an SD latent and leave the structure channels alone, or hit one band of an audio latent and leave the rest clean. The node auto-detects whether it's looking at 3D (audio) or 4D (image) latents.

The inputs that matter

  • samples - the latent to bend.
  • operation - the seven modes above; add_noise to start.
  • intensity - 0–1.
  • channel_specific / target_channels - target a subset of channels when you want precision.

Output is samples, ready for a VAE decode.

Installing it

From DavidPiazza/network_bending - ComfyUI Manager ("Network Bending") or:

cd ComfyUI/custom_nodes
git clone https://github.com/DavidPiazza/network_bending.git

Restart. No pip requirements for the core nodes.

Gotchas

The usual in-memory reminder applies: nothing here writes to disk, so whatever effect you land on needs its inputs noted if you want to reproduce it. And if channel_specific is on but you list a channel index that's out of range for the latent (like 4 on a 4-channel SD latent), that channel is simply skipped - no error, which is either forgiving or confusing depending on your mood. One honest pack-wide note: it's version 0.0.1 and a couple of sibling nodes are stubs, but VAELatentBending is fully implemented - every operation in the dropdown actually runs.

Categorynetwork_bending/vae

Inputs (5)

NameTypeDefaultDescription
samplesLATENTLatent samples to bend
operationCOMBOadd_noiseLatent bending operation
intensityFLOAT0.100–1
channel_specificBOOLEANfalseApply operation to specific channels only
target_channelsSTRING0,1,2,3Comma-separated channel indices when channel_specific is True

Outputs (1)

NameTypeDescription
samplesLATENT