Nodes/Realtime LoRA Trainer/Text Encoder Inspector (Qwen3-4B)
ComfyUI Node

Text Encoder Inspector (Qwen3-4B)

Activation analysis for Klein 4B's encoder

By shootthesound·Created 8 months ago·Updated 2 months ago· 538
Text Encoder Inspector (Qwen3-4B)
  • clip
  • report
  • json_data
prompta photo of a cat sitting on a table
analysis_modequick
ablation_strength0.5

What it is

This is the smaller sibling of the Qwen3-8B inspector, built for FLUX Klein 4B's text encoder. Same idea, smaller model: Klein 4B reads your prompt through Qwen3-4B rather than CLIP, and that means it's parsing an instruction, not a tag list - the community's own teardown of Klein's conditioning path (done on the 8B variant, but the mechanism is shared) found that specific layers of the encoder get stacked into the final conditioning, and that prompt-weighting syntax like ((subject:1.4)) simply doesn't register the way it would on an SDXL-style CLIP encoder. This node lets you see which layers of the 4B encoder actually activated for a given prompt, instead of treating the whole thing as a black box.

Worth knowing: Qwen3-4B isn't unique to Klein. It's also the text encoder behind Z-Image, one of the most-trained architectures in the current ecosystem - so the underlying model this node analyzes has a bigger footprint in the wider LoRA world than Klein 4B alone. That doesn't mean this specific node is validated for Z-Image workflows (the pack frames it against Klein 4B), just that the encoder architecture itself is familiar territory if you've trained or debugged Z-Image before.

How it works

Same two-mode design as the 8B version: quick mode (default) runs one forward pass and captures per-layer activation magnitude - fast, low VRAM. Ablation mode systematically weakens each region and measures the effect on the output, which is more precise but costs roughly 3x the model's VRAM footprint and takes considerably longer. Start with quick mode; only reach for ablation if you need a firmer importance ranking than a single activation pass gives you.

Inputs and outputs that matter

  • clip - the Qwen3-4B text encoder input.
  • prompt - the text to analyze; ships with a placeholder default so you can test the node cold.
  • analysis_mode - quick or ablation_HEAVY.
  • ablation_strength (0–1, default 0.5) - how hard ablation mode perturbs each region; irrelevant in quick mode.

Outputs: report (readable per-layer summary) and json_data (the same data in a structured form, ready to feed onward).

Installing it

No external training backend required - this node works the moment the pack is installed. ComfyUI Manager (search "Realtime LoRA Trainer") or:

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

Restart ComfyUI.

Common issues

Ablation mode is slow or runs out of VRAM. Expected - it's roughly 3x the model's footprint by design, since it has to test each region's removal rather than just observe one pass. Drop back to quick mode if you're memory-constrained; it covers most diagnostic needs on its own.

Not sure what to do with the results. This node identifies where the encoder responded, not what's wrong - pair it with Text Encoder Deep Debiaser (Qwen3-8B / Flux 2 Klein)'s sibling debiasing tools if you actually want to scale a layer's contribution rather than just observe it. (The pack's debiaser suite for the 4B encoder shares the same underlying design as the 8B one documented elsewhere in this pack.)

Expected this to work on Klein 9B instead. It won't meaningfully - 9B uses the larger Qwen3-8B encoder, a different model with a different layer count. Use Text Encoder Inspector (Qwen3-8B / Flux 2 Klein) for that variant instead; the two aren't interchangeable despite sharing an architecture family.

Categorymodel_patches/analysis

Inputs (4)

NameTypeDefaultDescription
clipCLIPCLIP/Text Encoder to analyze (Qwen3-4B)
promptSTRINGa photo of a cat sitting on a tableTest prompt to analyze
analysis_modeCOMBOquickquick = activation stats (fast, low VRAM). ablation_HEAVY = layer importance via weakening (SLOW, 3x VRAM!)
ablation_strengthFLOAT0.50–1Only used in ablation mode. How much to weaken layers (0.5 = 50%)

Outputs (2)

NameTypeDescription
reportSTRINGHuman-readable analysis report
json_dataSTRINGJSON data for further processing