Latent Batch Comparison Plot
A heatmap for telling two noise batches apart
- latent_batch_1
- latent_batch_2
- plot_image
If you've ever unsampled a latent with two different settings and squinted at the results trying to tell them apart, this node is that squint, automated. Latent Batch Comparison Plot takes two latent batches, flattens each latent into a vector, and computes the pairwise cosine similarity between every pair - then renders it as a viridis heatmap. It's a debug/analysis tool, not a generation node. No conditioning, no sampling, just math and a picture.
The inputs that matter
latent_batch_1- a LATENT batch, e.g. thelatent_batchoutput of aBatch Unsampler.latent_batch_2- a second LATENT batch. That's it. There are no other inputs.
The one hard constraint: the two batches must have identical shapes. The code raises a clear ValueError ("Latent batches must have the same shape") if they don't - so compare two runs of the same unsampler with the same steps, not a 20-step batch against a 40-step one.
Output: plot_image (IMAGE). It's an N×N heatmap (N = batch length) where cell [i][j] is the cosine similarity between latent i of batch 1 and latent j of batch 2. Bright cells = near-identical direction in latent space; dark cells = far apart. Decode and view it like any image output.
Why you'd bother
The unsampler's whole premise is that its progressively noised latents are a faithful backward walk up the model's noise schedule. This plot is how you check what actually changed when you fiddled with a parameter:
- Run the unsampler twice with a different seed or scheduler, and the heatmap shows you how much the noise paths drifted. If they're basically identical, your parameter did nothing (or the seed doesn't matter for unsampling, which is itself worth knowing).
- Compare an unsampled batch against the
noised_latentsoutput ofIterative Mixing KSampler Advancedto see how far the sampler's actual working batch drifted from what the unsampler handed it. - It's a cheap sanity check that your batch order is what you think it is - the diagonal lighting up is usually a good sign.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/ttulttul/ComfyUI-Iterative-Mixer
# restart ComfyUI
Or ComfyUI Manager → "ComfyUI Iterative Mixing Nodes." This one pulls in matplotlib (for the plot) and torch's F module - no model downloads, no extra weights. The pack's requirements.txt covers matplotlib, Pillow, numpy and friends.
Honest expectations: this is a niche diagnostic from a pack that's itself niche, and the author's own docs barely mention it. It sits in the "tools for understanding what iterative mixing is doing" pile alongside Latent Batch Statistics Plot. If you're just trying to get an upscale to look good, you don't need it. If you're debugging why the technique behaves the way it does, it's surprisingly informative for a node with two inputs and no settings.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| latent_batch_1 | LATENT | — | |
| latent_batch_2 | LATENT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| plot_image | IMAGE | — |