Elemental Merge (Recipe)
Merge checkpoints key-by-key, from a text recipe
- model1
- model2
- model
- report
If you've ever merged two checkpoints and gotten a model that's worse at both jobs, you already know the problem: a plain 50/50 merge averages every weight, so both parents get diluted. That's why the whole block-weighting school of merging exists - and why you still kept an A1111 install around just for SuperMerger, the extension people name as the one thing with no ComfyUI equivalent.
Elemental Merge (Recipe) from ComfyUI-RecipeMerge is that missing tool, as a ComfyUI node. It merges a UNet per key - not per block, per tensor inside each block - controlled by a plain-text recipe you can save, reuse, and share. It's an independent implementation inspired by SuperMerger's elemental merge, not a port of its code, so keep bug reports here and not on SuperMerger's repo.
How it works
You feed it two models. model1 is your base, model2 is what you're mixing in. The node walks every key under diffusion_model. in model2, asks the recipe "what ratio for this key?", and applies each patch as (ratio, 1 - ratio) - model2's weight at ratio, model1's at 1 - ratio. So ratio is "how much model2": 0.0 leaves model1 untouched, 1.0 fully replaces that key. Note that's the same direction as SuperMerger's alpha and opposite of ComfyUI's ModelMergeSimple, which is the #1 way people get an "inverted" merge and don't understand why.
Two scope limits worth knowing. Only the UNet is merged - the text encoder always comes from model1 (use standard CLIPMergeSimple if you want to blend CLIPs too). And it assumes SD1.5/SDXL's input/middle/output block structure; on a DiT like Flux, everything lands in BASE, so block targeting mostly stops working (element-wide rules and the default still apply).
The recipe
One rule per line, # for comments. The few patterns you'll actually use:
0.5 # bare number = default ratio for any unmatched key
attn2:0.8 # every block's attn2 at 0.8
NOT attn2:0.3 # everything EXCEPT attn2 at 0.3
IN04:attn2:0.9 # one block's attn2 only
IN*:0.4 # wildcards work
attn2.to_q:0.9 # dotted = deep sub-key, prefix-matched
Elements are UNet segment names: attn1 (self-attention), attn2 (cross-attention - your prompt response), ff (texture/quality), norm, proj_in, proj_out. Prefix matching means attn hits both attn1 and attn2, norm hits norm1–norm3. Precedence: block+element beats block-only beats default; ties go to the later line. No default line means unmatched keys sit at 0.0 - model1 unchanged.
The inputs that matter
Only four, and the recipe is the whole game. model1 / model2 are the parents, recipe is the text above, and sweep_value replaces any __VAL__ in the recipe. That last one is your XY-plot hook: write attn2:__VAL__, right-click sweep_value → Convert to Input, feed it from an efficiency-nodes XY plot, and you get a 0.0→1.0 sweep of just attn2. Outputs are model (into your sampler) and report - a STRING that shows how many keys each rule actually hit. Read it. A ★一致キーなし warning means a rule matched zero keys: typo, or a key the model simply doesn't have.
Install
Zero extra dependencies - requirements.txt is empty and pyproject.toml declares dependencies = []; it runs on stock ComfyUI. Either search "ComfyUI-RecipeMerge" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/galigali-san/ComfyUI-RecipeMerge
Restart ComfyUI and the three merge nodes appear under advanced/model_merging. Heads up: the UI labels are Japanese, so the node menus read ノード名 until a translation lands.
Common issues
- Merge looks inverted. Check your direction: this node's ratio is model2's share, the reverse of
ModelMergeSimple. - Rule "did nothing." The report tells you - a
★means it matched no keys.IN09/OUT11style blocks don't exist on SDXL and correctly report zero. - Distributing the result? Merging has licensing implications - check both parent models' licenses (the checkpoint KB hammers this: merge lineages inherit defects and license restrictions). The save path is standard
CheckpointSave, and your merge recipe gets embedded in the checkpoint metadata; run with--disable-metadataif that bothers you.
This is the node to reach for when you want the precision - a specific block's ff at 0.2, nothing else - without dragging 27 sliders around. For tactile knob-twiddling, the sibling Elemental Matrix Merge (Knobs) is the same engine with a synth panel on top.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| model1 | MODEL | — | |
| model2 | MODEL | — | |
| recipe | STRING | # 比率は model2 を混ぜる割合 (0.0=model1のまま, 1.0=model2) 0.5 # 例: # attn2:0.8 全ブロックのattn2だけ強くmodel2へ # NOT attn2:0.3 attn2以外を薄めに # IN04:attn2:0.9 IN04のattn2だけ狙い撃ち # OUT*:ff:0.2 OUT側のffだけ # attn2:__VAL__ sweep_valueの値が入る(XYプロット用) | — |
| sweep_value | FLOAT | 0.500-1–2 | レシピ内の __VAL__ をこの値で置換。XYプロットから入力に変換して流し込む |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |
| report | STRING | — |