Add Opposite
Add a delta only where the parents actually disagree
- a (delta|param|weight)
- b (delta|param|weight)
- c (delta|param|weight)
- alpha (1.0)
- recipe
Add Opposite is the "mask first, then add" move from the Train Difference Mask family, applied to the case where two models went in opposite directions. It computes a + (b − c) * mask, where the mask is high exactly where a and b diverge from each other - and near zero where c already spans the difference. The whole point: only add the change where it's doing something new, instead of smearing it across every weight.
How the mask works
Give it three recipes: a, b, and c. The mask is 2 * |a − b| / (|a − b| + |a + b − 2c|). Read the denominator: a + b − 2c is how much a and b together diverge from twice the anchor c. So the mask is large when the disagreement between a and b isn't explained by c - meaning this is genuinely new ground - and small when c already accounts for it. Scaled by alpha (default 1.0) and the pack's constants, then applied as a + (b − c) * mask.
Inputs:
a,b,c- three recipe inputs, each acceptingdelta|param|weight. The roles matter:cis the anchor/reference the other two are compared against.alpha- global strength on the masked addition.
Output: one recipe (MECHA_RECIPE) in weight space, ready for Mecha Merger or further merge nodes.
Why this over plain Add Difference?
Plain Add Difference adds the delta everywhere, which is fine for "apply this fine-tune" but wasteful when the change you're adding only actually moved some weights. The masked version concentrates the add on the parts of the network where the models genuinely took opposite stances, leaving the shared middle untouched. For merges that keep cross-contaminating regions you wanted stable, this is the surgical upgrade. It's also the more computationally honest option: the mask is one pass, cheap, and lazy-streamed like everything in this pack - the merge_checkpointing toggle caches the branch on CPU in fp16 once the recipe is stable.
There's a closely related pair in the same pack: Add Opposite Mask outputs the raw mask as a param recipe (so you can inspect or reuse it), while this node bakes the mask into the add directly. And Add Strict Opposite Mask uses a stricter variant that clamps harder to "truly opposite." If you want to see what the mask looks like before committing, wire the Mask version into a param slot and inspect it first.
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. Dependency is sd-mecha==1.1.7.
The thing people get wrong: c isn't optional flavor - it's the reference that defines what "opposite" means, so feeding it a random third model turns the whole mask into noise. Use your actual base model there. And like all the mask-family nodes, this tunes placement, not quality: if the underlying deltas are bad, a smarter mask just places the badness more precisely.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| a (delta|param|weight) | MECHA_RECIPE | — | |
| b (delta|param|weight) | MECHA_RECIPE | — | |
| c (delta|param|weight) | 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 | — |