Analyze Diffusion Model Similarity (2 Models)
Two diffusion models, zero merges — see how similar they really are first
- comparison_report
- cwb_report
- documentation
Same idea as its sibling node for checkpoints, but pointed at a different folder and a slightly different thing. A checkpoint bundles everything - UNet/DiT, text encoder, often a VAE - into one file. A standalone diffusion model in models/diffusion_models is just the denoiser: the UNet or DiT that does the actual generating. If you want to compare two UNets - say, a base Flux and a finetune built from it - without the text-encoder and VAE layers muddying the numbers, this is the node.
How it works
It streams two safetensors files from models/diffusion_models in low-memory mode (via the pack's Unified Efficient Loader, same as everything else in Model Utility Toolkit), and compares them layer by layer in fp32. You get the standard metric set - MAE, MSE, RMSE, max absolute difference, relative L2, cosine similarity, Pearson correlation, exact equality, sign agreement, norm ratio - plus a per-tensor breakdown, plus a second report with CWB diagnostics: row-wise cosine statistics and each model's affinity to a mean and median consensus, computed with the same machinery the pack's CWB merger nodes use when they actually blend two diffusion models.
Same honest rules as the checkpoint version: missing keys and shape mismatches are listed, never padded or zero-filled. Quantized models carrying ComfyUI quantization metadata are rejected, because stored quantized values aren't comparable to raw weights. If you've been eyeing a GGUF UNet and want to compare it to fp16, you can't - you'll get an error instead of misleading numbers, which is the right behavior.
Inputs you'll actually set
- model_a / model_b - the two files. Model A is the anchor; keys unique to each input are reported separately.
- top_weight_differences (default 20) - how many of the largest individual weight differences get their own list entries. Zero turns the list off; up to 1000 if you want the full picture.
- exclude_patterns / glob_patterns - leave matching tensors out of all metrics and topology counts. Regex by default. This is genuinely useful on diffusion models: skip a known-identical conditioning branch or a norm layer so it doesn't flatten the aggregate stats.
- process_device -
cudaorcpufor the per-work-unit math. A CUDA OOM only retries the affected layer on CPU rather than dying. - force_clear_cache (default on) - garbage-collect and clear the CUDA allocator after every work unit. Saves retained memory, costs time. Leave it on for big DiTs; turn it off if you're on a big machine and want speed.
- execution_mode -
ANALYZEdoes the work;DOCUMENTATION ONLYreturns the reference doc and loads nothing.
Outputs and wiring
You get comparison_report, cwb_report, and documentation as plain text. Wire them into a Show Text node. No model comes out the other end - this is a read-only diagnostic.
Why you'd reach for it
The classic move: you downloaded a fine-tune of an architecture you already have, and you want to know how far it actually drifted before you decide whether a CWB merge between it and another fine-tune makes sense. This node tells you which blocks moved and how much. It's also the sane first step before running CWBModelTwoMerger or CWBModelThreeMerger from the same pack - the CWB report is literally a preview of the merging math.
Install
Same pack as all of these: Model Utility Toolkit (silveroxides/ComfyUI-ModelUtils). ComfyUI Manager → "Install Custom Nodes" → search the pack title, or:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-ModelUtils
Restart ComfyUI. The heavyweight dependency is unifiedefficientloader (UEL); requests, Pillow, mutagen, and av in requirements.txt belong to the pack's downloader nodes, not this one. These nodes use ComfyUI's newer extension API, so update ComfyUI if the node doesn't appear after install.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| execution_mode | COMBO | ANALYZE streams both files and produces standard and CWB diagnostic reports. DOCUMENTATION ONLY performs no model loading. | |
| model_a | COMBO | First file in the comparison. Reports identify values and keys unique to this input separately from Model B. | |
| model_b | COMBO | Second file in the comparison. Inputs are analyzed only; neither file is modified or merged. | |
| top_weight_differences | INT | 200–1000 | Number of largest individual absolute parameter differences retained for the detailed report. Zero disables this list. |
| process_device | COMBO | Device for per-work-unit floating-point analysis. A CUDA OOM retries only the affected unit on CPU. | |
| force_clear_cache | BOOLEAN | true | Run garbage collection and clear the CUDA allocator cache after every analyzed work unit. Saves retained memory but slows analysis. |
| exclude_patterns | STRING | One pattern per line. Matching tensors are excluded from all comparison metrics and topology counts. Uses regex unless Glob Patterns is enabled. | |
| glob_patterns | BOOLEAN | false | Interpret exclusion entries as shell-style glob patterns instead of regular expressions. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| comparison_report | STRING | — |
| cwb_report | STRING | — |
| documentation | STRING | — |