Nodes/ComfyUI-RecipeMerge/Triangle LoRA Merge (Anima / SD)
ComfyUI Node

Triangle LoRA Merge (Anima / SD)

Drag a Triangle Instead of Guessing Numbers

By galigali-san·Created 4 months ago·Updated a day ago· 3
Triangle LoRA Merge (Anima / SD)
  • model
  • clip
  • model
  • clip
  • report
◄lora_a▾►
◄lora_b▾►
◄lora_c▾►
◄architecture▾►
◄triangle{"global":[1,0,0],"overrides":{}}►
◄filenametriangle_lora►
◄save_filefalse►

Two LoRAs at once is a slider. Three is where it gets annoying: 0.5/0.3/0.2 is a guess, 0.4/0.4/0.2 is a different guess, and by the time you've found the one you like you can't remember whether the good image was B at 0.3 or C at 0.3. Triangle LoRA Merge makes the ratio a position instead of three numbers you have to keep straight - and then bakes it into a single file you can reuse.

The habit this is answering

Merging tools are a legacy-A1111 reflex for good reason: SuperMerger is one of the few extensions people still name as the thing keeping an old install alive, because ComfyUI's built-in ModelMergeSimple never had that granularity. This pack is an independent reimplementation of the block/elemental-merge idea - the author is explicit that no SuperMerger code is involved and the projects don't share developers.

Note the direction of the numbers: in this pack 1.0 means all of a source. Same as SuperMerger's alpha, opposite of ComfyUI's own merge ratio. Get that backwards once and you'll wonder why your test render looks like the wrong LoRA.

What it does under the hood

You give it three LoRAs and weights that sum to 100%. The node computes ΔW = a·ΔWA + b·ΔWB + c·ΔWC and represents it by concatenating the three scaled delta matrices along the rank dimension. The blend is exact - no SVD, no approximation, no "why does this look softer than the components". The trade is rank: output rank is the sum of the three inputs, so three rank-32 LoRAs produce a rank-96 file. Bigger file, more memory.

Each input's alpha and rank are honoured when scaling, so a rank-8 accent LoRA behaves like an accent next to two rank-64 giants. Keys present in only one or two of the three keep their assigned weight instead of being redistributed to cover the gap - correct math, though it means a key only A has contributes just A's share.

Inputs, outputs, and the triangle

lora_a, lora_b and lora_c are your three files. architecture picks Anima or SD, and it's a real constraint: Anima LoRAs have blocks.0–blocks.27 plus a BASE bucket for llm_adapter and embeddings; SD uses IN/M00/OUT blocks. A preset written for one throws a mismatch error on the other rather than silently doing nothing.

triangle is the JSON the panel edits - you'll leave it alone unless you're hand-authoring a preset:

{
  "global": [0.6, 0.3, 0.1],
  "te": [1, 0, 0],
  "overrides": {"B03": {"attn2": [1, 0, 0]}}
}

Dragging inside the triangle gives you barycentric weights: a vertex is that LoRA at 100%, the centre is roughly a third each. Type numbers into the fields instead and they normalise to 100% on entry. te is the text-encoder blend, separate because the encoder has no block structure to subdivide.

The overrides idea is the genuinely useful part, and it's what separates this from "merge three LoRAs with a ratio". You can pin a different blend for one block, for one element across blocks (attn1, attn2, ff, norm, proj), or for a sub-element like attn2.to_q. Cross-attention is prompt response; the MLP is texture. So "character from A everywhere, but cross-attention entirely from A so B's style doesn't hijack the prompt" is a couple of overrides, not a new workflow.

filename and save_file control the output, model and clip are optional inputs, and the outputs are model, clip and report. With save_file off and a model connected you're previewing - the blend is patched on and nothing touches the disk. With it on, the file is written to models/loras (numbered if the name exists), metadata included so you can rebuild the recipe later.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/galigali-san/ComfyUI-RecipeMerge

Restart, Ctrl+F5, then add Triangle LoRA Merge (Anima / SD) from advanced/model_merging; ComfyUI Manager users can search the pack title "RecipeMerge". No additional dependencies - the project ships with an empty dependency list, and the PyTorch/Node bits are for the author's tests, not the node.

Things that will bite you

The most common one is a wall of nothing: if you connect neither model/clip nor set save_file, the node raises, because previewing and saving are the only two things it does. Pick one.

Then formats. Plain LoRA and compatible LoCon only - LoHa, LoKr, DoRA and tucker-format conv layers are rejected. Shape mismatches are errors too, and that's a feature: blending an SD LoRA into an Anima trio should fail loudly, not produce a subtly broken file. An input sitting at 0% contributes no keys at all, which is the clean way to turn this into a two-LoRA merge.

Two disclaimers, honestly earned. The panel labels are Japanese, so you'll be matching positions to results for the first few minutes. And the bundled purpose presets - paint-transfer, pose, cross-attention - expand to A = keep, B = take in, C = 0, but the author's own docs say the named effects are unverified. Starting curves, not functions. Same caveat on the output: matching architecture and shapes guarantees nothing about the look.

If you publish the merged LoRA, check the parents' licenses - it stops being hypothetical when one of the three traces back to non-commercial weights.

Categoryadvanced/model_merging

Inputs (9)

NameTypeDefaultDescription
lora_aCOMBO0 options:
lora_bCOMBO0 options:
lora_cCOMBO0 options:
architectureCOMBO2 options: Anima, SD
triangleSTRING{"global":[1,0,0],"overrides":{}}—
filenameSTRINGtriangle_lora—
save_fileBOOLEANfalse—
modeloptMODEL—
clipoptCLIP—

Outputs (3)

NameTypeDescription
modelMODEL—
clipCLIP—
reportSTRING—