Nodes/LoRA Power-Merger ComfyUI/PM KArcher (Mergekit)
ComfyUI Node

PM KArcher (Mergekit)

The geometrically honest average for N LoRAs

By larsupb·Created 2 years ago·Updated 29 days ago· 75
PM KArcher (Mergekit)
    • MergeMethod
    max_iter10
    tol0.50
    average_weightsfalse

    SLERP handles exactly two models beautifully. What do you do with five? Plain averaging ignores the geometry of weight space - averaging points on a sphere by taking their arithmetic mean drags the result through the inside of the sphere instead of along its surface. The Karcher mean (a.k.a. the Riemannian barycenter) is the mathematically correct "average" for points on a manifold: it's the point that minimizes the sum of squared geodesic distances. This node computes it for your LoRA stack.

    When do you need it? When SLERP won't stretch to N models and NuSLERP's two-model constraint won't do either - you've got three or more LoRAs and you want a central, balanced blend that respects the geometry of the weight space instead of just summing. If your LoRAs are close together in weight space, the difference from linear averaging is small; if they're far apart, the Karcher mean is meaningfully more robust.

    How it works

    It runs an iterative optimization: start somewhere reasonable, then repeatedly project toward the average of the tangent vectors until the updates shrink below a tolerance. Two knobs control that loop.

    The inputs that matter

    • max_iter - maximum iterations (default 10, range 1–100). More iterations = closer convergence at more compute. 10 is the pack's tested default; bump it if the result looks like it hasn't settled.
    • tol - convergence tolerance (default 0.5, range 0–1). Lower = tighter convergence, more iterations. The tooltip notes the original mergekit default was 1e-5; the pack's default of 0.5 is a pragmatic "good enough in 10 iterations" setting.

    Output is a MergeMethod config for PM LoRA Merger. It takes 2+ LoRAs, no base model needed - it's a pure geometric average, not a task-vector method.

    Installing

    Ships in the LoRA Power-Merger pack. ComfyUI Manager (search "LoRA Power-Merger") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/larsupb/LoRA-Merger-ComfyUI
    cd LoRA-Merger-ComfyUI
    pip install -r requirements.txt
    

    Restart ComfyUI. Dependencies: PyTorch, lxml, mergekit - this one genuinely runs mergekit's karcher implementation.

    Common issues

    The subtle one is tolerances. With tol at 0.5 and max_iter at 10, you get a fast approximate mean - fine for most blending. If your merged LoRA looks like a slightly-off average (a common tell: things are a touch weaker or muddier than the inputs), tighten tol and raise max_iter and let it converge. It's an iterative algorithm on every layer, so don't expect it to be the fastest method in the pack - that's normal. And as always in this pack, get ranks reconciled through PM LoRA Stack Decompose (rSVD) before merging.

    CategoryLoRA PowerMerge/Spherical Interpolation Methods

    Inputs (3)

    NameTypeDefaultDescription
    max_iterINT101–100Maximum iterations for the KArcher mean algorithm. Default 10
    tolFLOAT0.500–1Convergence tolerance for the KArcher mean algorithm. Default 1e-5
    average_weightsBOOLEANfalseOFF: additive SUM, so per-LoRA strengths act as gains and stacked LoRAs keep full magnitude (matches ComfyUI's native LoRA stacking and the other merge nodes, the default). ON: normalized weighted AVERAGE, so strengths act as ratios and the result is a blend/interpolation (weaker magnitude). Note: strengths control MAGNITUDE only, not the interpolation position.

    Outputs (1)

    NameTypeDescription
    MergeMethodMergeMethod