Polygon LoRA Merge (Dynamic / Anima / SD)
Blending a Whole Stack Into a Single File
- model
- clip
- model
- clip
- report
Past about three LoRAs, stacking stops being a workflow and starts being a search problem. You've got a character, a style, a lighting LoRA and two "just a little bit" nudges, and the only tool you have is one number per file. Polygon LoRA Merge replaces the numbers with a shape: one vertex per LoRA, drag the point, and the position becomes the blend.
It's the arbitrary-input version of the pack's Triangle node. Three LoRAs give you a triangle, four a square, five a pentagon, and the author didn't hard-code a ceiling - the CPU tests go up to 32 inputs, though you will not enjoy 32 inputs.
What this is actually for
Merging LoRAs is old hat in A1111 land - SuperMerger is one of the recurring reasons people keep a legacy install around. In ComfyUI the usual answer has been "stack them and tweak the strengths", which works right up until you find a combination you like and have to reproduce those five numbers in every workflow, forever.
Baking the blend into one LoRA fixes that. The proportions are in the file, so there's no five-loader chain and no forgetting which one was at 0.35.
How the geometry and the math fit together
The polygon panel writes a JSON blob into the polygon field that looks like this:
{
"loras": ["a.safetensors", "b.safetensors", "c.safetensors"],
"global": [0.5, 0.3, 0.2],
"te": [1, 0, 0],
"overrides": {"B03": {"ff": [0.1, 0.6, 0.3]}}
}
Weights are normalised so they sum to 100%, and every weight has to be zero or positive - no negative weights here, unlike the pack's per-key apply nodes. global is the overall blend; te is the text-encoder blend, separate because encoders can't be split into blocks; overrides pins a different blend for one block or one element inside a block.
The merge is concatenation: ΔW = Σ wi·ΔWi, built by scaling each input's down/up matrices and stacking them along rank. Each input's own alpha and rank are respected, so a rank-8 LoRA doesn't get silently promoted to the loudness of a rank-64 one. Nothing is approximated, but the output rank is the sum of every input's rank - five rank-32 LoRAs make a rank-160 file that's five times the size and slower to load. That's the real price of this node, and nobody warns you about it.
The inputs and outputs
From the node definition: lora_catalog is the file picker the panel uses, architecture is Anima or SD, polygon is the JSON above (multiline text), filename defaults to polygon_lora, and save_file is a boolean. Optional model and clip in; model, clip and report out.
architecture matters more than it looks: it decides which block naming is legal - B00–B27 plus BASE for Anima's 28-block DiT, IN00–IN11/M00/OUT00–OUT11/BASE for SD1.5 and SDXL. Feed it an SD-style override while set to Anima and the node raises a mismatch instead of guessing.
The workflow is: add rows, pick LoRAs, drag the point or type the numbers, connect model and optionally clip, generate. save_file off means preview - the blend is patched onto the connected model and nothing is written. Flip it on for one run and the file lands in models/loras with the recipe embedded in its metadata, numbered if the name's taken. Keep an eye on report: per-input key counts, max rank, and which of your overrides matched zero keys.
The four-input trap
This is the part worth reading twice. With three inputs, a point inside a triangle maps cleanly onto a blend. With four or more, the point alone cannot represent every possible combination - some blends collapse onto the same spot. The panel uses mean-value coordinates for dragging, so it's smooth and sane, but if you type exact numbers (0.4/0.3/0.2/0.1) and then drag the point, your typed proportions will shift. Type, don't drag, when precision matters.
Adding a LoRA adds it at 0% and leaves your existing blend alone; removing one takes that column out of every setting and renormalises. One input is a dot and two is a line segment, which is a slightly funny way to do a plain weighted merge.
Install and gotchas
cd ComfyUI/custom_nodes
git clone https://github.com/galigali-san/ComfyUI-RecipeMerge
Restart, refresh with Ctrl+F5, search Polygon on the canvas. There are no extra dependencies - the project declares none, and the linkedom/Playwright stuff in the repo is dev test tooling only. UI labels are Japanese.
Formats: kohya-keyed plain LoRA and compatible LoCon. diffusers-style keys get normalised on load, both .lora_down/up and .lora_A/B work, and LoHa, LoKr, DoRA and tucker-format conv hard-fail rather than saving a broken file. Shape mismatches between inputs error too - which is what you get when you try to blend an SD LoRA with an Anima LoRA.
One last thing: it also reads Triangle preset JSON, using your current first three inputs as A/B/C and dropping the rest, because the Triangle format doesn't store filenames. Line up A, B and C before you import one.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| lora_catalog | COMBO | 0 options: | |
| architecture | COMBO | 2 options: Anima, SD | |
| polygon | STRING | {"loras":[],"global":[],"overrides":{}} | — |
| filename | STRING | polygon_lora | — |
| save_file | BOOLEAN | false | — |
| modelopt | MODEL | — | |
| clipopt | CLIP | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |
| clip | CLIP | — |
| report | STRING | — |