Nodes/LoRA Optimizer/LoRA AutoTuner Settings
ComfyUI Node

LoRA AutoTuner Settings

Give the plain Optimizer node AutoTuner's sweep

By ethanfel·Created 5 months ago·Updated 23 days ago· 135
LoRA AutoTuner Settings
  • merge_settings
  • evaluator
  • settings
top_n3
scoring_svddisabled
scoring_devicegpu
scoring_speedturbo
scoring_formulav2
diff_cache_modeauto
diff_cache_ram_pct0.50
community_cachedisabled
memory_modeauto
selection1
record_datasetdisabled

There are two ways to get AutoTuner's parameter-sweep behavior into your workflow: the standalone LoRA AutoTuner node, which takes its own model/lora_stack inputs and runs independently, or this node, which packages the same sweep logic as an OPTIMIZER_SETTINGS object you plug into the plain LoRA Optimizer's settings input. If you've already got LoRA Optimizer wired into a graph and just want it to sweep instead of using fixed settings, this is less rewiring than swapping in the standalone AutoTuner node.

How it works

Same underlying sweep as LoRA AutoTuner - Pass 1 analysis once, heuristic scoring across candidate configs, real merge-and-measure on the top top_n. The difference is purely architectural: this node doesn't own the merge, it hands its settings to whatever node's settings input it's connected to, and that node runs the actual merge.

The inputs that matter

  • top_n (default 3) - how many top-scoring configs get a real merge-and-measure pass. This is the main dial for the speed/thoroughness tradeoff.
  • scoring_speed (default turbo) - full scores every weight prefix per candidate (most accurate, slowest - worth it for stacks combining very different LoRAs, like style + character in one stack). fast/turbo/turbo+ sample progressively fewer prefixes; turbo+ is the one to reach for on large models like Flux or WAN, or when you're iterating quickly and can tolerate missing subtle block-level differences.
  • scoring_svd (default disabled) - the default fast norm-only scoring is usually enough. merge_quality and lora_rank add SVD-based analysis for more thorough (and slower) scoring; both are hardware-accelerated if Triton is installed.
  • diff_cache_mode (default auto) - caches raw LoRA diffs across candidates instead of recomputing them each time, since diffs depend only on the LoRA content, not the merge config. auto uses RAM up to diff_cache_ram_pct and recomputes anything past that budget rather than spilling to disk.
  • community_cache (default disabled) - download precomputed results for LoRAs matching your exact file content from a shared Hugging Face dataset, and optionally contribute your own back with upload_and_download (requires an HF_TOKEN environment variable for uploads; downloads need nothing).
  • memory_mode (default auto) - persists a tuned result across ComfyUI sessions keyed by LoRA names, strengths, and settings, so re-running the same stack replays the winning config instantly instead of re-sweeping. auto_ignore_strength is worth knowing about specifically if you're sweeping strength values on orthogonal LoRAs, where the ranking usually doesn't change with strength anyway.
  • selection (default 1) - which ranked config to actually apply, without re-running the sweep to try alternatives.

Optional connections: merge_settings to inherit shared settings from a Merge Settings node, and evaluator to blend in a custom Python scoring function via Build AutoTuner Python Evaluator.

Output: settings (OPTIMIZER_SETTINGS) - connect to the settings input on LoRA Optimizer.

How to install it

ComfyUI Manager: search "LoRA Optimizer", install, restart. Manually:

cd ComfyUI/custom_nodes/
git clone https://github.com/ethanfel/ComfyUI-LoRA-Optimizer.git

Restart - nodes appear under loaders. No downloads unless you turn on community_cache, which talks to Hugging Face.

Common issues & troubleshooting

Heavy RAM usage on large stacks or video models. This node runs the same sweep machinery as the standalone AutoTuner, and it carries the same real-world cost - a reported case running 3 LoRAs on Wan 2.2 through the AutoTuner sweep nearly filled 96GB of RAM before crashing. Set diff_cache_mode to disk instead of the default auto, and reconsider whether a full sweep is worth it on every iteration for video-model stacks specifically.

Connected this node but the Optimizer still looks like it's using fixed settings. Confirm the settings output is actually wired into LoRA Optimizer's settings input, not left dangling - a settings connection silently overrides tuner_data and defaults, so if it's not connected, nothing about this node's configuration takes effect.

Sweep runs every single execution, even when nothing changed. That's what memory_mode=auto is for - it should replay a cached result rather than re-sweeping once a stack's LoRAs and settings match a previous run. If it's re-sweeping anyway, double check nothing about the stack (even a strength value, unless you're using auto_ignore_strength) actually changed between runs.

CategoryLoRA Optimizer

Inputs (13)

NameTypeDefaultDescription
top_nINT31–10How many of the best configurations to try with a real merge. Higher = explores more options but takes longer.
scoring_svdCOMBOdisabledSVD-based scoring for ranking configurations. disabled: fast norm-only scoring (usually sufficient). merge_quality: SVD on merged diff tensors — more thorough quality measurement. lora_rank: effective rank of LoRA factors — experimental, changes ranking. full: both merge_quality + lora_rank. With Triton installed, SVD modes are hardware-accelerated and add minimal overhead.
scoring_deviceCOMBOgpuWhere to run scoring math. GPU is much faster, especially with SVD scoring modes.
scoring_speedCOMBOturboHow thoroughly to score each configuration. 'full': most accurate, slowest. 'turbo' (recommended): good balance of speed and accuracy. 'turbo+': fastest, may miss subtle differences.
scoring_formulaCOMBOv2Which scoring formula to use. v2 (recommended): smarter scoring that adapts to your model type. v1: older formula, kept for comparison.
diff_cache_modeCOMBOautoCaches intermediate data to speed up the sweep. 'auto' (recommended): uses RAM up to diff_cache_ram_pct, then recomputes the rest (no disk). 'disabled': slower but uses no extra memory.
diff_cache_ram_pctFLOAT0.500.1–0.9How much of your free RAM the diff cache can use (in 'auto' mode). 0.5 = up to half your available RAM.
community_cacheCOMBOdisabledCommunity cache: share and reuse LoRA analysis results via Hugging Face. upload_only: run locally and upload results; do NOT replay HF cache hits. Useful for backfilling enriched configs. upload_and_download: download cached results before analysis and upload new ones after. Requires HF_TOKEN environment variable.
memory_modeCOMBOautoPersistent memory for tuning results across sessions. auto: Load cached results if available, save after tuning. auto_ignore_strength: Same as auto but the cache key ignores LoRA strengths — useful when sweeping strengths on orthogonal LoRAs where rankings don't change. read_only: Use cached results but don't save new ones. clear_and_run: Delete cached entry and re-tune from scratch.
selectionINT11–10Which ranked configuration to apply (1 = top-ranked). Change this to try a different config without re-running the full sweep.
record_datasetCOMBOdisabledAppend analysis metrics and all scored configs to user/lora_optimizer_reports/autotuner_dataset.jsonl for threshold-tuning research. Entries are recorded only when a full sweep runs (cache/memory replays don't add entries).
merge_settingsoptMERGE_SETTINGSConnect a LoRA Merge Settings node here to share common settings. Uses good defaults if not connected.
evaluatoroptAUTOTUNER_EVALUATORConnect an external evaluator to influence how configurations are ranked. Optional — the built-in scoring works well on its own.

Outputs (1)

NameTypeDescription
settingsOPTIMIZER_SETTINGS