Nodes/ComfyUI-PromptEnhancer/Prompt Enhancer (Text-to-Image)
ComfyUI Node

Prompt Enhancer (Text-to-Image)

Type \"a cat\", get a paragraph — the local LLM that writes your T2I prompts

By ryan-seungyong-lee·Created 11 months ago·Updated 11 months ago· 8
Prompt Enhancer (Text-to-Image)
    • enhanced_prompt
    promptA cat sitting on a table
    model_namepromptenhancer-7b
    temperature0.70
    top_p0.90
    max_new_tokens512
    system_prompt

    Every one of us has typed "a cat sitting on a table" and gotten a cat sitting on a table. Fine. This node is for when you want the paragraph version - "a photorealistic portrait of a domestic cat with soft fur, alert eyes, whiskers clearly visible, natural lighting, gently blurred background, high-quality digital photography style" - without writing any of it yourself. PromptEnhancerT2I is a local LLM that rewrites your one-liner into a detailed, structured prompt before it ever reaches your sampler.

    It's the text-to-image half of ComfyUI-PromptEnhancer, a small wrapper around Tencent's Hunyuan PromptEnhancer (arXiv 2509.04545), and it has the two properties that make a prompt-enhancer node worth owning: it runs entirely on your machine - no API, no key - and it speaks both English and Chinese, output in the same language you typed.

    Why reach for it, honestly? Prompt-enhancing is the rare feature people feel ambivalent about. "It makes me feel like I'm losing control over the input" is a real community sentiment, and it's a fair one. Where this earns its place is the blank canvas: you have a vague idea, you can't find the words, and a well-structured first draft beats staring at an empty box. It also fits the 2026 prompting reality - if your checkpoint's text encoder is an LLM reading an instruction, then having an LLM write that instruction is translation between two things that speak the same language. On tag-based models (Illustrious, Pony, SDXL), give it a custom system prompt telling it to emit comma-separated booru tags instead of sentences - that's what the encoder actually wants.

    How it works

    On first run the node downloads the model from HuggingFace into ComfyUI/models/prompt_enhancer/ - the default promptenhancer-7b is ~13GB, so the first run is slow and that's normal. It then loads it through the transformers library in bf16 with automatic device mapping, wraps your prompt in a chat template, and generates.

    The interesting bit is the default system prompt, which is in Chinese and is genuinely opinionated: it instructs the model to preserve every element of the original intent (subject, action, quantity, style, layout, relations), follow a "overview → details → summary" structure, describe primary elements before secondary and background ones, and end by naming the overall style or type. The output arrives wrapped in <answer> tags, which the node strips for you. If generation fails for any reason, it hands you back your original prompt instead of an empty string.

    The inputs that actually matter

    • prompt - whatever you'd have typed in the prompt box. Default is the cat.
    • model_name - promptenhancer-7b (default, ~13GB, runs on 8GB VRAM) or promptenhancer-32b (highest quality, ~64GB, wants 32GB+ VRAM). If you're on a normal consumer card, the 7B is the whole conversation.
    • temperature - 0 is deterministic (recommended when you want repeatable results), 0.7 is the balanced default, 1+ gets creative and starts drifting from your intent.
    • max_new_tokens - default 512; short and punchy at the low end, very detailed descriptions around 1024–2048.
    • system_prompt (optional) - the escape hatch. Ask for booru tags for an anime model, or camera/lens language for a photoreal one.

    The single output, enhanced_prompt, is a plain string - wire it straight into your CLIP Text Encode (or the prompt input of whatever loader your workflow uses).

    Installing it

    Same story as every custom node:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/ryan-seungyong-lee/ComfyUI-PromptEnhancer.git
    cd ComfyUI-PromptEnhancer
    pip install -r requirements.txt
    

    …or just search "PromptEnhancer" in ComfyUI Manager and let it do the work. Restart ComfyUI and both nodes appear under the promptenhancer category. Note the ~13GB auto-download is the real install cost, not the pip line. (The flash-attn the README warns about is only needed for the image-to-image sibling - not this node.)

    Where people get burned

    • The first run "hangs." It's downloading 13GB and then loading a 7B model. Subsequent runs use a cached copy and are much faster.
    • Out of memory. You switched model_name to the 32B. Don't, unless you actually have the VRAM.
    • The download fails. Check hf auth login, disk space (leave ~20GB), and that you're not behind a flaky proxy. The README's manual huggingface-cli download commands are a solid fallback.
    • The output ignores what you meant. That's sampling, not a bug - drop temperature toward 0.

    One more honest note: this pack is a snapshot of Tencent's original PromptEnhancer repo, which community chatter says has since gone quiet - so don't expect the model to keep improving. For a local, private, no-key prompt writer, that's a small price.

    Categorypromptenhancer

    Inputs (6)

    NameTypeDefaultDescription
    promptSTRINGA cat sitting on a table
    model_nameCOMBOpromptenhancer-7b2 options: promptenhancer-7b, promptenhancer-32b
    temperatureFLOAT0.700–2
    top_pFLOAT0.900–1
    max_new_tokensINT51264–2048
    system_promptoptSTRING

    Outputs (1)

    NameTypeDescription
    enhanced_promptSTRING