CWB Merge Checkpoints (2 Models)
CWB's adaptive blend
- cwb_config
- output_filename
- documentation
- cwb_report
Checkpoint merging usually means one number: a fixed interpolation weight between two models, applied to every layer identically. CWB - Consensus-Weighted Blending - is the smarter version. Instead of one global blend ratio, it computes, per layer, how similar each model is to a consensus, then weights each model's contribution by that similarity. Two layers that agree get one treatment; two layers that disagree get another. The result is a merged checkpoint where the blend adapts to what the models actually contain, and you never have to dial a single global alpha.
How it works
Pick two checkpoints from models/checkpoints. Model A is the primary contributor and the anchor - it supplies the output metadata, anchors tensor names and shapes, and is what you "preserve" when something goes missing. Model B is the second equal-prior contributor.
For each tensor, the merger does this: it computes an element-wise consensus (mean or median, depending on preset), measures each model's cosine similarity to that consensus, rejects contributors below a similarity threshold, raises the surviving similarities to a power, normalizes the weights, and produces a weighted sum. Then it optionally rescales the merged vector's norm to match the participating average. Nothing about this requires you to guess a ratio - the similarities are the weights.
The output key set is the union of both inputs. A tensor only present in B is copied unchanged. If a tensor is missing from A but present in B, it's still merged from the sources available rather than dropped. You control what happens with incompatible or missing tensors via mismatch_mode: skip preserves the anchor, zeros inserts a zero contribution where possible, error aborts loudly.
Inputs that matter
- execution_mode -
MERGEwrites the new safetensors file.DOCUMENTATION ONLYreturns the full CWB reference without loading or merging anything. Use it to read the spec before your first merge. - model_a / model_b - the two checkpoints.
- cwb_preset (default
balanced_mean) - complete use-case settings. Preset names are self-describing:_mednmeans median consensus,_rnenables norm rescaling,_dscdynamic similarity contrast,_softcbthe soft comfort bandpass.balanced_meanis the mild default;robust_mednis a median-based starting point;strongdiv_medn_rn_dsc_softcbpushes diversity hard. Don't overthink the first try -balanced_meanis fine. - output_filename - no extension; written atomically to
models/checkpoints. - save_dtype - fp32/fp16/bf16 for generated tensors. Participating fp32 inputs stay fp32 unless override_dtype is on.
- exclude_patterns / discard_patterns - regex (or glob) lists. Excludes preserve matching layers from the anchor instead of merging; discards omit matching tensors from the output entirely.
- lazy_load (default on) - UEL streaming so the inputs aren't held in RAM. Leave it on.
- force_clear_cache (default on) - clears Python and CUDA caches before each layer. Slower, but keeps memory bounded. This is the setting to flip off on a machine with plenty of VRAM.
Outputs
output_filename (the written file), documentation (the CWB reference), and cwb_report (a per-layer account of what was merged). Load the result with a regular CheckpointLoader to use it. The reports are worth a read after your first merge - they tell you which layers were preserved, merged, or discarded, so a weird result is diagnosable rather than mysterious.
What this is really for
The old workflow of "weight-sum 0.5 between anime and photoreal and pray" is exactly what this replaces. It's also the natural next step after running CheckpointModelAnalysis from the same pack - that node's CWB report is literally a preview of this node's math. It's a batch tool, not a generation node: it writes a file and stops, so run it, then switch to a normal workflow to test the result.
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. The meaningful dependency is unifiedefficientloader (UEL); the pack's other requirements.txt entries belong to its downloader nodes. These nodes use ComfyUI's newer extension API, so keep ComfyUI current. And note the CWB merger nodes are flagged experimental by the author - they work, but don't expect them to be battle-scarred yet.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| execution_mode | COMBO | MERGE writes a new safetensors file. DOCUMENTATION ONLY returns the CWB reference without loading or merging inputs. | |
| model_a | COMBO | Primary contributor and preservation anchor. Supplies output metadata and anchors shared tensor names and shapes. | |
| model_b | COMBO | Second equal-prior contributor. CWB derives its effective per-vector influence from consensus similarity. | |
| cwb_preset | COMBO | balanced_mean | Use-case preset. Name suffixes expose alignment, consensus, norm rescaling, DSC, soft comfort bandpass, and prefix preservation. A connected CWB Config overrides it completely. |
| mismatch_mode | COMBO | skip | For missing or incompatible anchored inputs: skip preserves the anchor, zeros inserts a zero contribution where possible, and error aborts. A lone secondary-only tensor is copied unchanged. |
| output_filename | STRING | cwb_merged_2_checkpoint | Filename without extension. The result is atomically written to this model category under ComfyUI's models directory. |
| save_dtype | COMBO | Requested dtype for generated floating tensors. Participating FP32 inputs keep a result FP32 unless Override Dtype is enabled. | |
| process_device | COMBO | Device used for per-layer FP32 CWB arithmetic. A CUDA out-of-memory error retries only the affected layer on CPU. | |
| exclude_patterns | STRING | One pattern per line. Matching layers are preserved from the anchor instead of merged. Uses regex unless Glob Patterns is enabled. | |
| discard_patterns | STRING | One pattern per line. Matching tensors or logical LoRA groups are omitted from the output. Uses regex unless Glob Patterns is enabled. | |
| glob_patterns | BOOLEAN | false | Interpret exclude and discard entries as shell-style glob patterns instead of regular expressions. |
| lazy_load | BOOLEAN | true | Use UEL low-memory loading so tensors are read and released per work unit instead of retaining the complete inputs in RAM. |
| force_clear_cache | BOOLEAN | true | Run Python garbage collection and clear the CUDA allocator cache before each layer. Reduces retained memory but can substantially slow merging. |
| override_dtype | BOOLEAN | false | Force generated tensors to save_dtype; guarded tensors and enabled 1D direct diffs are exempt. |
| cwb_configopt | CWB_CONFIG | Optional settings from CWB Custom Configuration. When connected, it completely overrides the selected preset. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| output_filename | * | — |
| documentation | STRING | — |
| cwb_report | STRING | — |