Nodes/ComfyUI-DareMerge/Model Merger (Advanced/DARE)
ComfyUI Node

Model Merger (Advanced/DARE)

DARE merging with a gradient you built yourself

By 54rt1n·Created 3 years ago·Updated about a year ago· 98
Model Merger (Advanced/DARE)
  • model_a
  • model_b
  • gradient
  • model_mask
  • MODEL
drop_rate0.90
tiessum
rescaleoff
seed1
methodcomfy
iterations1

Model Merger (Advanced/DARE) is the full manual transmission of the DARE family: DARE-TIES sparsification, plus a LAYER_GRADIENT input so you decide per layer how much of model B actually lands. The other DARE nodes in the pack are this node with a gradient generated for you internally. This one makes you supply it - which is the whole point. If you're comfortable building gradients (or chaining the gradient nodes), this is the most flexible DARE merge in the pack.

Why separate the gradient from the merge at all? Because the block and MBW nodes bake their ratio scheme in, and sometimes you want a scheme they don't offer - attention-only weighting, a blend of two gradient shapes, or per-layer edits after the fact. The gradient pipeline gives you that: Block Gradient for coarse stages, Attention Gradient for norm/attention/feed-forward, Gradient Operations to combine them, Gradient Edit to poke individual layers. Every one of those outputs a LAYER_GRADIENT, and this is where it finally gets consumed.

How it works

Same core as the whole DARE family: compute the delta from model B to base model A, drop drop_rate of it at random, run TIES sign-agreement so you don't fight the base's existing direction, optionally rescale, and add the survivors back. The gradient gates each layer's participation - a ratio of 1 means DARE runs freely there, 0 means that layer stays 100% model A. The gradient is read per parameter key; a layer whose key isn't in the gradient simply doesn't merge.

The inputs that matter

  • model_a, model_b - base and injected model.
  • gradient - your LAYER_GRADIENT. Hand it a Block Gradient to start; that's the friendly on-ramp.
  • drop_rate (default 0.9), ties (sum/count/off), rescale (off/on) - standard DARE controls. Rescale stays off; the author's note that it "yields terrible results for SD" applies here exactly.
  • seed - fix it. This is a stochastic merge; the same graph with an unfixed seed gives you a different model every run.
  • method - comfy (default) plus lerp/slerp and the exotic interpolation family.
  • iterations - repeat the stochastic pass N times.
  • model_mask (optional) - parameter-level protection on top of the layer-level gradient.

The output

A MODEL patch - wire to a KSampler to test, or into Save Checkpoint (with CLIP + VAE) to keep. Nothing is written to disk automatically.

Install and gotchas

ComfyUI Manager (search "DareMerge") or git clone https://github.com/54rt1n/ComfyUI-DareMerge into ComfyUI/custom_nodes, restart. Dependencies: matplotlib, numpy, torch, pillow, no downloads. SD1.5 and SDXL only.

Two traps specific to this node. First, the gradient is a silent contract: if your gradient misses a layer's key, that layer just doesn't merge, and you can end up with a half-merged model without any error to point at. Dump the gradient with Gradient Reporting before you run. Second, because the merge is random, the gradient might be deterministic but the outcome isn't - always compare results with a fixed seed, and don't judge the merge on a single roll.

CategoryDareMerge/unet

Inputs (10)

NameTypeDefaultDescription
model_aMODEL
model_bMODEL
gradientLAYER_GRADIENT
drop_rateFLOAT0.900–1
tiesCOMBOsum3 options: sum, count, off
rescaleCOMBOoff2 options: off, on
seedINT10–99999999999
methodCOMBOcomfy12 options: comfy, lerp, slerp, slice, cyclic, gradient, +6
iterationsINT11–100
model_maskoptMODEL_MASK

Outputs (1)

NameTypeDescription
MODELMODEL