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

Model Merger (Attention/DARE)

DARE merging aimed at attention and the shell

By 54rt1n·Created 3 years ago·Updated about a year ago· 98
Model Merger (Attention/DARE)
  • model_a
  • model_b
  • model_mask
  • MODEL
drop_rate0.90
tiessum
rescaleoff
seed1
methodcomfy
iterations1
exterior1.00
interior1.00
core1.00
process_normtrue
process_attntrue
process_ff_nettrue
norm1.00
attn1.00
ff_net1.00

Model Merger (Attention/DARE) is the DARE merge with the most opinionated default targeting in the pack. It combines two gradient ideas at once - a "shell" weighting and an attention-element weighting - multiplies them together, and runs DARE-TIES under that combined gradient. The display name says "Attention," but it's really attention plus the shell structure: the node is the two gradient types stacked.

Here's the mental model. The shell gradient divides the UNet into three rings: the exterior (the first and last blocks - where the image enters and leaves), the interior (the middle blocks), and the core (the deep bottleneck around the middle block). The attention gradient divides each block by parameter type: norm, attn, and ff_net. The node computes both from the same model, multiplies them element-wise, and DARE-merges under the result. So a parameter that's both exterior AND attn gets the product of the two ratios; a parameter in either category gets the other category's default.

The inputs that matter

  • model_a, model_b - base and injected model.
  • exterior, interior, core - shell ratios, all default 1 (keep A).
  • norm, attn, ff_net - element ratios, all default 1.
  • process_norm, process_attn, process_ff_net - turn a parameter kind on or off entirely. This is how you make it truly "attention only": switch off norm and ff_net and the shell weights apply only to attention parameters.
  • drop_rate (default 0.9), ties, rescale, seed, method, iterations - the standard DARE stack. Rescale off, ties on sum, seed fixed.
  • model_mask (optional) - parameter-level protection on top.

Why you'd use it

Because it collapses two dials you'd otherwise chain through Gradient Operations into one node. The package's own interest is in targeting: "targeting attention" is a stated design goal of the element variant, and the shell ring is the author's take on the onion idea (there's also a standalone Shell Gradient node in the pack). If your merge should leave the outer layers of model A alone while letting the interior and attention layers borrow from model B, this node says it in one place.

The output

A MODEL patch, same as every merger in the pack - KSampler or Save Checkpoint (MODEL + CLIP + VAE), nothing written to disk on its own.

Install and gotchas

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

The practical caveat: with the product-of-gradients design, a parameter only gets a non-default ratio if both its shell ring and its element kind are non-default. Knock attn down to 0 and every attention parameter - exterior, interior, and core alike - is pinned to model B's values, because the 0 multiplies through the shell ratio. That's powerful and easy to misread; dump the resulting gradient with Gradient Reporting if you're not sure what the multiplication produced, and remember this merge is stochastic, so fix the seed before you compare.

CategoryDareMerge/unet

Inputs (18)

NameTypeDefaultDescription
model_aMODEL
model_bMODEL
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
exteriorFLOAT1.000–1
interiorFLOAT1.000–1
coreFLOAT1.000–1
process_normBOOLEANtrue
process_attnBOOLEANtrue
process_ff_netBOOLEANtrue
normFLOAT1.000–1
attnFLOAT1.000–1
ff_netFLOAT1.000–1
model_maskoptMODEL_MASK

Outputs (1)

NameTypeDescription
MODELMODEL