DoRA Extract (Frobenius)
Adaptive-rank extraction that targets quality, not a fixed size
- output_path
DoRAExtractFixed's sibling, and the more interesting of the two if you're not sure what rank you actually need. Both nodes do the same fundamental thing - take a base checkpoint and a fine-tune of it, compute the difference, and compress that difference into a low-rank DoRA adapter - but where DoRAExtractFixed makes you pick the rank up front, this one flips the question around: you tell it how much of the original difference's strength you want preserved, and it figures out the rank needed to get there, per layer, up to a ceiling you set. The node's own description names the target directly: "Preserve target fraction of Frobenius norm." The Frobenius norm is a standard way to measure a matrix's overall magnitude, so "preserve 0.9 of it" means "keep the compressed version at roughly 90% of the original difference's strength," however many singular values that takes.
How it works
model_a and model_b set the direction, same as the fixed-rank version - model_a is the finetuned model, model_b is the base ("A - B = LoRA," per the tooltip). Get this backwards and the math runs fine but produces the inverse of the adapter you meant.
linear_target and conv_target (both default 0.9) are the actual targets - the fraction of Frobenius norm to preserve for linear/attention layers and convolutional layers respectively, set separately because the two layer types compress differently. linear_max_rank and conv_max_rank (both default 128) are the ceiling: even if hitting your target fraction would need a higher rank than that, the extraction won't exceed it, trading a bit of fidelity for a size cap you control. That's the practical read on this node versus the fixed-rank one - instead of guessing a single rank for the whole model and hoping it's enough everywhere, you set a quality floor and a size ceiling, and the extraction spends more rank on layers that actually changed a lot and less on ones that barely moved.
The rest of the field set matches DoRAExtractFixed closely: lazy_load/force_clear_cache (both default on) for memory management, chunk_large_layers (off by default) for splitting fused QKV/MLP blocks on tight VRAM, clamp_quantile (default 0.99) to clip outlier singular values, min_diff (default 0) to skip layers that barely changed, mismatch_mode (default skip) for tensors present in only one model, skip_patterns (regex, or glob with glob_skip_patterns) to exclude layers outright, save_dtype (default fp16) and device (default cuda). Output is output_path, with output_filename defaulting to extracted_lora.
Installing it
ComfyUI Manager: search Model Utility Toolkit, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-ModelUtils
Restart ComfyUI. No downloads needed beyond the two source models.
Where people get burned
Same directional trap as the fixed-rank version: swap model_a and model_b and the extraction runs cleanly but produces the inverse adapter, which reads as "this DoRA does nothing" or "this DoRA does the opposite of what I trained" rather than an obvious error.
The setting most likely to surprise you is linear_max_rank/conv_max_rank capping the output below your target fraction on a layer that changed a lot - if a particular layer needed rank 200 to hit 0.9 Frobenius preservation and your ceiling is 128, you get 128 and a smaller fraction preserved on that layer specifically, silently. If the extracted adapter feels weaker than expected on a specific effect, that's worth checking before assuming the extraction failed outright.
And the same honest caveat about DoRA as a format applies here regardless of which rank-selection method produced it: the community's real-world verdict, after a genuine wave of "DoRA beats LoRA in every way" enthusiasm, settled on DoRA adapters not stacking well together and likeness results being dataset-dependent rather than a reliable upgrade. Extract it, use it on its own, and don't assume it'll combine cleanly with other adapters the way plain LoRAs usually do.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| model_a | COMBO | Finetuned model (A - B = LoRA) | |
| model_b | COMBO | Base model (A - B = LoRA) | |
| linear_target | FLOAT | 0.900–1 | Target Frobenius norm fraction for linear |
| conv_target | FLOAT | 0.900–1 | Target Frobenius norm fraction for conv |
| linear_max_rank | INT | 1281–16384 | Maximum rank for linear layers |
| conv_max_rank | INT | 1281–16384 | Maximum rank for conv layers |
| lazy_load | BOOLEAN | true | Low memory mode: load tensors from disk on demand |
| force_clear_cache | BOOLEAN | true | Clear CUDA cache after each layer |
| chunk_large_layers | BOOLEAN | false | Split large fused layers (QKV, MLP) into chunks |
| clamp_quantile | FLOAT | 0.990.5–1 | Clamp outlier singular values |
| min_diff | FLOAT | 0.0000–1 | Skip layers with max difference below this |
| mismatch_mode | COMBO | skip | 3 options: skip, zeros, error |
| output_filename | STRING | extracted_lora | — |
| save_dtype | COMBO | fp16 | 3 options: fp16, bf16, fp32 |
| device | COMBO | cuda | 2 options: cuda, cpu |
| skip_patterns | STRING | Patterns for layers to skip (regex or glob depending on glob_skip_patterns) | |
| glob_skip_patterns | BOOLEAN | false | When True, skip_patterns use glob syntax (* = any sequence, ? = any char, dots are literal). When False (default), patterns are Python regex matched as substrings. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output_path | STRING | — |