Nodes/ComfyUI QwenScope/Generate (Qwen)
ComfyUI Node

Generate (Qwen)

Generate (Qwen) — prove a feature actually steers, in plain text

By Nynxz·Created 4 months ago·Updated 4 months ago· 0
Generate (Qwen)
  • model
  • steer
  • text
  • info
promptOnce upon a time
templateraw
max_new_tokens128
temperature0.70
top_p0.95
top_k40
repetition_penalty1.05
seed0
skip_special_tokenstrue

Generate (Qwen) is the node that closes the loop on the whole pack: run a Qwen model's text generation with your steer plan active, and read whether the steering actually changed what the model says. It's model.generate() wrapped as a ComfyUI node, with an optional steer input that installs residual-steering hooks for the duration of the generation.

Why text generation matters when your goal is images: it's the cheapest, clearest way to verify a direction before you commit it to an image workflow. Steer a feature and ask the model to continue a prompt - if feature #8231 really is "seafaring" or whatever, the completion will drift in that direction, and you'll see it in a sentence instead of squinting at image differences. It's your ground-truth instrument for feature hunting.

How it works

Standard sampling with the knobs you'd expect - temperature, top_p, top_k, repetition_penalty, seed, max_new_tokens. A couple of behaviors worth knowing: temperature = 0 switches to greedy decoding (sampling only happens when temperature > 0), and seed only applies when non-zero - leave it at 0 for unseeded runs.

The steering part is where it gets interesting. If a steer plan is wired in, the node parses the plan's layer_spec against the model's actual layer count, scales each layer's weight by strength, and installs forward hooks on the residual stream inside a context manager - so the hooks live for exactly this generation and are removed when it finishes. Unlike Steer CLIP's persistent hooks, this is self-cleaning: no Clear CLIP Steering needed, because nothing leaks.

The inputs that matter

  • model - QSCOPE_MODEL from Load Qwen Model.
  • prompt - the text to generate from. Use template = think or no_think to match the ChatML format you'd actually use with Qwen.
  • steer (optional) - any QSCOPE_STEER: from Feature → Direction, Load Lens, Combine Lenses, Train Lens, anywhere. No steer = plain generation, which is also useful as a baseline.
  • max_new_tokens - default 128, up to 4096. Short runs are enough to see steering effects.

Outputs: text - the generated continuation - and info reporting whether steering was applied, from what source, and how many layers it touched.

Installing it

Part of the one pack: ComfyUI Manager → search "ComfyUI QwenScope", or

cd ComfyUI/custom_nodes
git clone https://github.com/Nynxz/ComfyUI-QwenScope

restart. Dependencies (transformers, huggingface_hub, safetensors, Pillow, numpy) are the usual set. The model itself downloads from HF on first load - start with Qwen3.5-2B, which fits comfortably in VRAM alongside an image stack.

Common issues

The big one is VRAM: a 9B or 27B model for text generation is a lot of extra resident memory on top of your diffusion model, and the pack only keeps one LLM loaded at a time. If generation feels sluggish or OOMs, drop to the 2B and keep your analysis there. Also remember seed does nothing at 0 - if you're chasing reproducibility, set a real seed. And if steering produces nonsense at strength around 1, that's not a bug: it's a single-feature nudge, and features are narrow. That's when you grab a trained lens instead.

CategoryQwenScope/Generate

Inputs (11)

NameTypeDefaultDescription
modelQSCOPE_MODEL
promptSTRINGOnce upon a time
templateCOMBOraw3 options: raw, think, no_think
max_new_tokensINT1281–4096
temperatureFLOAT0.700–2
top_pFLOAT0.950–1
top_kINT400–1000
repetition_penaltyFLOAT1.050–2
seedINT00–4294967295
skip_special_tokensBOOLEANtrue
steeroptQSCOPE_STEER

Outputs (2)

NameTypeDescription
textSTRING
infoSTRING