Nunchaku FLUX.2 Klein Color Anchor
The fix for Klein's warm color-shift-on-edit problem
- model
- conditioning
- MODEL
Klein has a reproducible habit: edit a photo and the whole thing drifts warmer. Community tests confirmed it on fp8 and fp16, independent of quantization - change one thing and the color temperature slides. People fixed it with histogram matching afterwards, one tile at a time. This node fixes it during sampling instead. The NunchakuKleinColorAnchor anchors the output's color to a reference latent while the model denoises, so the palette stays put while the content changes.
Why you'd reach for it
If you do any Klein editing with references, the warm cast is the first thing you'll notice on a second edit. This node sits on the MODEL branch (it's a post-CFG patch, not a conditioning patch) and pulls the colors back toward the reference each step. It's one of the genuinely useful small wins in this pack - it exists because the underlying problem is real and measured, and the node is engineered around that specific failure mode.
The inputs that matter
model- from the pack'sNunchakuKleinModelLoader.conditioning- must carry the reference latents; this is where it reads colors from.strength- max correction strength, 0-1, default 0.5. The tooltip's guidance is spot on: 0.3-0.6 is the starting range. Too high and you override the model's color decisions entirely and every edit comes out looking like a copy of the reference.ramp_curve- shapes when correction kicks in, viaprogress^(1/curve). 1.0 is linear; for 4-8 step distilled schedules, values of 2-4 work best because the correction reaches useful strength early while the later steps run freer. The tooltip says this explicitly and it's worth listening to.ref_index- which reference latent to anchor from (0-63). Pick the one whose colors you trust.channel_weights-uniformcorrects all channels equally;by_varianceweights correction by how stable each channel's mean is in the reference, trusting stable channels more.by_varianceis the smarter default for noisy refs.
Output: MODEL, chained toward the KSampler.
Wiring and install
Reference latents → conditioning, and the MODEL from the loader passes through this node on the way to the sampler. Same pack install as everything here:
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/.
Common issues
- Output still warm - strength too low for your step count; bump it toward 0.6 and try a higher
ramp_curveso correction lands early in a 4-step schedule. - Output looks like a clone of the reference - strength too high. Dial back to 0.4 and lean on
by_varianceso you're correcting statistics, not copying pixels. - No effect on plain T2I - expected; there's no reference to anchor to.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| conditioning | CONDITIONING | — | |
| strength | FLOAT | 0.500–1 | Maximum correction strength. 0.3-0.6 is a good starting range. Too high and you override the model's color decisions entirely. |
| ramp_curveopt | FLOAT | 1.50.5–8 | Controls the shape of the correction ramp. Formula: progress^(1/curve). 1.0 = linear. >1 = fast start, tapers off (e.g. sqrt for curve=2). <1 = slow start, aggressive late (e.g. squared for curve=0.5). For few-step schedules (4-8 steps) values of 2-4 work well because they reach useful strength quickly. |
| ref_indexopt | INT | 00–63 | Which reference latent to anchor colors from. |
| channel_weightsopt | COMBO | uniform | uniform: correct all channels equally. by_variance: weight correction by how stable each channel's mean is in the reference (low-variance channels trusted more). |
| debugopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |