Nodes/VLM_nodes/LLM (Managed Cache)
ComfyUI Node Runs on cloud

LLM (Managed Cache)

The no-drama local LLM node for one-shot prompt generation

By gokayfem·Created 3 years ago·Updated 17 days ago· 587
LLM (Managed Cache)
    • STRING
    ckpt_name
    max_ctx4096
    gpu_layers-1
    n_threads12
    prompt
    temperature0.10
    unloadfalse
    chat_format
    n_batch512
    n_ubatch512
    flash_attentionAuto
    use_mmaptrue
    split_modeLayer
    main_gpu0
    tensor_split

    Some nodes you tune for an hour. This one you set in ten seconds. LLMOptionalMemoryFreeSimple is the pack's lightweight LLM chat node: pick a GGUF from a dropdown, type your prompt, tick a box if you want your VRAM back afterward, hit queue. It's the right tool for "turn this description into a prompt once" and other jobs where the full advanced node's sampling panel is just noise.

    What it is

    The simple sibling of LLMOptionalMemoryFreeAdvanced. Same self-contained model loading, same optional memory-freeing behavior, but only the settings that matter for everyday use. It's text-only - no image input, so this is for pure LLM work, which is exactly what the README's LLM prompt-generation nodes (like the Qwen and IF prompt GGUFs) are for.

    The inputs that matter

    • ckpt_name - dropdown of GGUF files in models/LLavacheckpoints. Your LLM.
    • prompt - your input. Multiline, so it can hold a real instruction like "Write a detailed Flux prompt for a neon-lit rainy street at night."
    • temperature - default 0.1. Low for consistent prompt output, up for creative variation.
    • max_ctx - context length, default 4096. Leave it unless your prompts are long.
    • gpu_layers - GPU offload (default 27). Raise if it's slow.
    • n_threads - CPU threads.
    • unload - the one that matters. Check it and the model frees from memory after answering, so the diffusion sampler downstream gets the GPU.

    Output is a single STRING.

    How it works

    llama.cpp inference, same as every node in this pack's LLM family: load the GGUF, run your prompt, return the text. The "simple" part is that there's no system message field and no penalties - you get one prompt and a temperature. That's genuinely fine for prompt generation, where you're usually feeding a well-formed instruction and reading one answer.

    Install

    Standard pack install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/gokayfem/ComfyUI_VLM_nodes
    

    Restart (or Manager → "VLM Nodes"). Python 3.9+ and the llama-cpp-python stack. GGUF model files go in models/LLavacheckpoints; no mmproj needed since this node never touches images.

    Troubleshooting

    The llama-cpp-python install issues are the recurring theme across this pack: on Windows that's the "invalid wheel filename" error during setup and the missing llama.dll import failure at startup, both fixed by reinstalling the package built for your backend. If generation is slow, raise gpu_layers. If the model stays in VRAM and your next node OOMs, you forgot the unload checkbox. Keep it simple.

    CategoryVLM Nodes/LLM

    Inputs (15)

    NameTypeDefaultDescription
    ckpt_nameCOMBO0 options:
    max_ctxINT4096128–131072
    gpu_layersINT-1-1–1000
    n_threadsINT121–256
    promptSTRING
    temperatureFLOAT0.100–2
    unloadBOOLEANfalse
    chat_formatoptSTRING
    n_batchoptINT5121–8192Logical prompt batch. Lower this if context loading runs out of memory.
    n_ubatchoptINT5121–8192Physical prompt micro-batch. Never exceeds n_batch.
    flash_attentionoptCOMBOAutoAuto enables llama.cpp flash attention only with accelerator offload and safely retries without it when unsupported.
    use_mmapoptBOOLEANtrueMemory-map GGUF weights when the installed backend supports it.
    split_modeoptCOMBOLayerHow llama.cpp distributes tensors across multiple accelerators.
    main_gpuoptINT00–31
    tensor_splitoptSTRINGOptional comma-separated accelerator proportions, for example 0.6,0.4.

    Outputs (1)

    NameTypeDescription
    STRINGSTRING