Add Difference
The merge formula most CivitAI checkpoints are made of
- a (delta|param|weight)
- b (delta)
- alpha (1.0)
- recipe
If you've ever wondered how people end up with checkpoints that look like "base model + one LoRA, but better," this is the node behind it. Add Difference is the formula that takes a model and adds a change to it: A + alpha * (B - C). In words: start from A, figure out what B does differently relative to C, and apply that difference to A at strength alpha. When C is the base both A and B were fine-tuned from, this is how you transplant a fine-tune onto a different base - the maneuver half of CivitAI's checkpoint catalog is built on.
How it works
Inside the comfy-mecha pack, this node builds a MECHA_RECIPE (a lazy merge graph) that computes a + alpha * b, where b is expected to be a delta - a model minus its base. The graph runs key-by-key when you execute it through a Mecha Merger, so unlike old-school merges you never hold two full SDXL checkpoints in memory. The node even wraps the result back into weight space automatically, which is the part beginners trip over in raw merge tools: forgetting to add the base back after subtracting it. Here it's enforced.
The two inputs that matter:
a (delta|param|weight)- the starting point. Usually your base model (fromModel Mecha Recipe), in weight space.b (delta)- the change you're adding. A delta like a LoRA loaded withLora Mecha Recipe, or the output of aSubtractbetween two checkpoints. Note it must be a delta, which is exactly the kind of input validation that stops you from adding two full weights together.alpha- strength, default 1.0 (full application). Like all params in this pack it's aMECHA_RECIPE, so you can feed itBlocks Mecha Hyperfor per-block weighting or aFloatrecipe for a plain value. Dials like 0.5–0.8 are common when transplanting a LoRA so you don't overshoot.
Output is one recipe (MECHA_RECIPE) that goes into Mecha Merger → MODEL/CLIP/VAE → save.
The workflow that makes it click
Model Mecha Recipe (base C) ──▶ Subtract Mecha Recipe ──▶ Add Difference ──▶ Mecha Merger
Model Mecha Recipe (fine-tune B) ──▶ ▲
Model Mecha Recipe (your base A) ──────────────────────────┘
Subtract the base from the fine-tune to get a delta, add that delta to your base, merge, save. Swap the "Subtract" branch for a Lora Mecha Recipe and the same wiring becomes "bake this LoRA into my checkpoint," which is honestly the more common use.
The merge_checkpointing toggle on this node caches the output branch on CPU in fp16 so re-runs skip re-merging - useful when the upstream recipe is huge and you're only tweaking downstream params.
Install & gotchas
ComfyUI Manager → search mecha → "Mecha Merge Node Pack", or:
cd ComfyUI/custom_nodes
git clone https://github.com/ljleb/comfy-mecha.git
pip install -r comfy-mecha/requirements.txt
Restart after; only dependency is sd-mecha==1.1.7.
Where people burn themselves: feeding a full weight into the b (delta) slot (alpha then roughly doubles your model instead of applying a small change), and forgetting that alpha above 1.0 is legal but lands you outside the space either parent model occupied - sometimes that's the point, usually it's noise. And if you're adding a LoRA-style delta onto a base that isn't the LoRA's intended architecture, the mismatch is on you, not the node: architecture lock-in survives merging.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| a (delta|param|weight) | MECHA_RECIPE | — | |
| b (delta) | MECHA_RECIPE | — | |
| alpha (1.0)opt | MECHA_RECIPE | 1 | — |
| merge_checkpointingopt | BOOLEAN | false | Speeds up an entire branch of a merge graph that does not change often in exchange of memory. - true: store the first output of this recipe node on cpu memory in fp16. On subsequent workflow executions, as long as the inputs do not change, the cached keys are returned after being cast to the original device and dtype. - false: do not store the output. The recipe and its inputs will re-execute on subsequent workflow executions. Note that the memory used to checkpoint the output is distinct from the cache feature. In general, you probably want to either use this *or* a cache unit, but not both at the same time because the memory adds up. The difference between merge checkpointing and cache is that merge checkpointing completely re-merges from scratch if any input changes. Merge checkpointing is also generally much faster than cache in the fast path. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| recipe | MECHA_RECIPE | — |