Analyze Model Weights (Tensor Prism)
Let math pick your merge ratios instead of guessing
- model_a
- model_b
- merge_recipe
Picking a merge ratio is usually a vibe check: start at 0.5, squint at renders, nudge, repeat. Analyze Model Weights (Tensor Prism) is the "stop vibing, measure" option. Feed it two models and it studies their weights block by block and hands back a per-block recipe - the exact ratios that, by its math, produce the best blend. It's the analysis half of a two-node workflow; the Apply Merge Recipe node is what actually applies the recipe it spits out.
Is it magic? No. It's statistics: it compares the two models' weights and scores how much each block should lean one way or the other. But it replaces twenty minutes of eyeballing with one analysis pass, and it's CPU-based, so it won't fight your GPU for VRAM while it thinks.
How it works
You feed in model_a and model_b, then pick an optimization_method - five ways to score block similarity and quality:
combined- a blend of the others; the README's pick for general use.similarity- favors blocks where the models agree.variance- favors blocks with richer internal variation.gradient_magnitude- weights blocks by how strongly they'd respond to change.entropy- favors blocks with higher information content.
global_alpha (0.5) is the starting point for the optimization (tooltip: "Starting point for optimization"), and optimization_strength (0.8, "How much to trust automated optimization") decides how far the analysis may push ratios away from that start. Two target_* fields shape the result: target_mean_weight (0.5, "-1 = auto-detect") is the average ratio across all blocks, and target_std_dev (-1) controls how much variation between blocks you allow - set higher for more aggressive block-by-block differences, 0 for a flat uniform recipe. smooth_weights with smoothing_strength (0.3) flattens the recipe if the raw output is too jumpy.
Optional niceties: use_model_a_as_base (on) builds the recipe around A; auto_detect_optimal lets it pick target_mean_weight from measured similarity instead of your guess; fp16_mode and verbose mostly affect speed and console chatter.
The single output is merge_recipe of type MERGE_RECIPE - a custom type that only this pack's Apply Merge Recipe node understands, so the pairing is mandatory.
The workflow
[Model A] ─┐
→ [Analyze Model Weights] → [merge_recipe] → [Apply Merge Recipe] → [Merged MODEL]
[Model B] ─┘ ↑
[Model A] [Model B]
Run the analysis once, save the recipe if you like the result - the README explicitly suggests keeping good recipes around as text for reproducible merges.
Installing it
Part of ComfyUI-Tensor-Prism-Node-Pack. ComfyUI Manager → search "Tensor Prism" → Install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/AstrionX/ComfyUI-Tensor-Prism-Node-Pack
No model downloads; deps are torch, numpy, psutil. Skip the README's clone URL (typo'd), use Manager or the URL above.
The honest caveat
This is a young pack from a first-time author, built with heavy LLM assistance, and "analyze then merge" is the kind of tool that sounds more rigorous than it is - the scoring heuristics are reasonable but unproven at scale. Treat the recipe as a strong starting point, not gospel: if optimization_strength at 0.8 gives you a weird recipe, dial it back to 0.3–0.5 and see if the result makes more sense. The README also notes analysis failures are usually a RAM problem - the models stay on GPU but analysis runs on CPU, so give it enough system memory.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| model_a | MODEL | — | |
| model_b | MODEL | — | |
| optimization_method | COMBO | 5 options: combined, similarity, variance, gradient_magnitude, entropy | |
| global_alpha | FLOAT | 0.500–1 | Starting point for optimization |
| optimization_strength | FLOAT | 0.800–1 | How much to trust automated optimization |
| target_mean_weight | FLOAT | 0.50-1–1 | Target mean weight across all blocks (-1 = auto-detect) |
| target_std_dev | FLOAT | -1.00-1–0.5 | Target standard deviation (-1 = auto, 0 = uniform, higher = more variation) |
| smooth_weights | BOOLEAN | false | Apply smoothing to reduce weight variance |
| smoothing_strength | FLOAT | 0.300–1 | How much to smooth (0=none, 1=completely flatten) |
| use_model_a_as_baseopt | BOOLEAN | true | — |
| fp16_modeopt | BOOLEAN | true | — |
| verboseopt | BOOLEAN | true | — |
| auto_detect_optimalopt | BOOLEAN | false | Auto-detect optimal mean weight based on model similarity |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| merge_recipe | MERGE_RECIPE | — |