Nodes/ComfyUI-DonutNodes/DonutWidenMergeUNet
ComfyUI Node

DonutWidenMergeUNet

Merge checkpoints by importance, not by blind averaging

By DonutsDelivery·Created about a year ago·Updated about 15 hours ago· 25
DonutWidenMergeUNet
  • model_base
  • model_other
  • lora_stack
  • model_3
  • model_4
  • model_5
  • model_6
  • model_7
  • model_8
  • model_9
  • model_10
  • model_11
  • model_12
  • model
  • merge_results
  • parameter_info
merge_strength1.00
min_strength0.0
max_strength1.0
normalization_modemagnitude
importance_threshold1.0
importance_boost1.0
rank_sensitivity2.0
skip_threshold0.0000
scale_to_min_maxfalse
invert_strengthsfalse

Most model merges treat every weight equally: blend model A and model B at 50/50 and hope the good parts survive. That works until it doesn't - because some layers in A carry important, specialized knowledge while the same layers in B are near-garbage, and a flat average waters both down. DonutWidenMergeUNet is the pack's importance-weighted answer. It looks at each parameter, decides how much it actually matters to each source model, and blends accordingly - the WIDEN ("weight-based importance") approach, with the knobs to control how aggressive that discrimination is.

This is the heavyweight merge tool in the ComfyUI-DonutNodes pack, and it's aimed at people doing real checkpoint surgery - merging SDXL models, blending a character LoRA's strength distribution into a base, or combining several models into one. If your merges are simple 50/50 jobs, the stock ComfyUI ModelMergeSimple is fine; this is for when you want control over which weights dominate the result.

What it does

Under the hood it classifies every parameter by architectural role (time/class embeddings, cross-attention, self-attention, convs, norms, biases), assigns importance weights per role, and uses a compatibility score to decide how far each weight moves toward the other model. That's the thing that separates it from a weighted average: a parameter where model A is confident and model B is weak barely moves, so you keep A's expertise without importing B's noise. There's also neuron alignment (Hungarian matching on linear layers), embedding-transpose detection, and a norm-recalibration step - the sort of hygiene the merge nerds argue about.

The controls that matter:

  • merge_strength - overall intensity (0–5, default 1). How far toward model_other the merge goes.
  • min_strength / max_strength - the range each parameter's blend ratio is allowed to occupy. Keep min at 0 and max at 1 for a normal merge; widen the range to push harder.
  • normalization_mode - magnitude (default), calibrate, or none. magnitude renormalizes so overall weight magnitude doesn't drift; calibrate runs a calibration pass. Start with the default.
  • importance_threshold (default 1), importance_boost (default 1) - how selective the importance filter is. Raise the threshold to keep more of model_base's structure.
  • rank_sensitivity (default 2), skip_threshold (default 0) - the compatibility gating. skip_threshold above 0 starts skipping parameters entirely when compatibility is low, which is the "don't import this at all" control.

You also get optional slots for up to 11 more models (model_3model_12) and a lora_stack input, plus scale_to_min_max and invert_strengths toggles for fine-tuning the distribution. Most people will use model_base + model_other and one or two extras.

Outputs: model (the merged result, wire it to a KSampler), plus merge_results and parameter_info STRINGs with per-parameter diagnostics - genuinely useful the first time a merge goes sideways, since they tell you what actually moved.

Practical notes

  • Save your work. The pack has a DonutModelSave node for merged models - a merge this configurable should be saved to disk, not left as a live graph you regenerate every run.
  • The CLIP needs merging too. DonutWidenMergeCLIP is the companion for text encoders. Merge the UNet and the CLIP with matching settings or the prompt side won't match the image side.
  • Slow first run. The compatibility analysis samples parameters to tune the distribution; that's seconds, not minutes, but it's not instant either.
  • Opinion: the defaults are sensible, so don't touch the advanced knobs until you've seen a result. merge_strength and min/max_strength get you 90% of the way. The importance machinery is there for when the naive merge clearly loses something - that's when it earns its complexity.

Install

Part of ComfyUI-DonutNodes: ComfyUI Manager → search "DonutNodes" → install → restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/DonutsDelivery/ComfyUI-DonutNodes.git donutnodes
cd donutnodes
python -m pip install -r requirements.txt

The pack's dependencies (opencv-python-headless, scipy, matplotlib, psutil, tqdm, requests) are all it needs - scipy does the neuron-alignment work, and it's in the list. No model downloads.

Categorydonut/merge

Inputs (23)

NameTypeDefaultDescription
model_baseMODEL
model_otherMODEL
merge_strengthFLOAT1.000–5
min_strengthFLOAT0.00–5
max_strengthFLOAT1.00.1–5
normalization_modeCOMBOmagnitude3 options: magnitude, calibrate, none
importance_thresholdFLOAT1.00–500
importance_boostFLOAT1.00–3
rank_sensitivityFLOAT2.00–10
skip_thresholdFLOAT0.00000–1
lora_stackoptLORA_STACK
model_3optMODEL
model_4optMODEL
model_5optMODEL
model_6optMODEL
model_7optMODEL
model_8optMODEL
model_9optMODEL
model_10optMODEL
model_11optMODEL
model_12optMODEL
scale_to_min_maxoptBOOLEANfalse
invert_strengthsoptBOOLEANfalse

Outputs (3)

NameTypeDescription
modelMODEL
merge_resultsSTRING
parameter_infoSTRING