Nodes/MTB Nodes/Latent Lerp (mtb)
ComfyUI Node Runs on cloud

Latent Lerp (mtb)

Blending two latents in a straight line

By melMass·Created 3 years ago·Updated about a month ago· 721
Latent Lerp (mtb)
  • A
  • B
  • LATENT
t0.50

"Lerp" is short for linear interpolation, and the description matches exactly: "Linear interpolation (blend) between two latent vectors." You give it two latents, A and B, and a blend factor t, and it returns A and B mixed together in a straight line - at t = 0 you get A untouched, at t = 1 you get B untouched, and at t = 0.5 you get an even 50/50 mix.

What it's actually good for - and where it falls short

This runs before the VAE decodes back to pixels, which is what makes it different from just cross-fading two finished images in post. Blending in latent space can produce a smoother, more "the model itself imagined something in between" result than blending pixels, which is why people reach for it in latent-space transition or morph experiments between two generations.

The honest caveat: latent space isn't a nice, evenly-spaced space where halfway between two points always looks like a clean 50/50 semantic blend. A straight linear interpolation between two structurally different latents can land somewhere the model never actually saw during training, and the VAE decode on that midpoint can come out soft, muddy, or with artifacts neither source latent had. It tends to work best when A and B are reasonably close to begin with - two seeds of the same prompt, or two nearby frames - rather than two wildly different subjects.

Inputs that matter

  • A and B - the two latents to blend. Both required, both plain LATENT inputs from wherever you're generating them (a KSampler, or another latent-space node).
  • t (0–1, default 0.5) - the blend factor. 0 stays at A, 1 lands on B, and values in between move linearly across.

Output is a single LATENT, ready to go straight to a VAE Decode or onward into further latent-space processing.

Installing it

  • ComfyUI Manager - search "MTB Nodes", install, restart.
  • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/melMass/comfy_mtb, restart. A manual clone needs pip install -r requirements.txt run inside the comfy_mtb folder first.

Pure tensor math - no model files needed for this node itself.

Common issues & troubleshooting

Blended result looks soft or muddy compared to either source. That's the nature of linear interpolation through latent space, not a bug - the midpoint of two structurally different latents isn't guaranteed to decode into anything clean. Try blending latents that are closer to each other (same seed with a small prompt tweak, or adjacent animation frames) rather than two unrelated generations.

A and B have to come from the same-sized generation. Latents carry the spatial dimensions of the image they were generated at; feeding in two latents from different resolutions is asking for a shape mismatch error rather than a meaningful blend.

Animating t across frames for a morph effect. Drive t from a frame counter through something like Fit Number (mtb) if you want an eased transition instead of a linear one - this node itself only does the blend, not the scheduling of how t changes over time.

Some mtb nodes fail to load on startup. Standard for this pack - check the console for [comfy_mtb] STATUS and http://127.0.0.1:8188/mtb for what didn't load. This node has no optional dependencies, so it's rarely the one missing.

Categorymtb/latent

Inputs (3)

NameTypeDefaultDescription
ALATENT
BLATENT
tFLOAT0.500–1

Outputs (1)

NameTypeDescription
LATENTLATENT