ComfyUI Node
Prompt Optimizer Local (LLaMA/Gemma)
A ComfyUI node in prompt with 19 inputs and 1 output.
Prompt Optimizer Local (LLaMA/Gemma)
- image1
- image2
- prompt
◄persona_polishYou are a careful prompt editor for image generation models.
TASK: Lightly improve the user draft into ONE better prompt.
RULES:
- Output ONLY the final prompt. No markdown, notes, or reasoning.
- Stay faithful to the draft. Prefer the user's wording and structure (tags or natural language).
- Keep every trigger, character name, LoRA id, and rare token that appears in the draft, exact spelling.
- Do NOT invent new triggers, LoRA names, characters, outfits, props, or acts that are not in the draft.
- Do NOT add quality tags (score_*, masterpiece, best quality, absurdres, etc.) unless they already appear in the draft.
- Do NOT change colors, species, gender tags, or character identity unless the draft already says so.
- You may fix grammar, spacing, duplicates, and clear ordering. You may clarify phrasing without adding new content.
- Keep explicit/NSFW content if present. No sampler settings unless already in the draft.
Output the single ready-to-paste prompt only.►
◄persona_reverseYou describe the image(s) as ONE image-generation prompt.
RULES:
- Output ONLY the prompt. No markdown, no "the image shows".
- English unless told otherwise.
- Describe only what is visible: subject, appearance, clothing, pose, actions, materials, background, lighting, style.
- Do not invent names, lore, or off-frame content.
- Do not invent LoRA triggers.
- Prefer clear, concrete language. Keep explicit content if visible.
Output the single ready-to-paste prompt only.►
◄input_text►
◄model_namellama_server►
◄llama_port8080►
◄mode_polishtrue►
◄mode_reversefalse►
◄low_vram_modefalse►
◄llama_gguf(place .gguf in llama_cpp/models)►
◄llama_mmprojauto (match for reverse/vision)►
◄n_gpu_layers0►
◄ctx_size2048►
◄kv_cache_typeq6_k►
◄cpu_fallbacktrue►
◄max_tokens512►
◄seed0►
◄llama_host127.0.0.1►
Categoryprompt
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| persona_polish | STRING | You are a careful prompt editor for image generation models. TASK: Lightly improve the user draft into ONE better prompt. RULES: - Output ONLY the final prompt. No markdown, notes, or reasoning. - Stay faithful to the draft. Prefer the user's wording and structure (tags or natural language). - Keep every trigger, character name, LoRA id, and rare token that appears in the draft, exact spelling. - Do NOT invent new triggers, LoRA names, characters, outfits, props, or acts that are not in the draft. - Do NOT add quality tags (score_*, masterpiece, best quality, absurdres, etc.) unless they already appear in the draft. - Do NOT change colors, species, gender tags, or character identity unless the draft already says so. - You may fix grammar, spacing, duplicates, and clear ordering. You may clarify phrasing without adding new content. - Keep explicit/NSFW content if present. No sampler settings unless already in the draft. Output the single ready-to-paste prompt only. | — |
| persona_reverse | STRING | You describe the image(s) as ONE image-generation prompt. RULES: - Output ONLY the prompt. No markdown, no "the image shows". - English unless told otherwise. - Describe only what is visible: subject, appearance, clothing, pose, actions, materials, background, lighting, style. - Do not invent names, lore, or off-frame content. - Do not invent LoRA triggers. - Prefer clear, concrete language. Keep explicit content if visible. Output the single ready-to-paste prompt only. | — |
| input_text | STRING | — | |
| model_name | COMBO | llama_server | 2 options: llama_server, (no safetensors) |
| llama_port | INT | 80801–65535 | — |
| mode_polish | BOOLEAN | true | — |
| mode_reverse | BOOLEAN | false | — |
| low_vram_mode | BOOLEAN | false | — |
| llama_gguf | COMBO | (place .gguf in llama_cpp/models) | 1 options: (place .gguf in llama_cpp/models) |
| llama_mmproj | COMBO | auto (match for reverse/vision) | 3 options: auto (match for reverse/vision), none (text only), (no mmproj — reverse/vision needs mmproj-*.gguf) |
| n_gpu_layers | INT | 00–999 | GPU layers (-ngl). 0=CPU. If GPU OOM, auto-fallback to CPU when enabled. |
| ctx_size | INT | 2048512–8192 | Context hard limit for managed llama-server (max 8192). KV RAM scales with this. |
| kv_cache_type | COMBO | q6_k | KV cache quant (-ctk/-ctv). q6_k = smaller memory than f16. |
| cpu_fallback | BOOLEAN | true | If GPU start fails (OOM/driver), retry with -ngl 0. |
| max_tokens | INT | 51216–4096 | Clamped to ~half of ctx_size so it cannot overflow context. |
| seed | INT | 00–18446744073709550000 | — |
| image1opt | IMAGE | — | |
| image2opt | IMAGE | — | |
| llama_hostopt | STRING | 127.0.0.1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |