Nodes/ComfyUI-BiRefNet-Super/🔥BiRefNet_Lite
ComfyUI Node

🔥BiRefNet_Lite

It's called Lite, but it'll happily load the full-size BiRefNet

By rubi-du·Created 2 years ago·Updated about a year ago· 14
🔥BiRefNet_Lite
  • image
  • image
  • mask
â—„load_local_modeltrueâ–º
â—„deviceautoâ–º
â—„cutout_funcputalphaâ–º
â—„mask_precision_threshold0.10â–º
â—„cachedtrueâ–º
â—„cpu_size0.00â–º
â—„alpha_matting_foreground_threshold240â–º
â—„alpha_matting_background_threshold10â–º
â—„alpha_matting_erode_size10â–º
â—„local_model_pathBiRefNetâ–º

🔥BiRefNet_Lite is the workhorse node of the rubi-du/ComfyUI-BiRefNet-Super pack, and the name is a leftover. It doesn't force the lightweight BiRefNet weights on you - it will happily load the full-size general model, the portrait model, or the high-res HR weights. It also doesn't call any API and needs no key. The "Lite" dates back to the pack's original name, ComfyUI-BiRefNet-lite, before it was renamed "Super" in December 2024. All of it runs on your machine.

You reach for it for the thing BiRefNet got adopted for: cutting out subjects with genuinely hard edges - flyaway hair, fur, fabric mesh. rembg's u2net is fast and tiny and visibly wrong on exactly those cases. BiRefNet is MIT-licensed, runs in under a second at typical resolutions, and the quality difference shows in a side-by-side rather than in a spec sheet. ComfyUI added native BiRefNet support in May 2026, so you can skip this pack entirely if you're on a recent build. What this node adds is knobs: chunked loading for small VRAM, model caching, and three cutout methods.

How it works

Under the hood it loads the model through transformers (AutoModelForImageSegmentation with trust_remote_code) from a local folder under models/birefnet - the default local_model_path is BiRefNet. The image is resized to 1024×1024 internally, the mask is computed, and then interpolated back to your original dimensions.

That last part is the gotcha that burns people: the internal resolution is hardcoded at 1024. Feed it a 4K image and it downscales before inference, so the fine edge detail you wanted is gone regardless of how good your weights are. It's the single most common self-inflicted quality loss with BiRefNet, and it lives in the code.

The inputs that matter

The full list is long, but a beginner only touches a few:

  • image - the IMAGE tensor from your Load Image.
  • load_local_model (default true) - loads from a folder under models/birefnet that you point local_model_path at. Flip it off and the node auto-downloads ZhengPeng7/BiRefNet from HuggingFace instead (note: the remote path skips chunked loading).
  • device (default auto) - picks CUDA when it's there, CPU otherwise. mps, xpu and meta exist too if you're on those backends.
  • cutout_func - putalpha (default) applies the mask straight as the alpha channel; naive composites onto a transparent canvas; alpha_matting runs pymatting trimap refinement, which is slower but the best option for hair, and uses the three alpha_matting_* thresholds below it.
  • mask_precision_threshold (default 0.1) - binarizes the mask: values at or below 0.1 go to 0, everything above goes to 1. Set it to 0 to keep the soft grayscale mask instead.
  • cpu_size - the chunked-loading knob. On CUDA with cpu_size > 0, the pack caps the GPU at roughly 3GB and spills the rest of the model into CPU memory. This is how people run big weights on 4–6GB cards.

Both outputs are what you'd expect: image (the RGBA cutout) and mask. Wire the image into a Save Image; wire the mask into anything that wants one - inpainting, IC-Light relighting, compositing.

Installing it

Easiest is ComfyUI Manager: search for "ComfyUI-BiRefNet-Super" and install. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/rubi-du/ComfyUI-BiRefNet-Super.git
cd ComfyUI-BiRefNet-Super
pip install -r requirements.txt
# restart ComfyUI

The pack's requirements pull in timm, pymatting, scikit-image, scipy, pooch, and both onnxruntime and onnxruntime-gpu. Torch and transformers come from ComfyUI itself. For a local model, drop a HuggingFace folder into models/birefnet/:

cd ComfyUI/models/birefnet
git clone https://huggingface.co/ZhengPeng7/BiRefNet_lite-2K BiRefNet_lite-2K

Then set local_model_path to BiRefNet_lite-2K.

One honest note: if your machine is loaded and your edges are simple, rembg is still enough and lighter. If you're here for hair and feathers, this is the node - just don't expect 4K edges out of a 1024-internal model, and run it on your three hardest images before you standardise on it.

Category🔥BiRefNet

Inputs (11)

NameTypeDefaultDescription
imageIMAGE—
load_local_modelBOOLEANtrue—
deviceCOMBOauto6 options: auto, cuda, cpu, mps, xpu, meta
cutout_funcCOMBOputalpha3 options: putalpha, naive, alpha_matting
mask_precision_thresholdFLOAT0.100–1—
cachedBOOLEANtrue—
cpu_sizeFLOAT0.00—
alpha_matting_foreground_thresholdINT240—
alpha_matting_background_thresholdINT10—
alpha_matting_erode_sizeINT10—
local_model_pathoptSTRINGBiRefNet—

Outputs (2)

NameTypeDescription
imageIMAGE—
maskMASK—