Nodes/Realtime LoRA Trainer/FLUX Klein 4B Analyzer + Selective Loader V2
ComfyUI Node

FLUX Klein 4B Analyzer + Selective Loader V2

Pick which of Klein's 25 blocks a LoRA actually uses

By shootthesound·Created 8 months ago·Updated 2 months ago· 538
FLUX Klein 4B Analyzer + Selective Loader V2
  • model
  • positive
  • negative
  • model
  • positive
  • negative
  • analysis
  • analysis_json
lora_name
strength1.00
presetDefault
double_0true
double_0_str1.00
double_1true
double_1_str1.00
double_2true
double_2_str1.00
double_3true
double_3_str1.00
double_4true
double_4_str1.00
single_0true
single_0_str1.00
single_1true
single_1_str1.00
single_2true
single_2_str1.00
single_3true
single_3_str1.00
single_4true
single_4_str1.00
single_5true
single_5_str1.00
single_6true
single_6_str1.00
single_7true
single_7_str1.00
single_8true
single_8_str1.00
single_9true
single_9_str1.00
single_10true
single_10_str1.00
single_11true
single_11_str1.00
single_12true
single_12_str1.00
single_13true
single_13_str1.00
single_14true
single_14_str1.00
single_15true
single_15_str1.00
single_16true
single_16_str1.00
single_17true
single_17_str1.00
single_18true
single_18_str1.00
single_19true
single_19_str1.00
other_weightstrue
other_weights_str1.00
lora_path_opt
schedule_presetCustom
strength_schedule
save_refined_lorafalse
save_path
save_filename

Klein 4B is the little Flux 2 model everyone underrates - Apache 2.0, runs in under 9GB, does text-to-image and editing in one checkpoint. It also has 25 transformer blocks, and a LoRA trained on it doesn't spread evenly across them. This node analyzes exactly where the weight went, then lets you dial each block up, down, or off.

What it is and why you'd reach for it

Klein 4B's DiT splits into 5 "double" blocks (where image and text streams are processed separately) and 20 "single" blocks (where they're concatenated and actually interact). This is a combined analyzer-and-loader - the V2 generation of this pack's node line - so you get a live impact score per block plus the toggles to act on it, in one node, instead of wiring an analyzer into a separate selective loader.

