Nodes/VLM_nodes/LLM Prompt Generator
ComfyUI Node Runs on cloud

LLM Prompt Generator

Turn a thought into a usable image prompt

By gokayfem·Created 3 years ago·Updated 17 days ago· 587
LLM Prompt Generator
  • model
  • STRING
prompt
max_tokens512
temperature0.20
top_p0.95
top_k40
frequency_penalty0.00
presence_penalty0.00
repeat_penalty1.10

Stuck staring at an empty prompt box? The LLMPromptGenerator node in gokayfem's VLM Nodes is the pack's text-to-prompt node: you give it a rough idea - "a neon city in the rain, Blade Runner vibes" - and a local LLM running in the same pack turns it into a structured, image-model-friendly prompt. It's the same idea as a thousand web tools, except it runs entirely on your machine and plugs straight into your graph.

What it's for

Any time you want a seed prompt and can't be bothered to compose one, or you want to remix an existing prompt through the lens of a language model. It pairs especially well with the pack's other nodes: feed it a VLM caption ("a red sports car parked outside a diner at dusk") and get back a fleshed-out prompt with lighting, lens, and mood terms added.

How it works

This is a pure LLM node - no image involved. You give it a model handle (a CUSTOM output from the pack's LLMLoader) and it sends your prompt through that GGUF model with a system message tuned for prompt generation, returning the model's reply as a STRING. The author recommends small prompt-specific GGUFs for this job: Qwen 1.8B Stable Diffusion Prompt or IF prompt MKR - a dedicated 1.8B prompt model beats a 7B general model at this one task, and it's faster.

The inputs that matter

  • prompt - your starting idea. More specific in, more useful out.
  • model - required CUSTOM handle from LLMLoader. This is the one that trips people up; the node has no model menu of its own.
  • temperature - default 0.2, and the defaults are low on purpose. This is a "consistency over creativity" node; if you want wilder variations, crank temperature and watch the output get looser.
  • max_tokens - 512 default is fine for a prompt; raise it if the model truncates mid-sentence.

The rest - top_p, top_k, the two penalties, repeat_penalty - are the usual LLM sampling controls. Leave them alone until something looks wrong (like the model looping the same phrase; that's when you nudge repeat_penalty up from 1.1).

Output

A single STRING. Wire it into a CLIP Text Encode node and generate. You'll often want a ViewText node in between so you can see (and copy) what the model produced before you commit it to the sampler.

Install and gotchas

Same pack install as everything here:

cd ComfyUI/custom_nodes
git clone https://github.com/gokayfem/ComfyUI_VLM_nodes
python -m pip install -r ComfyUI/custom_nodes/ComfyUI_VLM_nodes/requirements.txt

Two real gotchas. First, this node needs llama.cpp, and llama.cpp installs are the pack's #1 pain point: install llama-cpp-python built for your backend (CUDA on NVIDIA, Metal on Mac, etc.) rather than letting it fall back to a CPU build - the README points at the official install instructions for exactly this. Second, don't forget the model file has to live in models/LLavacheckpoints (any GGUF works). And if the output comes back wrapped in chat-y prose instead of a clean prompt, you've loaded a general chat model - the dedicated prompt GGUFs above don't do that.

CategoryVLM Nodes/LLM

Inputs (9)

NameTypeDefaultDescription
promptSTRING
modelCUSTOM
max_tokensINT5121–8192
temperatureFLOAT0.200–2
top_pFLOAT0.950–1
top_kINT40
frequency_penaltyFLOAT0.00-2–2
presence_penaltyFLOAT0.00-2–2
repeat_penaltyFLOAT1.100–2

Outputs (1)

NameTypeDescription
STRINGSTRING