Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > LoRA Optimizer > LoRA Merge Formula

ComfyUI Node: LoRA Merge Formula

Class Name

LoRAMergeFormula

Category
LoRA Optimizer
Author
ethanfel (Account age: 3360days)
Extension
LoRA Optimizer
Latest Updated
2026-07-19
Github Stars
0.14K

How to Install LoRA Optimizer

Install this extension via the ComfyUI Manager by searching for LoRA Optimizer
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter LoRA Optimizer in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

LoRA Merge Formula Description

LoRAMergeFormula node customizes LoRA model merging with hierarchical order and weighting.

LoRA Merge Formula:

The LoRAMergeFormula node is designed to enhance the flexibility and control over the merging process of LoRA (Low-Rank Adaptation) models by allowing you to define a hierarchical merge order through a customizable formula. This node attaches a merge formula to a stack of LoRA models, enabling you to specify how different LoRA models should be combined. The primary benefit of using this node is its ability to manage complex merging scenarios where the order and weighting of merges can significantly impact the final output. By using a formula, you can dictate the sequence and grouping of merges, allowing for more nuanced and tailored model blending. This is particularly useful in scenarios where different LoRA models contribute differently to the desired outcome, and precise control over their integration is required.

LoRA Merge Formula Input Parameters:

lora_stack

The lora_stack parameter represents the stack of LoRA models to which the merge formula will be applied. This stack is essentially a collection of LoRA models that you wish to merge. Each model in the stack can have different attributes, such as strength, which influence how they contribute to the final merged model. The lora_stack is crucial as it provides the base models that will be combined according to the specified formula. There are no specific minimum or maximum values for this parameter, but it should contain at least one LoRA model to be meaningful.

formula

The formula parameter is a string that defines the hierarchical merge order of the LoRA models in the stack. This formula uses numbers to reference 1-indexed positions of LoRA models in the stack, with + used to combine models and parentheses () to group sub-merges. For example, the formula "(1+2) + 3" indicates that LoRA models at positions 1 and 2 should be merged first, and then the result should be merged with the model at position 3. Optional weights can be specified to adjust the influence of each merge, such as "(1+2):0.6 + 3:0.4". The default value is an empty string, which implies a flat merge without any specific order or weighting.

LoRA Merge Formula Output Parameters:

lora_stack

The output lora_stack is the modified stack of LoRA models with the merge formula attached. This output reflects the hierarchical merge order specified by the formula, allowing for a structured and controlled blending of the models. The presence of the merge formula in the output stack indicates that the models are ready to be processed according to the defined merge strategy, providing a clear path for further model optimization or deployment.

LoRA Merge Formula Usage Tips:

  • Ensure that the formula parameter accurately reflects the desired merge order and includes all necessary LoRA models from the stack. This will help achieve the intended blending effect.
  • Use parentheses in the formula to group merges that should be prioritized or weighted differently, allowing for more complex and effective model combinations.

LoRA Merge Formula Common Errors and Solutions:

"Invalid merge formula: <error_message>"

  • Explanation: This error occurs when the merge formula syntax is incorrect or references out-of-range indices for the LoRA stack.
  • Solution: Double-check the formula for syntax errors, such as missing parentheses or incorrect indices. Ensure that all indices are within the range of the available LoRA models in the stack.

"LoRA index <index> out of range (have <n_loras> LoRAs)"

  • Explanation: This error indicates that the formula references a LoRA model index that does not exist in the stack.
  • Solution: Adjust the formula to ensure all indices are valid and correspond to existing models in the lora_stack.

LoRA Merge Formula Related Nodes

Go back to the extension to check out more related nodes.
LoRA Optimizer
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

LoRA Merge Formula