Nodes/Model Utility Toolkit/LoRA Resize (SV Ratio)
ComfyUI Node

LoRA Resize (SV Ratio)

LoRA Resize (SV Ratio) — resize a LoRA by singular-value threshold

By silveroxides·Created about a year ago·Updated 4 days ago· 14
LoRA Resize (SV Ratio)
    • output_path
    lora_name
    max_rank128
    ratio2.0
    output_filenameresized_lora_ratio
    save_dtypefp16
    devicecuda
    lazy_loadtrue
    force_clear_cachefalse

    The simplest-to-reason-about of the three LoRA resize nodes in silveroxides' ComfyUI-ModelUtils. LoRA Resize (SV Ratio) reconstructs an existing LoRA's weight delta, decomposes it with SVD, and keeps every singular value above a threshold set relative to the largest one - same ratio idea as this pack's LoRA Extract (Ratio) node, just applied to an already-compressed LoRA instead of a raw model diff.

    The mechanism. The node's own description: "Dynamically resize LoRA, keeping singular values where S[i] > S[0]/ratio." It multiplies the LoRA's low-rank matrices back into a full-size delta, runs SVD, sorts the singular values, and keeps everything larger than the biggest value divided by ratio. A ratio of 2 (the default) keeps values at least half the size of the top one; raise the ratio and you keep more, smaller values along with it - per the same tooltip logic used across this pack's ratio-based extraction node, higher ratio means more singular values survive. It's a threshold against the top value, not a percentage-of-total target, which makes it the most direct of the three resize methods to reason about: "how far down from the strongest direction am I willing to keep going."

    Inputs that matter. ratio (default 2, range 1-100) is the control that actually shapes the output size - low ratio prunes hard, keeping only the dominant directions; high ratio keeps nearly the full spectrum. max_rank (default 128, range 1-3072) still caps the result, since a high ratio against a layer with a long tail of similarly-sized singular values could otherwise produce a rank that defeats the point of resizing at all. output_filename defaults to resized_lora_ratio. save_dtype (fp16), device (cuda), lazy_load (on by default), and force_clear_cache (off by default) handle the rest. Output is output_path.

    Installing it. Search "Model Utility Toolkit" in ComfyUI Manager, or cd ComfyUI/custom_nodes && git clone https://github.com/silveroxides/ComfyUI-ModelUtils and restart. No extra dependencies flagged in the README.

    Why this one over Fixed Rank or Frobenius. If you've used this pack's LoRA Extract (Ratio) node before and liked how it thinks - a simple aggressiveness dial rather than a target rank or a target percentage - this is the same logic applied after the fact to a LoRA you already have, rather than at extraction time from two checkpoints. It's a reasonable default when you want "meaningfully smaller" without committing to an exact rank number (Fixed) or a specific fidelity percentage (Frobenius).

    The honest limit, same as every resize node here. SVD works with what's already in the file - it can shrink a LoRA by discarding the least-significant singular values, but it can't manufacture detail that was never captured in the original extraction or training run. Pushing ratio high in an attempt to "improve" a LoRA just keeps more of the low-energy directions that were already there; it doesn't add new capacity.

    Cost and what to check if something looks off. A LoRA is 10-200MB, a fraction of the multi-gigabyte checkpoints the extraction nodes handle, so this is a light operation by comparison - hence force_clear_cache defaulting off here rather than on. If a resized LoRA feels noticeably weaker than the source, raise ratio before assuming the node is at fault; if the result seems capped despite a high ratio, check that max_rank isn't the thing actually limiting the output.

    CategoryModelUtils/LoRA/Resize

    Inputs (8)

    NameTypeDefaultDescription
    lora_nameCOMBOLoRA to resize
    max_rankINT1281–3072Maximum allowed rank
    ratioFLOAT2.01–100Keep SVs where S[i] > S[0]/ratio
    output_filenameSTRINGresized_lora_ratio
    save_dtypeCOMBOfp163 options: fp16, bf16, fp32
    deviceCOMBOcuda2 options: cuda, cpu
    lazy_loadBOOLEANtrueLow memory mode: load tensors from disk on demand
    force_clear_cacheBOOLEANfalseClear CUDA cache after each layer (slower but saves VRAM)

    Outputs (1)

    NameTypeDescription
    output_pathSTRING