VAE Block Inspector
Look inside a VAE's blocks before you trust it
- vae
- report_json
- outlier_tensor_names
- anomaly_score
Most VAE problems show up as symptoms: washed-out colors, noise, a decode that looks nothing like the prompt. VAEBlockInspectorMEC attacks the cause side instead - it reads the actual weight tensors of a VAE and reports per-block statistics, flagging any block whose weight magnitudes are way out of line with the rest. It's from the ComfyUI-CustomNodePacks pack's VAE Tools corner, and it's the node you reach for when a VAE feels broken but the decode hasn't told you why yet.
The KB's VAE panel is a good backdrop here: a VAE is the codec between pixels and latent space, and "the right VAE is the one the checkpoint was trained against." When a fine-tuned or merged VAE misbehaves, the cause is often a corrupted or partially-pruned tensor somewhere in the stack. This node's whole job is finding that tensor by name.
How it works
It walks every weight tensor in the VAE, computing mean, std, absolute-mean, and element count per tensor, then groups them per block. The clever part is the outlier logic: each tensor's abs_mean is compared to the median of its cohort, and anything exceeding anomaly_threshold multiples (default 5×) is flagged as a magnitude outlier. Lower the threshold to 1.5–2 and you'll catch subtler drift; raise it if you're only hunting for gross corruption.
Nothing runs on the GPU here - it's a weight-statistics pass, fast and VRAM-cheap. Outputs are text and numbers, not tensors.
Inputs and outputs
vae(VAE) - the VAE to inspect.anomaly_threshold(FLOAT, default 5) - the outlier multiple described above.
Outputs:
report_json(STRING) - per-block mean/std/abs_mean/count plus outlier details.outlier_tensor_names(STRING) - the flagged tensors, newline-separated. This is the output that tells you where the problem is.anomaly_score(FLOAT) - a 0–1 aggregate; higher means more outliers detected. A quick "how worried should I be" number.
Where it fits
Two honest use cases. First, diagnosing: you have a VAE that decodes badly, and this node tells you whether a specific block is statistically corrupt before you go re-downloading things. Second, the merge workflow: this pack's VAE Merge node blends VAEs block by block, and knowing each block's weight scale before you merge tells you whether your blend is combining comparable things. It also pairs with the pack's VAE Similarity Analyser - that one asks "how different are two VAEs," this one asks "is one of them internally healthy."
Installing it
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/Code2Collapse/ComfyUI-CustomNodePacks.git
restart ComfyUI or use Manager → "CustomNodePacks". No extra dependencies - it's pure torch tensor math on weights you already have loaded.
The caveat
Magnitude statistics are a heuristic, not ground truth. A low anomaly score doesn't guarantee the VAE decodes beautifully, and a flagged block isn't automatically bad - some legitimately-trained blocks legitimately differ in scale. Treat the report as a lead, then confirm with an actual decode. As diagnostic-first tooling goes, that's exactly what you want before you burn a hundred frames on a broken VAE.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| vae | VAE | VAE whose per-block weight statistics will be inspected. | |
| anomaly_thresholdopt | FLOAT | 5.01.5–50 | Tensors whose abs_mean exceeds this multiple of the cohort median are flagged as magnitude outliers. Lower => more sensitive (more flags). |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| report_json | STRING | Per-block weight statistics (mean/std/abs_mean/count) plus outlier details as JSON. |
| outlier_tensor_names | STRING | Newline-separated list of tensor names flagged as outliers. |
| anomaly_score | FLOAT | Aggregate anomaly score in [0, 1] (higher means more outliers detected). |