Nodes/Network Bending for ComfyUI/VAE Channel Manipulator
ComfyUI Node

VAE Channel Manipulator

Rearrange the channels of a latent like they're audio faders

By DavidPiazza·Created about a year ago·Updated 9 months ago· 0
VAE Channel Manipulator
  • samples
  • reference_latent
  • samples
operationchannel_attention
intensity0.50
preserve_energytrue

A VAE latent is a stack of channels, and each channel encodes a different slice of the image's (or audio's) character. VAE Channel Manipulator treats those channels like faders and effects sends: it mixes them, drops them, amplifies them, rotates them, and swaps their statistics - in latent space, before decoding. If the flagship Network Bending node edits the model's weights, this one edits the data flowing through the VAE, which means you get artifacts in the decoded image without ever touching the checkpoint.

How it works

It takes a LATENT, applies one of six operations to the channel dimension, and (if you ask nicely) keeps the overall signal energy constant afterward:

  • channel_attention - runs a self-attention pass across channels, so the model's own structure decides how channels recombine. The default, and the least predictable in the best way.
  • cross_channel_mixing - multiplies the channels by a mixing matrix; intensity controls how far off the identity it goes.
  • channel_dropout - zeroes out a random intensity fraction of channels. Instantly "melty" images.
  • channel_amplification - amplifies the channels that carry the most variance (i.e., the information-heavy ones), weighting by how important they are.
  • channel_rotation - rotates channel pairs in 2D feature space, like rotating two axes in a plot.
  • channel_statistics_swap - the fun one: with a reference_latent plugged in, it swaps each channel's mean and standard deviation with the reference's, channel by channel, probabilistically. That's how you get a transferred texture out of a latent.

preserve_energy (default true) rescales the result back to the original tensor norm afterward, so your output doesn't come out of the decoder darker or louder than it went in. Leave it on; turn it off when you want the energy shift to be part of the effect.

The node works on both 4D image latents and 3D audio latents - it checks the tensor rank and adapts.

The inputs that matter

  • samples - the latent to manipulate (VAE-encode an image, or take the output of a sampler).
  • operation - the six modes above.
  • intensity - 0–1, the amount.
  • preserve_energy - the volume-safety toggle.
  • reference_latent - required only for channel_statistics_swap.

Output is samples, a LATENT ready for 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 deps for the core nodes.

Gotchas

channel_statistics_swap without a reference_latent does nothing - the node needs somewhere to borrow the statistics from. And because you're mutating latent data, remember the golden rule of this pack: everything is in-memory and per-run. If you like an effect, either save the decoded image or note the seed/inputs, because re-running the queue rebuilds the latent from scratch. Unlike some of its siblings, this node's dropdown is fully implemented - all six operations genuinely run.

Categorynetwork_bending/vae

Inputs (5)

NameTypeDefaultDescription
samplesLATENTInput latent samples
operationCOMBOchannel_attention6 options: channel_attention, cross_channel_mixing, channel_dropout, channel_amplification, channel_rotation, channel_statistics_swap
intensityFLOAT0.500–1
preserve_energyBOOLEANtruePreserve overall signal energy
reference_latentoptLATENTReference latent for operations like statistics swap

Outputs (1)

NameTypeDescription
samplesLATENT