Nodes/ComfyUI-Brekel/Brekel Prompt Enhancer (LLM)
ComfyUI Node

Brekel Prompt Enhancer (LLM)

Your local LLM writes your prompts so you don't have to

By Brekel·Created about a year ago·Updated 8 days ago· 19
Brekel Prompt Enhancer (LLM)
    • STRING
    prompta cat wearing a wizard hat
    prefix
    model_name
    quantizationDisabled
    memory_management
    system_prompt
    target_length150
    creativity0.8
    seed0
    postfix

    The name sounds like a pitch, but it's real: this node loads a small language model onto your machine and rewrites your throwaway prompt into something a text-to-image or text-to-video model actually wants to read. No API key, no cloud round-trip, no third-party app. The whole thing runs inside ComfyUI, and the model is just a folder on your disk.

    That fits the way prompting has been going. LLM-assisted prompting went from a browser-tab habit to an actual node ecosystem, and it makes extra sense on models whose text encoder is itself an LLM - having a language model write an instruction for another language model is a translation between two things that speak the same language. This node is one of the local options for that, from the same Brekel who's been around the 3D/mocap scene since the Kinect days.

    How it works

    It uses Hugging Face transformers - AutoModelForCausalLM plus AutoTokenizer - to load any instruct-tuned model it finds in ComfyUI/models/LLM/. That folder is scanned at node-load time, and each model is expected in standard Hugging Face format (a folder containing config.json, model.safetensors, and friends), not as a single .gguf.

    Two dropdowns do the heavy lifting:

    • quantization - Disabled (16-bit), 8-bit (Int8), or 4-bit (NF4) via bitsandbytes. 16-bit is the best quality; 4-bit is the one you pick when a 3B model won't fit next to your checkpoint.
    • memory_management - Keep in VRAM (fastest if you're iterating), Offload to CPU (middle ground), or Unload completely (hands the VRAM back when you're done).

    The system_prompt dropdown reads from .txt files in the prompt_enhancer subfolder. The pack ships a "Text to Image" and a "Text to Video" template; the video one is worth looking at, it's genuinely written for motion-aware models like Wan, LTXV, and Hunyuan. You can drop your own .txt files in there to steer the LLM's behavior, and the node appends a line asking the model to respect your length cap.

    The inputs that matter

    • prompt - the plain-language thing you actually want ("a cat wearing a wizard hat"). Everything else is decoration.
    • target_length - the length goal for the output (characters), also used as a token ceiling. Default 150; going past roughly 512 chars on an attention-capped model starts hurting adherence.
    • creativity - temperature, 0.0 to 2.0. 0.8 is a sensible default; push it up if every generation comes back identical, down if the LLM goes off the rails.
    • prefix and postfix - free text glued to the start and end of the output. This is where your LoRA trigger words go, so they survive the rewrite.
    • seed - 0 means random output; a fixed seed makes the enhancement reproducible.

    Output

    A single STRING - the enhanced prompt. Wire it into your positive prompt input (CLIP Text Encode, or the prompt text on a Flux/LLM-encoded model's text encoder).

    Installing it

    ComfyUI Manager, search "Brekel", install, restart - the Manager pulls the two Python deps automatically. Manually:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/Brekel/ComfyUI-Brekel.git
    cd ComfyUI-Brekel
    pip install -r requirements.txt   # bitsandbytes + accelerate
    

    Then get a model into ComfyUI/models/LLM/:

    cd ComfyUI/models/LLM/
    git clone https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct
    

    Run git lfs install once first, and expect some models (Llama) to need an access request approved on the model card before the clone works. If the node shows NO_MODEL_FOUND, this folder is empty or misnamed - that's the whole diagnosis.

    Where people get burned

    The model_name dropdown populates from models/LLM at startup; if you drop a new model in, refresh ComfyUI rather than expecting it to appear live. Quantization needs bitsandbytes and accelerate - if you skipped requirements.txt, the node throws an import error that tells you exactly that. And remember the model actually loads on first run, so the first queue pass takes a while; subsequent runs reuse it (or don't, if you told it to unload). Start with a 0.5B–3B instruct model on a normal GPU - an 8B "uncensored" Llama in 16-bit is a recipe for an OOM crash and a sad afternoon.

    CategoryBrekel

    Inputs (10)

    NameTypeDefaultDescription
    promptSTRINGa cat wearing a wizard hatOriginal prompt to enhance.
    prefixSTRINGPrefix to prepend at the start of the prompt, for example to add your Lora trigger word(s).
    model_nameCOMBOLLM model to use for prompt enhancement.
    quantizationCOMBODisabledQuantization method to save VRAM.
    memory_managementCOMBOMemory management strategy.
    system_promptCOMBOSystem prompt from files in the 'prompt_enhancer' subfolder.
    target_lengthINT15064–512Target length for the generated prompt. Used as a goal (characters) and a safe token limit.
    creativityFLOAT0.80–2Creativity level (temperature).
    seedINT00–18446744073709550000
    postfixSTRINGPostfix to append at the end of the prompt, for example to add your Lora trigger word(s).

    Outputs (1)

    NameTypeDescription
    STRINGSTRING