Nodes/ComfyUI-Flux2Klein-Enhancer/FLUX.2 Klein Enhancer
ComfyUI Node

FLUX.2 Klein Enhancer

Manual control over Klein's Qwen3 conditioning

By capitan01R·Created 7 months ago·Updated 30 days ago· 551
FLUX.2 Klein Enhancer
  • conditioning
  • CONDITIONING
active_scale1.00
per_token_whiten0.00
norm_equalize0.00
early_layer_scale1.00
mid_layer_scale1.00
late_layer_scale1.00
preserve_original0.00
active_end_override0
deviceauto
debugfalse

If you've tried to weight a prompt on Klein the old way - (red dress:1.4), extra parentheses, repeating a word for emphasis - you already know it does nothing. Klein's text encoder is a Qwen3 LLM reading your prompt as a chat message, not a CLIP tokenizer reading tags, and prompt-weighting syntax simply isn't parsed. This node is the actual replacement: a post-hoc mixing board for Klein's conditioning, applied after encoding instead of inside the prompt string.

What it's doing under the hood

Klein's 9B text encoder stacks hidden states from three of Qwen3's internal layers - early, middle, late - into the 12288-wide conditioning tensor the diffusion model actually sees. That's Klein-specific plumbing, and it's why this node exposes per-layer controls that don't exist for a normal CLIP pipeline. Early layers correlate with low-level/structural features, middle with intermediate semantics, late with abstract, high-level meaning. Scaling them independently lets you push, say, "hold the composition tighter" without touching how strongly the model reads the meaning of your words, or vice versa.

Everything operates only on the "active" region of the token sequence - the actual prompt tokens, not padding - which is auto-detected from the attention mask.

The inputs you'll actually touch

  • active_scale - a straight multiplier on every active token. Leave it near 1.0. The tooltip is blunt about why: the model was trained on Qwen3's natural embedding distribution, and values far from 1.0 push it off that distribution - you'll see garbled details or ignored words before you see "stronger prompt."
  • per_token_whiten - widens (>0) or compresses (<0) each token's deviation from the sequence mean. This was literally called "contrast" in the pack's v1, if that name is more intuitive.
  • norm_equalize - blends every token toward the same L2 norm, flattening magnitude variance. Sounds tidy, but it actively fights Qwen3's natural emphasis (the encoder wants some tokens louder than others), so treat it as a rescue tool for a specific problem, not a default-on setting.
  • early_layer_scale / mid_layer_scale / late_layer_scale - the per-layer levers described above.
  • preserve_original - your safety net. 0 = full effect, 1 = untouched. Dial this instead of fighting the other sliders back toward neutral.
  • active_end_override - manual boundary for the active region; 0 auto-detects from the attention mask and falls back to the full sequence if that mask is missing.

device and debug are exactly what they sound like. Output is a single CONDITIONING - wire it straight into your sampler's positive input, or feed it into Sectioned Encoder / Detail Controller further down the chain if you're doing per-section prompt weighting too.

Installing it

Through ComfyUI Manager: search ComfyUI-Flux2Klein-Enhancer, install, restart. By hand:

cd ComfyUI/custom_nodes
git clone https://github.com/capitan01R/ComfyUI-Flux2Klein-Enhancer.git

Restart ComfyUI. No extra Python packages - it rides on whatever ComfyUI already has installed.

Where people get burned

At neutral values (everything at 1 or 0) this node is an exact pass-through, so it's safe to drop into any Klein graph cold and start nudging from zero - you won't break a working workflow by inserting it. The failure mode shows up once you start pushing: active_scale or per_token_whiten too far from their defaults sends the conditioning off-distribution, and the symptom isn't "stronger prompt," it's the model quietly ignoring or garbling parts of what you asked for. If that happens, pull preserve_original up before you conclude the node is broken.

The other trap is active_end_override staying at 0 in a workflow that, for whatever reason, doesn't carry an attention mask through to this node - it silently falls back to touching the entire sequence, padding included, which can make results inconsistent between otherwise-identical runs. If you notice that kind of flakiness, set the override manually instead of trusting auto-detection.

This node and its simpler sibling, FLUX.2 Klein Text Enhancer, do overlapping jobs - Text Enhancer is the one-knob version (magnitude, contrast, normalize_strength). Stacking both on the same conditioning compounds their effects, so pick one per workflow rather than running both at once.

Categoryconditioning/flux2klein

Inputs (11)

NameTypeDefaultDescription
conditioningCONDITIONING
active_scaleFLOAT1.000–10Multiplier on every active-token embedding. 1.0 = unchanged. The model was trained on Qwen3's natural distribution; values far from 1.0 push it off-distribution.
per_token_whitenFLOAT0.00-1–5Amplifies per-token deviation from the sequence mean: (x - mean)*(1+w) + mean. >0 widens spread, <0 compresses. Was called 'contrast' in v1.
norm_equalizeFLOAT0.000–1Blend each token toward the per-sequence mean L2 norm. Flattens magnitude variance — fights Qwen3's natural emphasis. 0 = no effect.
early_layer_scaleoptFLOAT1.000–5Klein-specific. Scale the first Qwen3 layer slice (low-level / structural features). Klein conditioning stacks 3 layers along the embed dim; this targets the first.
mid_layer_scaleoptFLOAT1.000–5Klein-specific. Scale the middle Qwen3 layer slice (intermediate semantic features).
late_layer_scaleoptFLOAT1.000–5Klein-specific. Scale the last Qwen3 layer slice (high-level / abstract semantic features).
preserve_originaloptFLOAT0.000–1Linear blend back the unmodified active region. 0.0 = full enhancement, 1.0 = no change.
active_end_overrideoptINT00–512Override the active-region end. 0 = auto-detect from attention_mask, falls back to full sequence length if mask missing.
deviceoptCOMBOauto2 options: auto, cpu
debugoptBOOLEANfalse

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING