Qwen Generation 🐼
A local prompt-polisher LLM — no API key, no cloud, just VRAM
- text
If the pack's other node (Qwen Conversation) is the chatty one, this is the one you'll actually wire into a generation workflow. Drop a rough idea in, get a polished natural-language prompt out, feed that straight into your CLIP Text Encode. That's the whole job: one-shot text generation with a local Qwen3 model, nothing sent anywhere, no API key in sight.
And it's a real workflow, not a gimmick. LLM-assisted prompting went from a browser-tab trick to a ComfyUI staple - and it fits the architecture especially well on LLM-encoded models like Z-Image, Flux 2 Klein, and Anima, where the "text encoder" is itself reading your prompt as an instruction. Having an LLM write that instruction is just translating between two things that speak the same language. This node is the Qwen3 take on that, from Alibaba's Qwen family.
How it works
Same engine as the conversation node: a shared processor loads the model with a transformers text-generation pipeline, optionally quantized through BitsAndBytesConfig, and picks CUDA, MPS, or CPU by what it detects on your machine. The difference is the loop - single user turn, no history kept, so the output is just the assistant's reply. The node strips markdown to plain text before returning it, which is a small mercy when your reply comes back full of **bold** and ### headers.
First run downloads the model automatically (default Qwen3-4B, ~8GB fp16 or ~2.5GB at 4-bit) from whichever of Hugging Face or ModelScope is faster, with fallback and retries. It lands in ComfyUI/models/Qwen/Qwen/<model>. Subsequent runs are instant unless you've told it to unload.
The inputs that matter
- model_name - 26 Qwen3 options, 0.6B up to the 235B MoE. Default
Qwen3-4Bis right for prompt rewriting; go smaller for pure speed. - quantization - 4-bit (default), 8-bit, or None. For prompt polish, 4-bit is plenty. Pre-quantized FP8/AWQ/GGUF model variants ignore this setting.
- enable_thinking - lets the model reason out loud before answering. Good for gnarly prompt briefs, wasteful for "make this more cinematic."
- max_new_tokens - default 2048, up to 6144. Rewrites rarely need much.
unload_after_generation defaults to on: VRAM is freed after every run, but you pay a reload cost next time. If you're batching, flip it off and let the model sit.
The output
One text string - the clean assistant answer, plain text, markdown stripped. Wire it into a CLIP Text Encode (or any text input). That's the whole point of this node versus its sibling, which returns the full conversation transcript.
Install
Same pack as Qwen Conversation, so one install covers both:
cd ComfyUI/custom_nodes
git clone https://github.com/SXQBW/ComfyUI-Qwen
cd ComfyUI-Qwen
pip install -r requirements.txt
Or search "ComfyUI-Qwen" in ComfyUI Manager. Note the README's stale ComfyUI-Qwen3.git URLs - the repo is ComfyUI-Qwen now. Dependencies are heavy (torch>=2.6, transformers>=4.51, accelerate, modelscope) but most ComfyUI setups already have them. One real trap: bitsandbytes isn't in requirements.txt, yet 4-bit/8-bit quantization needs it - pip install bitsandbytes if loading fails on that.
Common issues
- First run looks hung. It's downloading gigabytes and loading an LLM into RAM. Wait; it prints bilingual progress to the console.
- "bitsandbytes" errors on 4-bit/8-bit - install it (CUDA only; Mac/CPU fall back to fp16).
- Thinking mode eats your token budget - reasoning chains count against
max_new_tokens. Disable it for fast rewrites. - Tag-based models want tags. If you're feeding an anime/Danbooru-style model, explicitly tell Qwen "output comma-separated tags only" - sentence prose is what it defaults to.
- The default prompt is an ad. The built-in example prompt is a Flux rewrite template that name-drops the author's panda persona. Swap in your own brief - that's the real skill here anyway.
Last thing: this runs real Python and downloads from the HF hub, like every LLM node. Give the repo a glance before you install; the ecosystem has had at least one genuinely malicious LLM node, and install is still a trust decision.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | COMBO | Qwen3-4B | 选择可用的模型版本。 | Select the available model version. |
| quantization | COMBO | 👍 4-bit (VRAM-friendly) | 选择量化级别: ✅ 4-bit: 显著减少显存使用。 ⚖️ 8-bit: 平衡精度和性能。 🚫 None: 使用原始精度(需要高端GPU)。 Select the quantization level: ✅ 4-bit: Significantly reduces VRAM usage. ⚖️ 8-bit: Balances precision and performance. 🚫 None: Uses original precision (requires high-end GPU). |
| enable_thinking | BOOLEAN | false | 启用或禁用思考模式。思考模式适用于复杂推理任务,非思考模式适用于高效对话。 | Enable or disable thinking mode. Thinking mode is suitable for complex reasoning tasks, while non-thinking mode is optimized for efficient conversations. |
| prompt | STRING | This is the prompt text used for generating images with Fulx: "In the style of GHIBSKY, a cyberpunk panda holding a neon sign that reads: 'Designed by SXQBW'". Please optimize, supplement and improve the prompt text according to its content, and make the generated image effect the best.Just provide the best answer content. | 输入提示文本 | Enter the prompt text |
| max_new_tokens | INT | 204864–6144 | 控制生成的最大token数 | Control the maximum number of tokens to generate |
| unload_after_generation | BOOLEAN | true | 生成后是否卸载模型以释放资源。启用此选项可减少内存占用,但会增加下次使用时的加载时间。 | Whether to unload the model after generation to free up resources. Enabling this option reduces memory usage but increases load time for subsequent uses. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |