CWB LoRA Multi-Merge
Merge 2 to 8 LoRAs in one go — the CWB LoRA blender that scales
- cwb_config
- output_filename
- documentation
- cwb_report
The CWBLoRAMultiMerger is the LoRA merger for people who stopped counting their LoRA stack. It consensus-merges anywhere from 2 to 8 LoRAs into a single file, with the same per-layer Consensus-Weighted Blending as the two- and three-input variants - just with a lot more contributors to keep straight. If you've got a pile of style LoRAs you want to collapse into one loadable file, this is the node.
How it works
You pick a lora_count between 2 and 8, then fill in the matching number of lora_1 … lora_8 inputs. The first is the anchor - metadata source and preservation reference. The rest are equal-prior contributors, with any beyond your count left on None. Set the count to 4 and only 4 inputs are read; leave one selected-but-None inside your count and the node refuses to run with a clear "LoRA Count includes unselected input(s)" error rather than silently merging the wrong set.
For each logical layer (each down/up pair treated as a unit), CWB computes a consensus, measures every contributor's cosine similarity to it, and weights contributions by similarity. With 5-8 contributors the median consensus and the diversity bandpass matter a lot - that's what keeps two near-identical LoRAs from dominating a merge of six. The default preset broad_sim_medn_rn_softcb is designed for exactly this crowd; the _softcb suffix means the diversity weighting is the soft variety, which behaves better when contributors are genuinely similar.
Two things are worth calling out. lazy_load uses "bounded" UEL streaming here - tensors are read per work unit and released after each completed layer, so merging eight LoRAs stays RAM-friendly even though they're all in play. And there's a counterfactual_weight_sweep toggle: turn it on and the node evaluates a bunch of alpha/beta/threshold/DSC/bandpass weight combinations from the consensus similarities it already computed, appending them to the report without any extra model loads or saved files. It's a cheap way to see how sensitive your merge is to the weighting parameters - a genuinely nice touch if you're trying to understand why a merge came out the way it did.
Inputs that matter
- lora_count - how many of the consecutive
lora_Ninputs to include. - lora_1 … lora_8 - the files; lora_1 is the anchor.
- cwb_preset (default
broad_sim_medn_rn_softcb) - the LoRA registry. - execution_mode -
MERGE(default) writes the output;DOCUMENTATION ONLYopens no model files. - include_1d_diffs (default off) - merge 1D tensors (alphas, biases) in fp32 instead of preserving the anchor.
- counterfactual_weight_sweep (default off) - the parameter-sensitivity sweep described above.
- output_filename (default
cwb_merged_multi_lora) - written tomodels/loras. - save_dtype (default
bf16) - dtype for the generated factors; bf16 is a reasonable default for LoRA files. - mismatch_mode, exclude_patterns, discard_patterns, glob_patterns, force_clear_cache, override_dtype - same meanings as the other CWB mergers.
Outputs
output_filename (the written file), documentation (the CWB reference), and cwb_report (per-layer detail plus sweep results if enabled). Load with a normal LoRA Loader.
Where this pays off
Consolidating a character + style + quality stack you keep re-applying at fractional strengths, or merging a whole batch of similar concept LoRAs into one file to reduce workflow clutter. It's a batch node - write the file, then test it in a normal workflow.
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) for the streaming loads. Keep ComfyUI current - the pack uses the newer extension API, and this node is author-flagged experimental.
Inputs (24)
| Name | Type | Default | Description |
|---|---|---|---|
| execution_mode | COMBO | MERGE | MERGE writes an output; DOCUMENTATION ONLY opens no model files. |
| lora_count | COMBO | 2 | Number of consecutive LoRA inputs to include. |
| lora_1 | COMBO | Anchor LoRA and metadata source. | |
| lora_2 | COMBO | Second equal-prior LoRA contributor. | |
| lora_3 | COMBO | None | Optional third equal-prior contributor. |
| lora_4 | COMBO | None | Optional fourth equal-prior contributor. |
| lora_5 | COMBO | None | Optional fifth equal-prior contributor. |
| lora_6 | COMBO | None | Optional sixth equal-prior contributor. |
| lora_7 | COMBO | None | Optional seventh equal-prior contributor. |
| lora_8 | COMBO | None | Optional eighth equal-prior contributor. |
| cwb_preset | COMBO | broad_sim_medn_rn_softcb | LoRA-specific preset. A connected CWB Config overrides it completely. |
| mismatch_mode | COMBO | skip | Preserve the anchor, insert zeros, or abort for missing and incompatible logical groups. |
| output_filename | STRING | cwb_merged_multi_lora | Filename without extension under ComfyUI's LoRA directory. |
| save_dtype | COMBO | bf16 | Requested dtype for generated floating factors. |
| process_device | COMBO | cuda | Per-layer FP32 processing device; CUDA OOM retries the affected layer on CPU. |
| exclude_patterns | STRING | Preserve matching logical groups from the anchor. | |
| discard_patterns | STRING | Omit matching tensors or logical groups from the output. | |
| glob_patterns | BOOLEAN | false | Interpret filter entries as shell-style globs instead of regular expressions. |
| lazy_load | BOOLEAN | true | Use bounded UEL work-unit streaming and release each completed input layer. |
| force_clear_cache | BOOLEAN | true | Collect Python and CUDA caches before each layer at a potential speed cost. |
| override_dtype | BOOLEAN | false | Force generated floating factors to the requested save dtype. |
| include_1d_diffs | BOOLEAN | false | CWB-merge 1D direct differences as FP32 instead of preserving the anchor. |
| counterfactual_weight_sweep | BOOLEAN | false | Evaluate alpha, beta, similarity-threshold, DSC, and comfort-bandpass weight combinations from each already-computed consensus similarity vector and append them to the report without additional model loads or saved outputs. |
| cwb_configopt | CWB_CONFIG | Optional complete override from CWB Custom Configuration. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| output_filename | * | — |
| documentation | STRING | — |
| cwb_report | STRING | — |