Apply Klein9 RefMods (FLUX.2)
Stop Re-Encoding Your References on Every Single Run
- conditioning
- klein9_refmods
- conditioning
Klein's party trick is that you hand it a picture and it uses it - same face, same jacket, same room, no LoRA required. The cost is less obvious: every reference gets VAE-encoded and stapled onto the conditioning sequence again, on every generation, and a 4K reference is thousands of tokens of attention you keep paying for. This node is the other half of that trade - it injects an already-encoded bundle, so your references never touch a VAE at generation time.
Where this fits in a Klein workflow
Multi-reference is why Klein 9B displaced Qwen-Image-Edit for a lot of people: one model that generates and edits, with up to ten references, at 4 steps and CFG 1. The stock ComfyUI way to do it is VAE Encode → ReferenceLatent → conditioning, chained once per image. It works, and it's fiddly: chaining four or five is where the bleeding starts, and every run re-encodes images you've encoded a hundred times.
The pack's answer is RefMods: pre-encoded reference latents saved as .safetensors files in models/refmods-klein9/. Build them once with the Extract node - or grab the author's ready-made ones off Hugging Face - and after that every graph is just load, apply, sample. Klein9RefModApply is the apply.
What it actually does
Klein's text encoder is a Qwen3 LLM that reads your prompt as a chat turn, not a bag of CLIP tags, and the reference images ride a separate path: VAE latents appended to the sequence at the model's 2D RoPE positions. This node writes those latents into the standard reference_latents slot of a CONDITIONING object - the same slot the core ReferenceLatent node uses. It's not a new conditioning mechanism, just the native one fed from disk instead of from a VAE.
Inputs that matter. You wire conditioning from your text encode, klein9_refmods from the loader, and then you decide retention - how hard the reference pulls:
fully_preserved (1.0)- for "this is the person, keep them."partially_preserved (0.7)andattribute_transfer (0.4)- the useful middle. Face shape but not the exact photo, or the wardrobe and the vibe but a new human.weak_reference (0.2)- a nudge, colour or mood.custom_multiplier- unlockscustom_retention, a float from 0.0 to 2.0 in 0.05 steps, for sweeping.
If you've used IP-Adapter, the feel is familiar: there's a working band, and above it the reference starts writing the image while your prompt gets ignored. custom_multiplier plus custom_retention is how you bisect that band instead of guessing between presets.
blend_mode is the pack's own trick and the other real dial. manifold_blur (the default) attenuates a reference by low-pass filtering along the latent manifold; direct_scale just multiplies. That's the README's framing - weaken smoothly rather than degrade into noise - and it's why the default is what it is. Leave it alone unless you have a reason.
ref_method offers four options (default, index, uxo, index_timestep_zero) that the README doesn't document. Start at default; if you're chasing a failure later, change one at a time on a fixed seed - this is the kind of enum where people convince themselves they see a difference.
Output: one conditioning, straight into CFGGuider or SamplerCustomAdvanced.
[ CLIPTextEncode ] (prompt)
│
▼
[ Apply Klein9 RefMods (FLUX.2) ] ◄── [ Load Klein9 RefMods (FLUX.2) ]
│ (conditioning out)
▼
[ CFGGuider / SamplerCustomAdvanced ]
Install
Same pack as the other three Klein9 nodes, so you only do this once:
cd ComfyUI/custom_nodes
git clone https://github.com/malcolmamal/ComfyUI-Flux2Klein9Mod.git
Or search Flux2Klein9Mod in ComfyUI Manager. (The README's clone line points at the author's older malcolmrey handle - same repo; if one 404s, try the other.)
Then make sure the folder exists and restart ComfyUI:
mkdir -p ComfyUI/models/refmods-klein9
You don't have to extract anything yourself to try this: the author publishes a library of ready-made RefMods plus a browser UI, both linked at the top of the README.
Traps worth knowing
Retention too high is the classic one. Fully preserved at 1.0 with a strong prompt fight each other, and the reference wins. If your scene description is being ignored, drop to 0.4–0.7 before you rewrite the prompt.
More references is not better. Stacking four separate refs is where subjects bleed together and backgrounds leak into the output. People who fight this end up collapsing their references into a single grid image, which is also the shape the token-budget setting exists to serve.
Yellow-warm drift on Klein edits is the model, not this node. Klein edits come back slightly warmer on fp8 and fp16; fix it with a histogram or colour match against the source.
An empty mod list in the loader means models/refmods-klein9/ is empty or misspelled - the dropdown is populated by scanning that folder at load time. Drop files in, refresh the node definitions, restart.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| conditioning | CONDITIONING | — | |
| klein9_refmods | KLEIN9_REFMODS | — | |
| retention | COMBO | fully_preserved (1.0) | 5 options: fully_preserved (1.0), partially_preserved (0.7), attribute_transfer (0.4), weak_reference (0.2), custom_multiplier |
| custom_retention | FLOAT | 1.000–2 | — |
| ref_method | COMBO | default | 4 options: default, index, uxo, index_timestep_zero |
| blend_mode | COMBO | manifold_blur | 2 options: manifold_blur, direct_scale |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| conditioning | CONDITIONING | — |