Nodes/ComfyUI-Flux2Klein-Conditioning-Toolkit/FLUX.2 Klein Reference Latent Mixer
ComfyUI Node

FLUX.2 Klein Reference Latent Mixer

The honest reference-strength dial for FLUX.2 Klein edits

By xmarre·Created 6 months ago·Updated 5 months ago· 10
FLUX.2 Klein Reference Latent Mixer
  • conditioning
  • CONDITIONING
reference_keep1.00
replace_modezeros
channel_mask_start0
channel_mask_end128
spatial_fadenone
spatial_fade_strength0.50
target_reference_index-1
debugfalse

Klein edits carry your source image into the model as reference latents - separate conditioning metadata, not part of the text-conditioning tensor. The moment you want an edit to stray further from the source, or hold tighter to it, you're reaching for a reference-strength control that ComfyUI's stock Klein nodes don't really give you. This is that control.

The FLUX.2 Klein Reference Latent Mixer is deliberately named a mixer, not a booster. That's a design decision, and it's the honest one. Raw latent multiplication to make the reference stronger than baseline is a known shaky claim - there's an open issue in the source repo this pack was rebuilt from literally questioning whether it works. What reliably works is weakening and fading. So this node gives you dependable ways to turn the reference down, and it does it by changing the latent's content, not just its amplitude.

How it works

The reference latents live in your conditioning metadata under reference_latents. The node reads them, mixes each toward a replacement, and writes them back - leaving the text conditioning untouched. The mix amount is reference_keep (0–1): 1 keeps the reference as-is, 0 fully replaces it with whatever replace_mode says:

  • zeros - the strongest weakening. The reference signal basically disappears.
  • gaussian_noise - replaces with noise scaled to the latent's own standard deviation. Loosens structure while keeping a latent-like signal, so the sampler doesn't choke on a flat input.
  • channel_mean - replaces each channel with its spatial mean. Kills local structure, keeps coarse per-channel statistics. Weird, subtle, occasionally exactly right.
  • lowpass_reference - replaces with a blurred copy of the original reference. This is the interesting one: it keeps broad color and illumination cues while dropping the fine detail lock. Great when you want to loosen how tightly Klein clings to the source's texture without discarding its palette.

Then the finer levers: channel_mask_start / channel_mask_end restrict the whole thing to a slice of latent channels, and spatial_fade (center_out, edges_out, top_down, left_right) with spatial_fade_strength fades the effect across the spatial field - handy for edits where you want the center of the frame to stay faithful but the edges to drift.

The multi-reference part matters if you edit with more than one source image: target_reference_index defaults to -1, which updates all references. The original repo it was rebuilt from only touched reference_latents[0], which was quietly wrong for multi-reference edits. Set a specific index if you want to weaken only one source.

Inputs that matter

  • reference_keep - the main dial. 0.6–0.9 for "loosen slightly," 0.3 and below for "barely a reference."
  • replace_mode - pick your target. zeros for true reference-off, lowpass_reference when you want to keep the colors.
  • target_reference_index - -1 for all, or a specific one.

Output is a CONDITIONING, wired back into your sampler path.

Install and gotchas

Same pack, same install as the others - ComfyUI Manager search "Flux2Klein", or:

cd ComfyUI/custom_nodes
git clone https://github.com/xmarre/ComfyUI-Flux2Klein-Conditioning-Toolkit

Restart. No models, no deps beyond torch.

One caveat the README states plainly: the node assumes Klein conditioning metadata uses the reference_latents key the way the source repo described. If your conditioning doesn't carry that key (say you're feeding it conditioning from a text encoder with no reference path), the node passes it through untouched. So the mixer has to sit after the node that adds the reference latents - usually the reference/KSampler conditioning node - and before the sampler. And remember: reference_keep = 1.0 means "leave the reference alone," which is also what makes the node a no-op and hand the tensor straight through.

Categoryconditioning/flux2klein

Inputs (9)

NameTypeDefaultDescription
conditioningCONDITIONING
reference_keepFLOAT1.000–1
replace_modeoptCOMBOzeros4 options: zeros, gaussian_noise, channel_mean, lowpass_reference
channel_mask_startoptINT00–4096
channel_mask_endoptINT1280–4096
spatial_fadeoptCOMBOnone5 options: none, center_out, edges_out, top_down, left_right
spatial_fade_strengthoptFLOAT0.500–1
target_reference_indexoptINT-1-1–64
debugoptBOOLEANfalse

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING