Latent Structure Probe π‘
See the Shape of a Latent's Energy With a Heatmap
- latent
- heatmap
- report
Latent Visualizer shows you what individual channels look like. Latent Structure Probe shows you something different: where the energy is. It divides the latent's spatial area into a grid, computes a statistic per cell, and renders the result as a heatmap - so you can see at a glance whether the composition is concentrated in the middle, spread out evenly, or collapsed into a dead corner. It's the "where is this image actually happening" diagnostic, and for a few bucks of compute it tells you things a full VAE decode only shows after you've looked at the picture.
How it works
Pick a grid size - grid_rows Γ grid_cols, default 4Γ4 - and the latent gets divided into that many cells. Each cell gets scored with the statistic you choose, averaged across channels and across the batch:
- variance - how much variation within the cell. High variance = texture, detail, activity. Low = flat, dead.
- mean_magnitude - average absolute value. Overall "how loud" the cell is.
- max_magnitude - the single most extreme value. Catches a hot spot that variance might dilute.
The output is a small heatmap image (each cell rendered as a block of cell_pixels, default 64) plus a text report that flags the hottest and flattest cells. The heatmap is the quick read; the report is the exact answer.
Inputs and outputs
- latent - in.
- statistic, grid_rows, grid_cols, cell_pixels - the controls. 4Γ4 is a good default; go finer (8Γ8) when you're hunting a specific bad region.
- heatmap - the IMAGE, wire to a Preview node.
- report - the text rundown of hot and flat cells.
Where it fits
The canonical use is pre-decode QC: a 4Γ4 variance heatmap tells you in milliseconds whether a latent has structure everywhere it should, or whether a whole region came out flat - the signature of a collapsed sample or a mask that ate a chunk of the composition. It also catches the oversaturated-corner problem: a cell whose max_magnitude dwarfs its neighbors is a region where values went off the rails, and it's cheaper to see that in a heatmap than to decode, squint at the image, and wonder.
It pairs with the rest of the pack's latent diagnostics: Visualizer for what channels look like, Histogram for what the value distribution looks like, and this node for where the structure lives. All three are "see inside the latent" tools; they just answer different questions.
Install and troubleshooting
Pure NumPy/PyTorch, nothing extra:
cd ComfyUI/custom_nodes
git clone https://github.com/TensorVizion/OmniNodes
Restart and find it under TensorVizion/Latent (or ComfyUI Manager, search "OmniNodes"). Confirm with the [OmniNodes] β
Loaded log line.
- The heatmap is one solid color. Your grid is too coarse for the detail level (try finer), or the latent is genuinely degenerate (a flat latent gives a flat heatmap - which is itself the finding).
- A corner is always hot. That's a real signature of off-range values in that spatial region, worth investigating before decode. If it's the same corner across every latent in a batch, suspect your VAE or the image encode step, not the individual seeds.
- Hottest and flattest cells are adjacent. That's a composition pushed to one side - the model concentrated everything in a corner. Sometimes an aesthetic choice, sometimes a sign the prompt and the latent shape disagree.
It's a small, quiet node with a surprisingly specific use: it turns "the image felt wrong, somewhere" into "cell (1,3) is dead." For anyone debugging why a batch of renders is going wrong, that's a genuinely useful upgrade.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | β | |
| statistic | COMBO | variance | 3 options: variance, mean_magnitude, max_magnitude |
| grid_rows | INT | 41β32 | β |
| grid_cols | INT | 41β32 | β |
| cell_pixels | INT | 648β256 | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| heatmap | IMAGE | β |
| report | STRING | β |