Nodes/ComfyUI-B-LoRA/Load B-LoRA
ComfyUI Node Runs on cloud

Load B-LoRA

One ~100MB file that separates style from content

By liusida·Created 2 years ago·Updated 2 years ago· 77
Load B-LoRA
  • model
  • MODEL
lora_name
load_styletrue
load_contentfalse
strength1.00

A normal style LoRA and a normal content LoRA are two different files. A B-LoRA is one file that holds both - the "style" of a single training image and the "content" (the actual subject) - and this node decides which half you get at load time. It's the research trick from "Implicit Style-Content Separation using B-LoRA" (Frenkel, Vinker, Shamir, Cohen-Or, March 2024), wrapped up as a drop-in loader.

What makes it interesting isn't the image quality ceiling - it's that a single trained model becomes a mix-and-match style/content kit. Want the content of your "colorful-squirrel" B-LoRA inside the style of "pencil-boy"? Load two of these nodes, check the right boxes, done. That's the whole pitch: style and content are separated by default, so you can swap them like interchangeable parts instead of fighting LoRA bleed.

Caveat that matters before you get excited: B-LoRA only works on SDXL. The node hard-refuses anything else with an exception. Fine-tunes of SDXL are "compatible but not guaranteed," per the author - start on plain sdxl_base_1.0 if something looks off.

How it actually works

The paper's trick is that style and content land in different places in the UNet, and the loader exploits that. In the source, the node defines two block families - unet.up_blocks.0.attentions.0 (content) and unet.up_blocks.0.attentions.1 (style) - the first two attention blocks in the topmost up-block of the SDXL UNet. When you load a B-LoRA, it strips the state dict down to only the blocks you asked for, then hands the filtered weights to ComfyUI's normal LoRA machinery (comfy.sd.load_lora_for_models). So the "separation" is literal: apply one attention block, or the other, or both at different strengths.

It also handles format glue for you. B-LoRAs from the author's HuggingFace pages ship with a duplicated unet.unet. prefix in some keys - the node dedupes those. And if the file isn't in the kohya format ComfyUI expects, it converts from diffusers format, preferring diffusers' converter when installed and falling back to a small built-in converter otherwise.

The inputs that matter

There are only five, and four of them are the whole game:

  • model - your SDXL model in.
  • lora_name - pick the B-LoRA; it lists models/loras/ just like the normal LoRA loader.
  • load_style (default on) - apply the style half.
  • load_content (default off) - apply the content half.
  • strength (default 1.0, range −100 to 100) - how hard the selected half pushes on the model.

The one real trap is the defaults. Style is on, content is off. If you want content only, you must manually turn load_style off - plenty of people loaded a B-LoRA expecting the subject and got the vibe instead. Output is a single MODEL you wire straight into the sampler. You'll also want to put the training token (<s> in the author's examples) in your prompt - the concept isn't free-floating, it's keyed to that token.

Installing it

ComfyUI Manager is the easy path: search "B-LoRA" and install. Manual, it's the standard dance:

cd ComfyUI/custom_nodes
git clone https://github.com/liusida/ComfyUI-B-LoRA

Restart ComfyUI. There's no requirements.txt and no heavy dependency - this is a single-file node built on ComfyUI core (the only optional extra is a recent diffusers for cleaner conversion, and it works without it). The actual work is the model files, which go in models/loras/. Grab the example B-LoRAs from sida/B-LoRA-examples or the lora-library org.

Common issues

  • "Currently, B-LoRA only supports Stable Diffusion XL" - you're not on SDXL. That's the whole story.
  • "The LoRA model you choose is not a B-Lora model." - you picked a regular LoRA; its keys don't match the style/content blocks, so the filter comes back empty.
  • Content not showing up - see the defaults trap above.
  • Finding models is the real bottleneck. This is a niche research idea with thin ecosystem support: roughly 30 substantive Reddit mentions since launch, and the common complaint is that working B-LoRA files are hard to find and easy to use wrong. Training tooling exists now - a diffusers advanced-training example, or the community blora_for_kohya fork for kohya-ss - but the pack's own docker training image is still marked WIP.

If you're set up for SDXL and you like the idea of one model file doing both style and subject with a switch, this is the only loader that does it. Just respect the "style on by default" gotcha.

Categoryloaders

Inputs (5)

NameTypeDefaultDescription
modelMODEL
lora_nameCOMBO0 options:
load_styleBOOLEANtrue
load_contentBOOLEANfalse
strengthFLOAT1.00-100–100

Outputs (1)

NameTypeDescription
MODELMODEL