Nodes/OmniNodes/Dual Model Merger πŸ”€
ComfyUI Node

Dual Model Merger πŸ”€

Weighted sum, add difference, and a slerp that isn't quite slerp

By TensorVizionΒ·Created 3 months agoΒ·Updated about 8 hours agoΒ· 0
Dual Model Merger πŸ”€
  • model_A
  • model_B
  • model
  • merge_info
β—„merge_ratio0.50β–Ί
β—„interpolationβ–Ύβ–Ί

Most model merging happens offline with a dedicated tool: load two checkpoints, blend weights, save a new one. Dual Model Merger is the in-graph version - it takes two already-loaded MODELs, blends them, and hands you a merged model that behaves like any other ComfyUI model. If your workflow is "merge these two every run, then sample," it saves you the export/reload round trip entirely.

Mechanically it's the same machinery ComfyUI's own checkpoint merge nodes use: clone model A, grab both models' key patches via get_key_patches(), and apply the blend through add_patches(). It never edits a state dict by hand, so the result is a proper patched model rather than a hand-rolled average.

Three interpolation methods:

  • Weighted Sum - out = AΒ·(1βˆ’ratio) + BΒ·ratio. The classic linear blend, and honestly the one you'll use 90% of the time.
  • Add Difference - out = A + (B βˆ’ A)Β·ratio. Mathematically identical to weighted sum for a two-model blend; it's kept as a named option because some merge tools frame it as "B as a delta on A," and the mental model matters to people.
  • Slerp - the interesting one, and the one with a caveat attached. True SLERP interpolates tensors along a sphere, which needs raw weight tensors. ComfyUI's add_patches() API works with opaque patch tuples at this layer, so the node approximates SLERP by applying a sinusoidal weighting curve to patch strengths instead - easing gently through the midpoint rather than ramping linearly. The useful property (avoiding that washed-out 50/50 blend) is preserved; the literal math isn't. The docstring says so plainly: for exact SLERP on latents, use a latent-interpolate node's slerp method.

Inputs: model_A, model_B, merge_ratio (0–1, default 0.5), and interpolation. Outputs: the merged model and a merge_info string reporting how many patches applied and how many were skipped.

The honest take on when to reach for this: it's a convenience node for on-the-fly merges, not a replacement for a serious merging workflow. The "Slerp" label oversells what's happening at the tensor level, so treat it as "sinusoidal-eased blend" and you won't be disappointed. And if you're doing a careful, repeated merge you plan to ship as a checkpoint, do it with a proper merge tool where you control every layer's contribution - this node is for iterating inside the graph, and it's good at that narrow job.

One beginner trap worth naming: the merge is applied to the diffusion model patches of both models. LoRAs, CLIP, VAE - none of that is touched. Which is correct behavior for a model merge, but if you expected the merged result to inherit a LoRA you'd loaded on one branch, it won't.

Install

Part of OmniNodes:

cd ComfyUI/custom_nodes
git clone https://github.com/TensorVizion/OmniNodes

Restart ComfyUI, or install "OmniNodes" via ComfyUI Manager. No extra dependencies.

Troubleshooting

  • Merged model looks identical to one parent - check merge_ratio. 0.0 is all-A, 1.0 is all-B; 0.5 is the blend. Also confirm both models actually differ.
  • merge_info shows skipped patches - some keys don't align between the two models (different architectures won't merge meaningfully at all). Read the count in the info string.
CategoryTensorVizion/Model Utilities

Inputs (4)

NameTypeDefaultDescription
model_AMODELβ€”
model_BMODELβ€”
merge_ratioFLOAT0.500–1β€”
interpolationCOMBO3 options: Weighted Sum, Add Difference, Slerp

Outputs (2)

NameTypeDescription
modelMODELβ€”
merge_infoSTRINGβ€”