LoraReduceRank
Shrink a LoRA's rank without retraining it
If you've trained a LoRA at a high rank because you wanted the extra capacity during training, and now you're staring at a file you'd rather not distribute at that size, this is the node for that. LoraReduceRankKJ takes an existing LoRA and shrinks its rank after the fact - no retraining, no dataset needed. It's a straight port of a function out of kohya's sd-scripts (resize_lora.py), the same reference toolkit whose vocabulary - network_dim, network_alpha - basically is the community's shared language for talking about LoRA rank. If you've ever set a rank/alpha pair following a guide, you were speaking Kohya's dialect whether the guide said so or not.
How it actually shrinks a LoRA
A LoRA's weight is a low-rank decomposition, ΔW = A · B, and rank is just how "tall" that decomposition is allowed to be. Reducing rank means running an SVD on each layer's delta and keeping only the top singular values - the directions that account for most of what the LoRA actually changed - and throwing the rest away. It's lossy by construction: you're discarding information, not compressing it losslessly. How much you lose depends on how "spread out" the original LoRA's weight changes were across its rank. A character LoRA trained tight and specific compresses more gracefully than a broad style LoRA that was genuinely using its full rank.
The inputs and outputs that matter
This one's an output node with no output socket - it writes the resized LoRA straight to disk rather than passing anything downstream, the same shape as a Save node.
lora_name- picked from yourlorasfolder (has to already be there for the dropdown to see it).new_rank- the target rank, default 8. This is the whole point of the node; go lower for a smaller file, but expect visible quality loss below whatever rank your LoRA was actually using.dynamic_methodanddynamic_param- an alternative to a flatnew_rank: instead of forcing every layer to the same size, let the algorithm pick each layer's effective rank based on how much of its singular-value energy is worth keeping. Leavedynamic_methodon its default ("disabled") until you've got a feel for what a flat rank does to your specific LoRA.output_dtype- defaults tomatch_original, so unless you have a reason to change precision, leave it.verbose- prints the resize stats to your console; keep it on the first few times so you can see what actually happened.
How to install it
It's part of KJNodes: ComfyUI Manager → search "KJNodes for ComfyUI" → install, or cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, pip install -r ComfyUI-KJNodes/requirements.txt, restart. Nothing extra beyond the pack's own requirements - no separate model download, it just needs your LoRA file already sitting in models/loras.
Common issues & troubleshooting
Setting new_rank above the LoRA's original rank does nothing. SVD truncation only removes information; it can't invent more than was there. If your source LoRA was trained at rank 8 and you ask for rank 32, you'll get a bigger file with the same effective content - not a higher-capacity LoRA.
No output socket means no in-graph confirmation. Because this saves directly to disk, there's nothing to preview inline in the workflow - check your output folder (or the console log, with verbose on) to confirm the run actually did something rather than assuming it worked because the queue finished.
Quality drops off a cliff past a certain point, and it's LoRA-specific. There's no universal "safe" rank to reduce to. Start high, generate a few test images, and step the rank down until you see the difference you're not willing to accept - then back off one step.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| lora_name | COMBO | The name of the LoRA. | |
| new_rank | INT | 81–4096 | The new rank to resize the LoRA. Acts as max rank when using dynamic_method. |
| dynamic_method | COMBO | disabled | Method to use for dynamically determining new alphas and dims. sv_knee finds the elbow point in the singular value curve. |
| dynamic_param | FLOAT | 0.200–2 | Parameter for dynamic methods. For sv_knee: sensitivity (1.0=standard knee, <1.0=more aggressive/lower rank, >1.0=more conservative). |
| output_dtype | COMBO | match_original | Data type to save the LoRA as. |
| verbose | BOOLEAN | true | — |
Outputs (0)
No outputs