CWB Custom Configuration
Take the wheel from CWB presets — the config node behind every CWB merge
- cwb_config
Every CWB merger in this pack ships with named presets like balanced_mean or broad_sim_medn_rn_softcb. Those presets are complete settings, not partial hints - but they're also opaque, and the names only tell you so much. This node is the manual override: it exposes every knob in the Consensus-Weighted Blending math and hands the result to any CWB merger through its optional cwb_config input. Connect it and the preset is ignored completely; the config becomes the whole settings object.
What the knobs actually do
- consensus_type (
mean/median, defaultmedian) - the center each contributor is compared against. Mean is the symmetric arithmetic center; median is more robust when you have three or more contributors and one might be an outlier. For two inputs it barely matters; for three or more, median is the safer default. - alignment_method (
index/similarity, defaultsimilarity) - how vectors get paired when the merge type supports alignment (LoRA and embeddings). Index keeps absolute row positions; similarity greedily pairs rows by cosine. Dense models ignore this - their coordinates are fixed. - alignment_threshold (0–1) - minimum cosine score for accepting a similarity-aligned row match. Raise it to only align rows that genuinely resemble each other.
- similarity_threshold (-1–1) - minimum similarity to the group consensus before a contributor gets weight at all. Raise it to make the merge more selective.
- power_alpha (0–10, default 2) - the exponent applied to accepted similarities before weighting. Higher values make close-to-consensus contributors dominate more; this is the single most influential "how aggressive is the blend" knob.
- diversity_beta (0–10, default 10) - the bandpass exponent that suppresses near-consensus dominance, so a contributor that's too similar doesn't crowd everyone out. Zero disables it.
- rescale_norm (default on) - after weighting, set each merged vector's norm to the mean participating norm. Keeps the output's scale sane; leave it on.
- global_scale (0–10, default 1) - a final multiplier on the contribution. For LoRA it's applied through the up factor. A cheap overall strength dial.
- dynamic_similarity_contrast (default off) - remaps unequal consensus similarities into the 0.7–1.0 range before alpha/beta weighting, stretching the differences so they matter more.
- soft_comfort_bandpass (default on) - uses
1.5 − similarityinstead of1.001 − similarityfor the diversity weighting; the softer curve behaves better when contributors are similar. - position_weight (0–1, default 0.05) - how much positional affinity blends into similarity-based greedy matching. Small values are right.
- preserve_common_prefix (default off) - copies a numerically identical leading span straight from the anchor instead of blending it. Handy when two models share an identical frozen prefix.
How to use it
Wire the cwb_config output into the optional cwb_config input on any CWB merger - two or three model/checkpoint/text-encoder/LoRA/embedding variant. The tooltip is explicit: when connected, it completely overrides the selected preset. So the workflow is: leave the merger on any preset you like as a fallback, then use this node when you want exact control.
A sane starting point for most merges: keep median, similarity_threshold around 0–0.3, power_alpha 2–3, diversity_beta 4–10, rescale_norm on. The counterfactual_weight_sweep toggle on CWBLoRAMultiMerger is a great way to probe how sensitive your merge is to these values without running a dozen merges - set up a config you're curious about and let the sweep tell you if it matters.
Install
Part of Model Utility Toolkit (silveroxides/ComfyUI-ModelUtils). ComfyUI Manager → search "Model Utility Toolkit", or:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-ModelUtils
Restart ComfyUI. Real dependency: unifiedefficientloader (UEL). Keep ComfyUI current - the pack uses the newer extension API.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| consensus_type | COMBO | median | Mean is a symmetric center; median is more robust with three or more contributors. |
| alignment_method | COMBO | similarity | Pair vectors by position or greedy cosine similarity where the merge type supports alignment. |
| alignment_threshold | FLOAT | 0.000–1 | Minimum cosine product or score for accepting a similarity-aligned row match. |
| similarity_threshold | FLOAT | 0.00-1–1 | Minimum contributor similarity to the group consensus before weighting. |
| power_alpha | FLOAT | 2.00–10 | Exponent applied to accepted non-negative consensus similarities. |
| diversity_beta | FLOAT | 10.00–10 | Bandpass exponent used to suppress near-consensus dominance; zero disables it. |
| rescale_norm | BOOLEAN | true | Set each merged vector norm to the mean participating norm after weighting. |
| global_scale | FLOAT | 1.000–10 | Multiply the final contribution once; LoRA applies this through the up factor. |
| dynamic_similarity_contrast | BOOLEAN | false | Remap unequal consensus similarities into 0.7 to 1.0 before alpha and beta weighting. |
| soft_comfort_bandpass | BOOLEAN | true | Use 1.5 minus similarity instead of 1.001 minus similarity for diversity weighting. |
| position_weight | FLOAT | 0.050–1 | Blend positional affinity into similarity-based greedy matching. |
| preserve_common_prefix | BOOLEAN | false | Copy a numerically identical leading component span from the anchor. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| cwb_config | CWB_CONFIG | — |