Nodes/Model Utility Toolkit/Delta CWB Merge LoRAs (3)
ComfyUI Node

Delta CWB Merge LoRAs (3)

The CWB consensus merge with a third vote

By silveroxides·Created about a year ago·Updated a day ago· 16
Delta CWB Merge LoRAs (3)
  • cwb_config
  • output_filename
  • cwb_report
lora_1
lora_2
lora_3
cwb_presetbalanced_mean
mismatch_modeskip
output_filenamedelta_cwb_merged_3_lora
save_dtypebf16
output_representationfull_difference
output_rank384
process_devicecuda
exclude_patterns
discard_patterns
glob_patternsfalse
force_clear_cachetrue

Add a third LoRA and the "average them and hope" school of merging gets worse in a hurry: when three independent LoRAs all touch the same layer, a plain mean buries anything only one of them believes in. Delta CWB Merge LoRAs (3) is the three-input version of the pack's Consensus-Weighted Blending merger, and three contributors is actually where CWB's logic shines - a majority vote can emerge. Each LoRA is expanded to its full per-layer weight change, then merged row by row using a mean or median consensus, with each contributor's effective weight set by how strongly its rows agree with that consensus. Rows that fight the group get suppressed; rows that reinforce it carry the output.

It's the same machinery as the two-input Delta CWB Merge LoRAs (2), just with lora_3 added as an equal-prior contributor. Everything else - presets, the optional custom-config override, output modes, and the cwb_report - carries over unchanged, which is good news because it means the controls you learn on the 2-input node transfer directly.

Inputs that matter

  • lora_1, lora_2, lora_3 - dropdowns of your loras folder; lora_1 anchors metadata and the output layer set.
  • cwb_preset (default balanced_mean) - six presets from simple mean/median blends (balanced_mean, robust_medn, selective_mean) up to the norm-aware, diversity-boosting ones (varied_mean_rn_softcb, diverse_medn_rn_dsc_softcb, strongdiv_medn_rn_dsc_softcb). With three inputs, the median-based presets (robust_medn, diverse_medn_rn_dsc_softcb) start to mean something concrete: the median row is the one two of three contributors agree on.
  • cwb_config (optional) - plugging in the pack's CWB Custom Configuration node overrides the preset completely; leave it empty to use the named preset.
  • mismatch_mode (default skip) - with three independently trained LoRAs, patchy layer coverage is normal. skip keeps LoRA 1's layer, zeros counts absent inputs as zero change, error aborts rather than merge on incomplete data.
  • output_representation / output_rank - full_difference saves the exact merged dense deltas; factorized_lora re-factorizes each layer into lora_A/lora_B factors capped at output_rank (default 384) for a compact, conventional LoRA file.
  • Plus the shared set: output_filename, save_dtype (default bf16), process_device (CUDA with per-layer CPU fallback), exclude_patterns/discard_patterns/glob_patterns, and force_clear_cache.

Outputs: output_filename (the new .safetensors in your loras folder) and cwb_report, a text summary of merged vs. preserved layers, dtype breakdown, and CUDA fallbacks. Read the report on your first few merges - it's the fastest way to develop a feel for what the consensus weighting actually kept.

Realistic notes

This family is the pack's experimental edge, so treat outputs with healthy skepticism and compare against a plain three-LoRA stack before baking anything important. Expect it to raise on non-canonical LoRAs (DoRA-scale or low-bit factors) rather than merge them. Layer-at-a-time streaming keeps memory sane, and the atomic writer means a failed run won't clobber a same-named file - though a successful rerun will overwrite it. If your merge count is fluid, the Delta CWB LoRA Multi-Merge sibling handles 2–8 inputs with a lora_count selector; when you're fixed at three, this node's three dedicated slots are simpler to read at a glance.

Installing it

Same pack as the rest of ModelUtils. ComfyUI Manager: search Model Utility Toolkit. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-ModelUtils

Restart ComfyUI. No API keys or model downloads - it only reads LoRAs already in your models/loras folder. Find it under ModelUtils → LoRA → Merge → Delta CWB, or search "Delta". It sits alongside the classic merger tools (checkpoint/embedding mergers, MetaKeys, PruneKeys) that make this pack the one-stop shop for doing model surgery without leaving the graph.

CategoryModelUtils/LoRA/Merge/Delta CWB

Inputs (15)

NameTypeDefaultDescription
lora_1COMBOMetadata and layer anchor. Defines saved layers and preserved values.
lora_2COMBOEqual-prior LoRA contributor. CWB determines its effective row influence.
lora_3COMBOEqual-prior LoRA contributor. CWB determines its effective row influence.
cwb_presetCOMBObalanced_meanControls how strongly agreement, disagreement, and row magnitude affect the saved full weight changes. A connected CWB Config overrides it completely.
mismatch_modeCOMBOskipFor a missing or incompatible anchored layer: preserve LoRA 1, include an explicit zero contributor, or abort.
output_filenameSTRINGdelta_cwb_merged_3_loraRelative filename for the atomically saved full-difference LoRA.
save_dtypeCOMBObf16Requested saved precision. Participating FP32 inputs preserve FP32.
output_representationCOMBOfull_differenceSave exact full differences or factorize each merged layer directly into compact LoRA factors.
output_rankINT3841–16384Maximum rank used when Output Representation is factorized_lora.
process_deviceCOMBOcudaProcessing device. Only a failed CUDA layer retries on CPU.
exclude_patternsSTRINGPreserve matching canonical full-difference layers from LoRA 1.
discard_patternsSTRINGOmit matching canonical full-difference layers from the output.
glob_patternsBOOLEANfalseUse shell-style glob patterns instead of regular expressions.
force_clear_cacheBOOLEANtrueClear Python and CUDA caches before each layer to reduce retained memory.
cwb_configoptCWB_CONFIGOptional complete settings override from CWB Custom Configuration.

Outputs (2)

NameTypeDescription
output_filename*
cwb_reportSTRING