Nodes/ComfyUI-ThinkingLLM/ThinkingLLM Prompt Enhancer
ComfyUI Node

ThinkingLLM Prompt Enhancer

A local LLM that writes your prompts better than you do

By goodguy1963·Created 4 months ago·Updated 6 days ago· 21
ThinkingLLM Prompt Enhancer
    • ENHANCED_OUTPUT
    • RAW_TRACE
    model_nameQwen3-VL-4B-Instruct-Abliterated [DL: 7.5GB, VRAM: 6.0GB]
    quantizationNone (FP16)
    attention_modeauto
    use_torch_compilefalse
    deviceauto
    prompt_text
    enhancement_style📝 Enhance
    custom_system_prompt
    max_tokens1024
    temperature0.70
    top_p0.90
    repetition_penalty1.10
    keep_model_loadedfalse
    seed1
    keep_last_promptfalse
    stream_tokens_to_terminalfalse
    enable_thinkingtrue
    hf_token
    duration_seconds5.0

    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. 📝 Enhance is the general-purpose default, and there are Refine, Creative Rewrite, and Detailed Visual styles plus a pile of LTX 2.3 and Wan 2.2 scene/timeline templates that are clearly aimed at video-prompt builders. ✍️ Custom Only hands full control to custom_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, and repetition_penalty above 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.

    CategoryThinkingLLM

    Inputs (19)

    NameTypeDefaultDescription
    model_nameCOMBOQwen3-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.
    quantizationCOMBONone (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_modeCOMBOautoauto tries SageAttention → FlashAttention 2 → SDPA in order. SDPA is stable and recommended. Only override when debugging attention backends.
    use_torch_compileBOOLEANfalseEnable torch.compile('reduce-overhead') on supported CUDA/Torch 2.1+ builds for extra throughput after the first compile.
    deviceCOMBOautoChoose where to run the model: auto, cpu, mps, or cuda:x for multi-GPU systems.
    prompt_textSTRINGPrompt text to enhance. Leave blank to emit the selected preset instruction as the base prompt.
    enhancement_styleCOMBO📝 EnhancePreset enhancement style. Use Custom Only when you want custom_system_prompt to fully control the instruction.
    custom_system_promptSTRINGOptional extra instruction. Required when using Custom Only; otherwise it is prepended to the selected style.
    max_tokensINT102432–16384Maximum new tokens for the enhanced prompt. Increase only when the model truncates useful detail.
    temperatureFLOAT0.700.1–1Sampling randomness. Lower is more stable; higher is more varied.
    top_pFLOAT0.900–1Nucleus sampling cutoff. Lower values restrict token choice; 0.9 is a balanced default.
    repetition_penaltyFLOAT1.100.5–2Values above 1.0 reduce repeated phrases in the enhanced prompt.
    keep_model_loadedBOOLEANfalseKeep the HF model in memory after generation so repeated prompt enhancement skips model loading.
    seedINT11–4294967295Sampling seed. Reusing it with identical inputs can reuse the saved prompt result.
    keep_last_promptBOOLEANfalseKeep the last generated prompt instead of creating a new one
    stream_tokens_to_terminalBOOLEANfalseShow clean wrapped generated tokens in the ComfyUI terminal. When enabled, fixed-seed prompt reuse is bypassed so a fresh streamed run can occur.
    enable_thinkingBOOLEANtrueEnable 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_tokenSTRINGOptional 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_secondsoptFLOAT5.00.2–150Target 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)

    NameTypeDescription
    ENHANCED_OUTPUTSTRING
    RAW_TRACESTRING