Filtered Random LoRA Loader (LBW)
Random LoRAs with surgical control over which blocks bite
- model
- clip
- MODEL
- CLIP
- positive_text
- negative_text
- positive
- negative
- preview
This is the advanced member of the RandomLoRALoader family, and the reason it exists is a problem anyone who stacks LoRAs has felt: a style LoRA doesn't just change the style. It can drag composition, structure, and character features along with it, because a normal LoRA patch hits the whole U-Net at once. The LBW variant adds LoRA Block Weight - control over which U-Net blocks the LoRA is allowed to affect - on top of the keyword-filtered random pick.
In practice: an "anime watercolor" style LoRA applied with Style Focused preset touches the OUTPUT blocks only, so you get the brushwork without the composition getting hijacked. A pose LoRA with Structure/Composition Only keeps the layout and leaves the style alone. You can even chain two instances - pose first, then style - and get a result that keeps each effect in its lane. When most of the conversation around LoRAs is "mixing them is unpredictable," this is a genuine attempt at dialing down the chaos. (LBW itself traces back to the sd-webui-lora-block-weight theory; the automatic SD1.5/SDXL detection is this pack's nice touch.)
How it works
Same engine as the other two nodes: one folder, keyword filter, random pick, trigger words pulled from metadata, strengths applied to MODEL/CLIP. The LBW part adds a per-LoRA weight list - a comma-separated string of numbers, one per U-Net block, 20 elements for SDXL (BASE + IN:9 + MID:1 + OUT:9) and 17 for SD1.5. The node detects which architecture each LoRA belongs to by inspecting the keys inside the file, so you don't pick a model type yourself. Mismatched weight counts get auto-fixed: too few pads with 1.0s, too many truncates.
You don't usually type those numbers, though. The weight_mode enum gives you:
- Normal (All 1.0) - plain LoRA application, LBW off. This is your default.
- Style Focused - OUTPUT blocks only. Style without touching structure.
- Character Focused - balanced IN+MID+OUT. Character features stay intact.
- Structure/Composition Only - INPUT+MID only. Layout without the style bleed.
- Balanced / Soft - gentle application, for general-purpose stacking.
- Preset: Random - picks one of the four at random each run.
- Direct Input - your own
lbw_inputweights (SDXL: 20 numbers, SD1.5: 17).
One LBW-specific behavior worth knowing: the positive_text output emits the block weights in <lora:name:model:clip:lbw=1,0,...> syntax, which is what makes it play nicely with Wildcard Encode if you're building a fully dynamic workflow. And since this inherits the filtered node wholesale, keyword_filter, filter_mode, search_in_metadata, and the whole metadata-trigger-word machinery are all here.
The inputs that actually matter
lora_folder_path+keyword_filter- where to look and what counts as a match.weight_mode- the block-weight preset (or Direct Input). The genuinely new dial.lbw_input- only for Direct Input mode.num_loras,model_strength/clip_strength(fixed or"0.6-0.9"ranges),seed- standard, same as the pack's other nodes.
Outputs: MODEL, CLIP, positive/negative CONDITIONING, positive_text/negative_text strings, preview IMAGE. All the usual.
Install
ComfyUI Manager (search "RandomLoRALoader") or:
cd ComfyUI/custom_nodes
git clone https://github.com/shin131002/RandomLoRALoader
Restart ComfyUI. No heavy dependencies beyond ComfyUI's bundled libraries; optional pip install opencv-python only affects video previews. Important caveat from the repo: SD1.5 and SDXL only. LBW targets the SD1.5/SDXL U-Net block structure specifically - no Flux, SD3, or Pony, and the block weights are meaningless on architectures with a different U-Net layout.
Troubleshooting
- No LoRA found - filter too narrow, path wrong, or the tags are in metadata while
search_in_metadatais off. Same checklist as the filtered node. - "Weight count mismatch" warnings - expected when a preset designed for one architecture hits the other. The node auto-adjusts; the warning is informational, not fatal.
- Nothing seems to change - if
weight_modeis a preset where the active blocks are weighted 0 for the effect you wanted, or strengths are 0, the LoRA silently does nothing. "Style Focused" won't give you composition changes, by design. - The trap to avoid: don't reach for LBW on day one. "Normal (All 1.0)" is what 90% of LoRA work wants, and the whole point is not applying it everywhere. Use presets to diagnose which effect a LoRA is actually contributing before you build a three-node chain around it.
- No support promised - small MIT pack, explicit as-is/no-support policy, and this is its newest node (v1.2.0). It's a single readable Python file if you ever need to trace what a preset does.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| clip | CLIP | — | |
| token_normalization | COMBO | none | 4 options: none, mean, length, length+mean |
| weight_interpretation | COMBO | comfy | 5 options: comfy, A1111, compel, comfy++, down_weight |
| additional_prompt_positive | STRING | — | |
| additional_prompt_negative | STRING | — | |
| lora_folder_path | STRING | — | |
| include_subfolders | BOOLEAN | true | — |
| unique_by_filename | BOOLEAN | true | — |
| keyword_filter | STRING | — | |
| filter_mode | COMBO | AND | 2 options: AND, OR |
| search_in_metadata | BOOLEAN | false | — |
| model_strength | STRING | 1.0 | — |
| clip_strength | STRING | 1.0 | — |
| num_loras | INT | 10–20 | — |
| weight_mode | COMBO | Normal (All 1.0) | 7 options: Normal (All 1.0), Style Focused, Character Focused, Structure/Composition Only, Balanced / Soft, Preset: Random, +1 |
| lbw_input | STRING | — | |
| trigger_word_source | COMBO | json_combined | 4 options: json_combined, json_random, json_sample_prompt, metadata |
| seed | INT | 00–18446744073709550000 | — |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |
| CLIP | CLIP | — |
| positive_text | STRING | — |
| negative_text | STRING | — |
| positive | CONDITIONING | — |
| negative | CONDITIONING | — |
| preview | IMAGE | — |