Nodes/Prompt Translator & Enhancer/Load LLM Model (GGUF)
ComfyUI Node

Load LLM Model (GGUF)

Load a GGUF LLM once, reuse it across your whole graph

By ezetojo·Created 7 months ago·Updated 6 months ago· 0
Load LLM Model (GGUF)
    • llm_model
    llm_modelno_models_found
    n_gpu_layers-1
    n_ctx4096

    In the Prompt Translator & Enhancer pack, this is the boring node - and boring is the whole point. Load LLM Model (GGUF) doesn't translate anything and doesn't write a single tag. It takes a GGUF language model sitting in ComfyUI/models/LLM/, loads it into memory through llama.cpp, and hands you a live model handle to feed the rest of your graph. The payoff is the pack's "reuse" workflow: load once, then wire that same model into as many enhancer nodes as you like without reloading a couple of gigabytes of weights on every run.

    Why you'd separate load from enhance

    The pack's other two nodes both know how to load a model - the all-in-one PromptEnhancerTranslator reloads its model on every execution and deletes it afterward. That's fine for a one-off. But if you're iterating on prompts, which is the entire reason you installed a prompt enhancer, you don't want a model reload between every single generation. LoadLLMModel exists to make the load happen exactly once. The README's "Option 2" flow is the intended setup:

    Load LLM Model → Prompt Enhancer From Model → CLIP Text Encode → KSampler
    

    How it works

    It's a thin wrapper over llama-cpp-python's Llama class - the same engine as llama.cpp, not an API call and not an Ollama server. The llm_model dropdown scans every .gguf under models/LLM (subdirectories allowed) and filters out vision-language files like Qwen3VL or LLaVA, which this text-only node can't drive. Two thoughtful touches: it frees PyTorch's VRAM cache before each load attempt, and it runs an aggressive fallback ladder - GPU at your requested context, then 2048, then 512, then pure CPU with Flash Attention and KQV/op offload disabled. On Windows it also pre-registers CUDA DLL directories so llama.cpp can find the runtime libraries. Translation: this node is unusually willing to just work on a crowded card.

    The inputs that matter

    • llm_model - dropdown of the GGUF files it found. If it shows no_models_found, that's your first problem, not a bug.
    • n_gpu_layers - how many layers to offload to the GPU; -1 (default) means all of them. If your diffusion model needs the VRAM back, set 0 and let it run CPU-side - the node is built for exactly that.
    • n_ctx - context window in tokens, default 4096. For prompt enhancement you almost never need more; Qwen3 models accept up to 40960, but bigger context means more memory.

    Output

    A single llm_model output of type LLM_MODEL. It's not a tensor or a text you can preview - it's a live model handle that feeds into PromptEnhancerFromModel. Don't be confused when the socket shows nothing to display.

    Install and models

    cd ComfyUI/custom_nodes
    git clone https://github.com/ezetojo/ComfyUI-PromptTranslatorEnhancer
    # then restart ComfyUI
    

    Or search "Prompt Translator & Enhancer" in ComfyUI Manager. The only Python dependency is llama-cpp-python; for GPU acceleration you'll want CMAKE_ARGS="-DGGML_CUDA=on" pip install llama-cpp-python --force-reinstall --no-cache-dir. Then drop a GGUF into ComfyUI/models/LLM/ - the README's picks are Qwen3-4B-Instruct-Q4_K_M (~2.5 GB) or the lighter Qwen2.5-3B-Instruct. Q4_K_M is the sweet spot: real quality, small file.

    Troubleshooting

    • no_models_found - the model isn't where it scans. Put the .gguf in ComfyUI/models/LLM/ and restart ComfyUI so it rescans.
    • llama-cpp-python won't install or CUDA won't engage - on Windows there are no official wheels for ComfyUI's bundled Python; grab a prebuilt wheel or build with the CMAKE_ARGS line above.
    • Model loads but everything is slow - you're on the CPU fallback because the GPU was full. Free VRAM by unloading other models, or drop n_ctx.
    • It refuses your file - you picked a vision-language model. That's the filter working; pick an Instruct/Chat model instead.

    One honest caveat: the model stays resident for as long as your graph holds it, which costs you VRAM. That's the trade for never reloading - and it's the right trade once you're past experimenting.

    CategoryLLM/Prompt Enhancement

    Inputs (3)

    NameTypeDefaultDescription
    llm_modelCOMBOno_models_found1 options: no_models_found
    n_gpu_layersINT-1-1–100Number of layers to offload to GPU. -1 = all layers.
    n_ctxINT4096512–32768Context window size in tokens. Qwen3 supports up to 40960.

    Outputs (1)

    NameTypeDescription
    llm_modelLLM_MODEL