SDNext Merge
SD.Next's checkpoint merger, natively in ComfyUI, with Re-Basin
- optional_model_a
- optional_clip_a
- optional_model_b
- optional_clip_b
- optional_model_c
- optional_clip_c
- optional_mbw_layers_alpha
- MODEL
- CLIP
SD.Next - vladmandic's fork of the original A1111 WebUI - has a genuinely capable Models > Merge tab built on a Python merging library called meh. This node ports that whole engine into ComfyUI as a single node and bolts on Git Re-Basin support on top. If you've ever wanted proper checkpoint-merging tooling without leaving your ComfyUI graph, this is the flagship node in the pack - everything else here (the VAE merger, the MBW block-weight builders) either feeds this node or does the same job one level down.
How it works
model_a, model_b, and model_c are dropdowns of checkpoint files already sitting in your models folder - pick two (or three, for the difference-family modes) and merge. If you'd rather merge something that isn't a plain file on disk - a checkpoint you've already patched with a LoRA upstream, say - wire the optional_model_a / optional_clip_a (and _b, _c) inputs instead; they take MODEL/CLIP straight from another loader.
merge_mode gives you 13 options, one more than the pack's VAE Merge node (it adds train_difference). They group the same way: plain interpolation (weighted_sum, weighted_subtraction, tensor_sum, sum_twice, triple_sum), difference-based grafting (add_difference, train_difference, euclidean_add_difference, multiply_difference) for transplanting one model's changes onto another, and a newer batch (top_k_tensor_sum, similarity_add_difference, distribution_crossover, ties_add_difference) - that last name is a giveaway, TIES-style merging is published research from the LLM-merging world, repurposed here for diffusion checkpoints to cut down on interference when you're combining more than one delta. For a first merge, weighted_sum with alpha at 0.5 is a plain 50/50 blend; add_difference (needs model_c/clip_c wired as the shared ancestor) is the classic "graft B's changes onto A" move. beta only matters for the three-model modes.
Two features that make this more than a basic blender:
mbw_preset_alpha- 39 named block-weight presets (GRAD_V,GRAD_A,FLAT_25,WRAP08, and so on). Merge Block Weighted (MBW) is a real, community-established technique - it's been floating around A1111 as a dedicated extension since 2023, letting you apply a different blend weight to each block of the UNet instead of one flat number, because different blocks tend to carry different traits (composition versus fine detail). This dropdown ships the standard named presets so you don't have to hand-tune anything. Leave it atnonefor a flat globalalpha.optional_mbw_layers_alphagoes further - wire in anMBW_LAYERSbundle from one of this pack's own MBW Layers nodes for full manual per-block control, which overrides the preset.re_basin(off by default) plusre_basin_iterations(1–25, default 5) - Git Re-Basin permutes one model's internal weight ordering to line up with the other's before averaging, which cuts down on the "ghosting" you get from naively averaging two independently-trained models. It costs real compute per iteration, which is why it's opt-in.
The rest is engine-room control: precision (fp16 halves merge memory, original keeps whatever the inputs came in as), weights_clip (on by default - clamps the merged weights back toward the input range so you don't get exploding outliers), and mem_device/work_device (cuda/cpu) with threads (1–24, default 4) for where and how parallel the merge math runs.
Inputs and output
The required fields you'll actually touch first: model_a, model_b, merge_mode, alpha. Everything else is a knob you turn once you know you need it. Output is MODEL + CLIP - no VAE, so pair it with this pack's own VAE Merge node if you want the VAE merged too.
Installing it
ComfyUI Manager: search TechNodes, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/TechnoByteJS/ComfyUI-TechNodes --depth 1
No extra models, no heavy Python deps to chase down - it runs on checkpoints you already have.
Where people get burned
model_a/model_b sample as none in the dropdown - if you leave them there, nothing sensible happens; actually pick real checkpoints, or wire the optional_model_* inputs. Picking a difference-family mode without a third checkpoint wired in is the same trap as the VAE merger: the merge runs, it just runs wrong. Merging checkpoints from different base architectures (an SD 1.5 file into an SDXL merge) doesn't dilute gracefully - checkpoints are locked to their base architecture, and crossing that line produces garbage rather than a compromise. work_device: cuda needs enough VRAM to hold two or three full checkpoints at once during the merge; if you OOM, drop it to cpu and accept a slower merge instead of failing outright. And Re-Basin is genuinely slow - start at the default 5 iterations before cranking toward 25 on a big model.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| model_a | COMBO | 1 options: none | |
| model_b | COMBO | 1 options: none | |
| model_c | COMBO | 1 options: none | |
| merge_mode | COMBO | 13 options: weighted_sum, weighted_subtraction, tensor_sum, add_difference, train_difference, sum_twice, +7 | |
| precision | COMBO | 2 options: fp16, original | |
| weights_clip | BOOLEAN | true | — |
| mem_device | COMBO | 2 options: cuda, cpu | |
| work_device | COMBO | 2 options: cuda, cpu | |
| threads | INT | 41–24 | — |
| mbw_preset_alpha | COMBO | none | 39 options: none, GRAD_V, GRAD_A, FLAT_25, FLAT_75, WRAP08, +33 |
| alpha | FLOAT | 0.500–1 | — |
| beta | FLOAT | 0.250–1 | — |
| re_basin | BOOLEAN | false | — |
| re_basin_iterations | INT | 51–25 | — |
| optional_model_aopt | MODEL | — | |
| optional_clip_aopt | CLIP | — | |
| optional_model_bopt | MODEL | — | |
| optional_clip_bopt | CLIP | — | |
| optional_model_copt | MODEL | — | |
| optional_clip_copt | CLIP | — | |
| optional_mbw_layers_alphaopt | MBW_LAYERS | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |
| CLIP | CLIP | — |