Nodes/prompt-generator/Prompt Generator
ComfyUI Node

Prompt Generator

This Node Writes Your Prompts With a Tiny Local Language Model — No API Key, No Cloud

By alpertunga-bile·Created 3 years ago·Updated about a year ago· 116
Prompt Generator
  • clip
  • gen_prompt
  • gen_prompt_str
model_name
accelerate
quantize
token_healing
prompt((masterpiece, best quality, ultra detailed)), illustration, digital art, 1girl, solo, ((stunningly beautiful)),
seed0
lock
random_index
index1
cfg1.0
min_new_tokens20
max_new_tokens50
do_sample
early_stopping
num_beams5
num_beam_groups1
diversity_penalty0.0
temperature1.0
top_k50
top_p1.0
repetition_penalty1.0
no_repeat_ngram_size0
remove_invalid_values
self_recursive
recursive_level0
preprocess_mode

Most "AI prompt enhancer" nodes these days are thin wrappers around an API - you paste in a seed idea, it phones a cloud LLM, and you hope the key isn't being mined. This one is the opposite. Prompt Generator runs a real text-generation model on your own GPU, fully offline, with no key and no network call. The catch is the model: the pretrained ones are ~500MB–1.3GB finetunes of distilgpt2 and bloom-560m, and the README still marks the flagship versions "Training In Process." You're getting a 2023-era toy, not ChatGPT. But for its niche it's genuinely handy.

That niche: writing tag-style prompts for CLIP-encoded checkpoints (SD 1.5 / SDXL / Illustrious lineage). It was trained on a dataset of female-character prompts scraped from CivitAI, so it has a type - anime girl prompts with masterpiece, best quality flavor. If your workflow is photoreal or a 2026 LLM-encoded model, this is the wrong tool; those encoders don't read the tag vocabulary it emits. It's the local, open-source ancestor of the prompt-generator node wave that the community eventually standardized on LLM-assisted prompting for.

How it works

The node loads a HuggingFace causal LM from models/prompt_generators, runs it through transformers.generate(), and - this is the smart part - generates five candidate prompts in one pass. You pick one with index, or let random_index roll for you. The winner gets tokenized through the CLIP input you wired in, which is why the first output is ready-made CONDITIONING rather than raw text.

Two outputs:

  • gen_prompt (CONDITIONING) - wire this straight into your sampler's positive input. The CLIP you feed in determines compatibility, so use the same CLIP your checkpoint uses.
  • gen_prompt_str (STRING) - the raw generated text, for inspecting, logging, or routing into a text box.

Every run is logged to ComfyUI/generated_prompts/<date>.txt and printed to the terminal, which is a lot more traceable than most prompt nodes manage.

The inputs that actually matter

Ignore most of the 28 inputs. The defaults are sane. What you'll touch:

  • model_name - the dropdown of model folders in models/prompt_generators. The README's Google Drive link has the pretrained ones.
  • prompt - your seed text. This is where you say what you actually want ("cyberpunk street, night, neon"); the model completes it.
  • do_sample - enable for random results, disable for deterministic. Set temperature / top_p / top_k above 1 / below 1 / below 50-ish for more variety.
  • index / random_index / lock - the batch-selection trio. lock skips regeneration entirely and lets you flip through the last five outputs for free. That's the feature I'd keep.

One trap: cfg here is the text model's guidance_scale, not image CFG. Leave it at 1.0 unless you know why you're raising it.

The recursive options (self_recursive, recursive_level) chain generations - output becomes the next input, growing the prompt each pass. Novelty, honestly. Turn it on once, giggle, turn it off.

Installing it

ComfyUI Manager (search "prompt-generator") installs the Python deps for you. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/alpertunga-bile/prompt-generator-comfyui
cd prompt-generator-comfyui
pip install -r requirements.txt

Then download a model from the README's Drive link and unzip it as a folder into ComfyUI/models/prompt_generators/, and restart ComfyUI. Watch the dependency list before you click install: transformers, optimum, optimum[onnxruntime-gpu], peft, plus bitsandbytes/triton on Linux or optimum-quanto on Windows. For what is effectively a tiny LM, that's a lot of machinery - overkill, but it's what makes the quantize dropdown work (none/int8/int4, with bitsandbytes preferred on Linux).

Where people get burned

  • Model must be a folder - a bare pytorch_model.bin in the wrong place won't load. The node validates the path and the README warns about exactly this.
  • Empty model_name dropdown - you added the folder but ComfyUI didn't refresh. Restart.
  • Weird generation after updating - transformers/optimum version drift. pip install --upgrade -r requirements.txt fixes most of it.
  • Stuck quantize values - saved workflows carry the old node's config. Delete the node and re-add it.

Two honest caveats. The pretrained models come from the author's Google Drive, not the HF hub - fine, but you're loading third-party weights, and with the LLMVISION malware history you should only install nodes you trust and run models from sources you trust. This node itself is fully local and doesn't phone home. And temper expectations: a 560M model trained on one CivitAI scrape will not write you a masterpiece. It writes competent tag soup you'd otherwise spend ten minutes on - which is exactly the job.

CategoryPrompt Generator

Inputs (27)

NameTypeDefaultDescription
clipCLIP
model_nameCOMBO0 options:
accelerateCOMBO2 options: enable, disable
quantizeCOMBO3 options: none, int8, int4
token_healingCOMBO2 options: disable, enable
promptSTRING((masterpiece, best quality, ultra detailed)), illustration, digital art, 1girl, solo, ((stunningly beautiful)),
seedINT00–18446744073709550000
lockCOMBO2 options: disable, enable
random_indexCOMBO2 options: enable, disable
indexINT11–5
cfgFLOAT1.00–1000000
min_new_tokensINT200–18446744073709550000
max_new_tokensINT5035–18446744073709550000
do_sampleCOMBO2 options: disable, enable
early_stoppingCOMBO2 options: enable, disable
num_beamsINT51–18446744073709550000
num_beam_groupsINT10–18446744073709550000
diversity_penaltyFLOAT0.00–1000000
temperatureFLOAT1.00–1000000
top_kINT500–18446744073709550000
top_pFLOAT1.00–1000000
repetition_penaltyFLOAT1.01–1000000
no_repeat_ngram_sizeINT00–18446744073709550000
remove_invalid_valuesCOMBO2 options: disable, enable
self_recursiveCOMBO2 options: disable, enable
recursive_levelINT00–18446744073709550000
preprocess_modeCOMBO3 options: exact_keyword, exact_prompt, none

Outputs (2)

NameTypeDescription
gen_promptCONDITIONING
gen_prompt_strSTRING