Nodes/ComfyUI-Nunchaku-Klein/Nunchaku FLUX.2 Klein Ref Latent Weight
ComfyUI Node

Nunchaku FLUX.2 Klein Ref Latent Weight

Weight a Klein reference without rebuilding your Nunchaku backend

By tom-m-2020·Created 2 months ago·Updated 17 days ago· 2
Nunchaku FLUX.2 Klein Ref Latent Weight
  • model
  • MODEL
reference_index0
weight1.00

"Ref Latent Weight" has become a fixture of Klein reference workflows - it controls how much attention the model pays to one specific reference image, which is how you tell Klein "this reference is the boss, that one is just a vibe." This version is the one that works on stock Nunchaku, and it comes with a caveat the author states plainly in the source: it's a prediction-residual substitute, not real attention K/V scaling. You get most of the behavior, on the backend you already have, without installing a modified Nunchaku.

Why there are two versions

Real reference-weighting works by scaling the reference's keys and values inside the attention layers. Stock Nunchaku (Vitoom's build) doesn't expose that hook, so the "compatibility" version approximates it: instead of touching attention, it adjusts how the reference's prediction contributes to the model's output - a substitute that reproduces the rough effect. If that sounds like a compromise, it is. The Direct K/V version in this pack does the real thing, but requires the author's extended Nunchaku fork. This one trades fidelity for zero-backend-headache, and for most "nudge reference 2 down a bit" use cases it's good enough.

The inputs are exactly what you'd expect and nothing more: model (from the pack's Model Loader), reference_index (0-7, which reference in your Multi Reference Latent stack), and weight (0-5, default 1.0; 0 kills the reference, >1 amplifies it). Output: MODEL.

Wiring and rules

Attach your references with Multi Reference Latent, then pass the model through this node on the way to the sampler. Two hard rules from the source:

  • One active Ref Latent Weight per model branch. The error is explicit if you stack a second.
  • It cannot be combined with Text/Ref Balance on the same branch - the error names the node. If you need both text/ref balance and reference weighting, you're in Direct K/V territory anyway.

Installing

Standard for this pack - Manager → "Nunchaku-Klein", or:

cd ComfyUI/custom_nodes
git clone https://github.com/tom-m-2020/ComfyUI-Nunchaku-Klein

Backend: Vitoom Nunchaku wheel from huggingface.co/tonera/vitoom-nunchaku, tonera's Klein checkpoint in diffusion_models/. No fork needed for this node.

Common issues

  • Weight changes nothing - confirm reference_index matches the reference's position; off-by-one is the classic.
  • "Cannot be stacked" errors - you have both a Ref Latent Weight and a Text/Ref Balance in the chain. Remove one.
  • Same seed, different output - Nunchaku's documented nondeterminism; the weight isn't the culprit.
CategoryNunchaku/FLUX.2 Klein/Enhancer/Reference

Inputs (3)

NameTypeDefaultDescription
modelMODEL
reference_indexINT00–7
weightFLOAT1.000–5

Outputs (1)

NameTypeDescription
MODELMODEL