QwQ Text Generator
Make ComfyUI think before it answers
- model
- tokenizer
- response
This is the node that actually does the thinking. QwQModelLoader drags the 65 GB of Qwen QwQ-32B into memory; QwQTextGenerator takes that model plus your prompt and returns generated text. Default prompt is the old "how many r's are in strawberry" trick, which is a fair summary of what QwQ is for: a reasoning model that works through multi-step questions out loud before it commits to an answer.
Why would you want that inside ComfyUI? Same reason anyone wires an LLM into a node graph: prompt generation, rewriting, critiquing, or any text transform you can script in one sentence. The output is a plain STRING, so it can flow into a text preview node, a save-to-file node, or get concatenated into the prompt feeding your diffusion model. It's fully local and free, which is the honest upside - you just paid for it in download time and VRAM, not API credits.
How it works
The node wraps your prompt with the model's chat template as a user message, then calls model.generate with the sampling knobs below. Because QwQ is a reasoning model, the response starts with a long <think>-style trace before the final answer. That's not the node glitching - that's the whole point. It's the reason QwQ gets the strawberry question right instead of confidently miscounting.
The inputs that actually matter
- model and tokenizer - plug in the
modelandtokenizeroutputs from QwQModelLoader. Non-negotiable, same pack. - prompt - whatever you want the model to chew on.
- max_new_tokens (default 32768) - this is the trap. The default lets the model ruminate for up to 33k tokens, which on a 32B model with CPU offload is an all-night affair, and 32k of KV cache is its own memory problem. For prompt-writing, a few hundred tokens is plenty; the model stops when it's answered.
- temperature 0.6, top_k 40, top_p 0.95 - these aren't random. They're Qwen's own recommended sampling settings for QwQ, and the source comments quote the model card: greedy decoding (temperature 0) makes this model fall into endless repetition loops. Leave them alone unless you know why you're touching them.
The only output is response (STRING), which is what you wire onward.
Gotchas, honestly
Generation is synchronous. While the model thinks, the ComfyUI process is busy - no progress bar, the queue just sits. With the default 32k token ceiling that can look frozen. Keep max_new_tokens in the hundreds and it's tolerable.
Second quirk from the source: there's no seed input, and the generate function pins the seed to 0 internally. Same prompt plus same settings equals the same answer, every single run. If you want variety, vary the prompt or the sampling. (The function's internal parameter defaults differ from the node's UI defaults, but the UI wins - ComfyUI passes every input through, so that mismatch only matters if you're calling the class from your own code.)
Installation
It ships with the same pack as the loader:
cd ComfyUI/custom_nodes
git clone https://github.com/leeguandong/ComfyUI_QWQ32B.git
Restart, and the two QwQ nodes appear together. There's no requirements.txt, so transformers needs to already exist in your ComfyUI Python env or the pack won't import.
Bottom line: it's a real, working local reasoning LLM inside ComfyUI - genuinely neat, and honest about what it costs (65 GB of disk, a GPU or a lot of RAM, and an unmaintained pack with a single commit from March 2025). Lower max_new_tokens before you hit run and it's a fun addition to any workflow that needs a second brain.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| tokenizer | TOKENIZER | — | |
| prompt | STRING | How many r's are in the word "strawberry" | — |
| max_new_tokens | INT | 327681–32768 | — |
| temperature | FLOAT | 0.600–2 | — |
| top_k | INT | 400–101 | — |
| top_p | FLOAT | 0.950–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| response | STRING | — |