ThinkingLLM Prompt Enhancer
A local LLM that writes your prompts better than you do
- ENHANCED_OUTPUT
- RAW_TRACE
Prompt enhancement is one of those workflows that felt like a gimmick in the SD 1.5 era and became genuinely useful once 2026's models started using LLM text encoders. Those models want natural-language descriptions, not keyword soup - and a local LLM is exactly what expands "girl by a window, rain" into a full scene description the encoder can chew on. This node is ThinkingLLM's HF version of that: you feed it a rough prompt_text, it returns a cleaned, expanded ENHANCED_OUTPUT string you wire straight into your CLIP/text-encode stage.
It's the same Transformers path as the rest of the pack, so install friction is low compared to the GGUF nodes. The model catalog is the full Qwen/Qwen-VL/Gemma list, though you're not using the vision here - this node takes text in and gives text out.
What to set
enhancement_style- the real decision.📝 Enhanceis the general-purpose default, and there areRefine,Creative Rewrite, andDetailed Visualstyles plus a pile of LTX 2.3 and Wan 2.2 scene/timeline templates that are clearly aimed at video-prompt builders.✍️ Custom Onlyhands full control tocustom_system_prompt.prompt_text- your rough prompt. Leave it blank and the selected preset instruction becomes the base prompt.custom_system_prompt- required with Custom Only; otherwise it's prepended to the selected style.quantization-None (FP16)for best quality if memory allows, 8-bit for 8–16 GB GPUs, 4-bit for 6 GB or less (slower). FP16 is the default and right for most people.temperature/top_p/repetition_penalty- 0.7 / 0.9 / 1.1 defaults are fine; nudge temperature up for wilder rewrites, andrepetition_penaltyabove 1.0 already helps keep long prompts from looping.max_tokens- 1024 default; raise it only when the model truncates useful detail.
Also present, in case you've read the rest of this pack: attention_mode, use_torch_compile, device, keep_model_loaded, seed, keep_last_prompt, stream_tokens_to_terminal, enable_thinking, and hf_token for gated models. Outputs are ENHANCED_OUTPUT and RAW_TRACE - the cleaned prompt on the left, the raw stream (including hidden reasoning) on the right.
Installing
ComfyUI Manager → search ThinkingLLM → install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/goodguy1963/ComfyUI-ThinkingLLM.git
cd ComfyUI-ThinkingLLM
pip install -r requirements.txt
Requires transformers>=5.2.0; restart after install. First run downloads the chosen weights into models/LLM/Qwen-VL.
Gotchas
The fixed-seed prompt cache applies here too: identical inputs reuse the saved enhanced prompt, and enabling stream_tokens_to_terminal deliberately bypasses that cache for a fresh run. Keep in mind this node's purpose is text, so don't expect it to look at your image - for image-grounded enhancement you'd describe the image first with a vision node, then enhance. And if you're only ever enhancing prompts, the GGUF version of this node uses a small text-only quant that's a lot lighter than pulling a vision model for the job.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | COMBO | Qwen3-VL-4B-Instruct-Abliterated [DL: 7.5GB, VRAM: 6.0GB] | Pick the checkpoint. [installed] means a catalog model is available in a configured LLM location; [local] means an uncatalogued local model, including compatible ComfyUI text_encoders. Missing catalog models download on first use. |
| quantization | COMBO | None (FP16) | Precision vs VRAM. FP16 gives the best quality if memory allows; 8-bit suits 8–16 GB GPUs; 4-bit fits 6 GB or lower but is slower. |
| attention_mode | COMBO | auto | auto tries SageAttention → FlashAttention 2 → SDPA in order. SDPA is stable and recommended. Only override when debugging attention backends. |
| use_torch_compile | BOOLEAN | false | Enable torch.compile('reduce-overhead') on supported CUDA/Torch 2.1+ builds for extra throughput after the first compile. |
| device | COMBO | auto | Choose where to run the model: auto, cpu, mps, or cuda:x for multi-GPU systems. |
| prompt_text | STRING | Prompt text to enhance. Leave blank to emit the selected preset instruction as the base prompt. | |
| enhancement_style | COMBO | 📝 Enhance | Preset enhancement style. Use Custom Only when you want custom_system_prompt to fully control the instruction. |
| custom_system_prompt | STRING | Optional extra instruction. Required when using Custom Only; otherwise it is prepended to the selected style. | |
| max_tokens | INT | 102432–16384 | Maximum new tokens for the enhanced prompt. Increase only when the model truncates useful detail. |
| temperature | FLOAT | 0.700.1–1 | Sampling randomness. Lower is more stable; higher is more varied. |
| top_p | FLOAT | 0.900–1 | Nucleus sampling cutoff. Lower values restrict token choice; 0.9 is a balanced default. |
| repetition_penalty | FLOAT | 1.100.5–2 | Values above 1.0 reduce repeated phrases in the enhanced prompt. |
| keep_model_loaded | BOOLEAN | false | Keep the HF model in memory after generation so repeated prompt enhancement skips model loading. |
| seed | INT | 11–4294967295 | Sampling seed. Reusing it with identical inputs can reuse the saved prompt result. |
| keep_last_prompt | BOOLEAN | false | Keep the last generated prompt instead of creating a new one |
| stream_tokens_to_terminal | BOOLEAN | false | Show clean wrapped generated tokens in the ComfyUI terminal. When enabled, fixed-seed prompt reuse is bypassed so a fresh streamed run can occur. |
| enable_thinking | BOOLEAN | true | Enable model reasoning/thinking when the backend supports it: True=allow thinking, False=force direct answer. Even when enabled, easy prompts may still get a direct answer, and this node automatically disables thinking when there is not enough output budget left for useful reasoning. Prompt enhancers still return a cleaned final prompt, so terminal reasoning may be hidden or empty. |
| hf_token | STRING | Optional Hugging Face access token for private or gated model downloads. It is passed only to the download call, never logged or cached, and the in-memory copy is dropped after the download attempt. Clear this field before saving or sharing workflows. | |
| duration_secondsopt | FLOAT | 5.00.2–150 | Target video duration in seconds. It is used only by registered LTX 2.3 and MiniMax H3 video presets. Connect the same requested duration to the video generator; MiniMax values are normalized to its 17k+5 frame grid at 24 fps. For longer MiniMax scripts, ThinkingLLM selects a coherent moment that fits while keeping any selected dialogue verbatim. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| ENHANCED_OUTPUT | STRING | — |
| RAW_TRACE | STRING | — |