It comes from ShootTheSound/comfyUI-Realtime-Lora, a 31-node suite that also trains LoRAs for Klein via Musubi Tuner and ships a much deeper sub-component debiaser for the same architecture (worth knowing about if block-level control isn't fine-grained enough - see the DIT Deep Debiaser article for that).

How it works

The node loads the LoRA's tensors, buckets them by which of the 25 blocks they patch, and scores each 0-100% on weight magnitude - high score means the LoRA learned a lot there, which usually correlates with "this is where your character's face or your style lives." Double blocks tend to carry more of the composition-level signal since they're where each modality is still being shaped independently; single blocks are where cross-modal interaction happens, which the pack's own architecture notes on the deeper debiaser describe as "where the model overwrites your image" when it goes wrong. Same intuition applies here at coarser granularity.

There's also an other_weights toggle for anything the LoRA touches outside those 25 numbered blocks - don't skip it. LoKR and LoHa formats (common for newer architectures, and explicitly supported here) sometimes concentrate meaningful weight in exactly that bucket.

Inputs and outputs that matter

  • model / positive / negative - the pipeline this patches; positive/negative get touched too because V2's strength-scheduling hooks route through conditioning.
  • lora_name, strength - the usual pick-and-weight.
  • preset - quick groupings (Double Only, Single Only, High Impact Double 2-4, Late Singles 10-19) so you're not clicking 25 checkboxes from scratch.
  • double_0 through double_4, single_0 through single_19 - each a toggle plus a -5 to 5 strength slider.
  • strength_schedule (optional) - step:strength pairs (0:0,1:1 fades in) for varying the LoRA's influence across the sampling steps, with 40+ built-in presets.
  • save_refined_lora (optional) - bake whatever block combination you settled on into a new .safetensors file so you're not re-clicking toggles every session.
  • Outputs: model, positive, negative (patched, feed to your sampler), analysis (text report), analysis_json (for chaining into another selective loader's impact-coloring).

Installing it

ComfyUI Manager: search "Realtime LoRA Trainer." Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/ShootTheSound/comfyUI-Realtime-Lora

Restart ComfyUI. This node runs out of the box - no training backend, no separate model download. That requirement is only for the pack's trainer nodes, and even then only if you're training, not loading.

Troubleshooting

The lora_name list is empty. It only shows LoRAs already in your loras folder. If you just trained one with this pack's own Klein trainer, feed its lora_path output straight into the lora_path_opt string input instead - the dropdown selection is ignored whenever that's connected, which is deliberate: it's the intended train-then-selectively-load path.

4B and 9B LoRAs behave differently, and this node is 4B-specific. Klein's 4B and 9B checkpoints don't share LoRAs - a LoRA trained on one won't map cleanly onto the other's block layout even if you force it through this loader. Match the analyzer variant to the model size you're actually running.

Killing "low impact" blocks lost the effect entirely. Klein's single blocks are where text and image tokens actually talk to each other; zeroing too many of them removes the mechanism the LoRA needs to apply its style, not just the noise. Disable a couple of the lowest scorers first, check the result, and go from there rather than aggressively pruning on the first pass.

Categoryloaders/lora

Inputs (64)

NameTypeDefaultDescription
modelMODEL
positiveCONDITIONINGPositive conditioning from CLIP encode
negativeCONDITIONINGNegative conditioning from CLIP encode
lora_nameCOMBOLoRA file to load and analyze
strengthFLOAT1.00-10–10Overall LoRA strength (ignored when using schedule)
presetCOMBODefaultQuick preset selection. Individual toggles below override when changed.
double_0BOOLEANtrue
double_0_strFLOAT1.00-5–5
double_1BOOLEANtrue
double_1_strFLOAT1.00-5–5
double_2BOOLEANtrue
double_2_strFLOAT1.00-5–5
double_3BOOLEANtrue
double_3_strFLOAT1.00-5–5
double_4BOOLEANtrue
double_4_strFLOAT1.00-5–5
single_0BOOLEANtrue
single_0_strFLOAT1.00-5–5
single_1BOOLEANtrue
single_1_strFLOAT1.00-5–5
single_2BOOLEANtrue
single_2_strFLOAT1.00-5–5
single_3BOOLEANtrue
single_3_strFLOAT1.00-5–5
single_4BOOLEANtrue
single_4_strFLOAT1.00-5–5
single_5BOOLEANtrue
single_5_strFLOAT1.00-5–5
single_6BOOLEANtrue
single_6_strFLOAT1.00-5–5
single_7BOOLEANtrue
single_7_strFLOAT1.00-5–5
single_8BOOLEANtrue
single_8_strFLOAT1.00-5–5
single_9BOOLEANtrue
single_9_strFLOAT1.00-5–5
single_10BOOLEANtrue
single_10_strFLOAT1.00-5–5
single_11BOOLEANtrue
single_11_strFLOAT1.00-5–5
single_12BOOLEANtrue
single_12_strFLOAT1.00-5–5
single_13BOOLEANtrue
single_13_strFLOAT1.00-5–5
single_14BOOLEANtrue
single_14_strFLOAT1.00-5–5
single_15BOOLEANtrue
single_15_strFLOAT1.00-5–5
single_16BOOLEANtrue
single_16_strFLOAT1.00-5–5
single_17BOOLEANtrue
single_17_strFLOAT1.00-5–5
single_18BOOLEANtrue
single_18_strFLOAT1.00-5–5
single_19BOOLEANtrue
single_19_strFLOAT1.00-5–5
other_weightsBOOLEANtrue
other_weights_strFLOAT1.00-5–5
lora_path_optoptSTRINGOptional: Override LoRA selection with a path
schedule_presetoptCOMBOCustomSelect a preset schedule (populates the text field below for editing)
strength_scheduleoptSTRINGStrength schedule: 0:.2,.5:.8,1:1.0 (step:strength pairs). Edit freely after selecting preset.
save_refined_loraoptBOOLEANfalseEnable to save the refined LoRA to disk
save_pathoptSTRINGDirectory to save refined LoRA
save_filenameoptSTRINGFilename for saved LoRA (timestamp auto-appended). Leave empty for auto-name.

Outputs (5)

NameTypeDescription
modelMODELModel with LoRA applied (filtered by enabled blocks).
positiveCONDITIONINGPositive conditioning (with hooks if using schedule).
negativeCONDITIONINGNegative conditioning (with hooks if using schedule).
analysisSTRINGPer-block analysis showing impact scores.
analysis_jsonSTRINGJSON analysis data for UI coloring.