πΈ LLM Prompt Refiner (Ollama)
Turn a tag soup into fluent natural language with a local LLM β no hallucination allowed
- prompt
- debug
There are two ways to get a fluent natural-language prompt for an image generator: hand-write it, or let a small local LLM do the translating. πΈ LLM Prompt Refiner (Ollama) is the second - it takes a tag-based or mixed prompt ("danbooru-style tags" in the source's words) and rewrites it as one flowing sentence, through a model running on your own machine via Ollama. No cloud API, no key, no per-image cost.
The reason this class of node exists at all is worth understanding, because it's genuinely architectural. The KB's LLM-in-ComfyUI doc makes the point: if your checkpoint's text encoder is itself a language model reading an instruction - which is true of Anima (Qwen3 encoder), Z-Image, Klein, and others - then having a second language model write that instruction is translation between two things that speak the same language. The wildcards and comma-tag conventions that worked on SDXL don't always sing on an LLM-encoded model; a fluent sentence often reads better.
But the whole value hinges on one discipline: the LLM must not invent things. An unconstrained enhancer is a liability - it adds adjectives, props, and motivations you never asked for, and suddenly "1girl, red_hair" becomes "a mysterious girl with flowing crimson locks in a dark alley." The KB doc calls this subject drift, the number-two failure mode of prompt-enhancer nodes. The Refiner's system prompt is a wall of rules against exactly that: every word must be traceable to an input tag, unknown tags get passed through as plain text rather than guessed, colours must appear verbatim, hair must be written as "[length] [colour] hair", character names lead the sentence, and metadata tags like _(series) get dropped entirely. It's the rare LLM prompt you can audit.
Inputs and what they do:
tags- the tag prompt to refine. Wire from a πΈ Library or prompt node.model- Ollama model name, defaultqwen3:8b. Must be pulled first:ollama pull qwen3:8b.seed- same seed + same tags = same output (default 0).temperature- 0 is literal/consistent, higher is more creative; default 0.3.max_tokens- output length cap, default 220.prepend_tags- on by default, and the smart bit: it prepends the original tags before the natural-language prose, so your CLIP encoder gets both the precise tag signals and the fluent context. Turn it off if your encoder only wants prose.prepend/append- free-text slots for quality tags, LoRA triggers, or style cues to wrap around the output.
Outputs: prompt (the refined NL text) and debug (cleaned input, model settings, raw LLM output). Requires Ollama running locally at localhost:11434.
The positioning against its sibling is important and the source is explicit: this is a whole-scene rewrite node. πΈ Tag to Description extracts appearance traits for character-builder workflows. Don't grab the wrong one for the job.
Installing it
Install the pack, then Ollama:
- Pack: ComfyUI Manager β search Frog Node Pack β install, or
cd ComfyUI/custom_nodes && git clone https://github.com/RabbitThatIsPink/FrogNodePack, restart, hard-refresh. - Ollama: install from ollama.com and make sure it's running (
ollama serve). - Model:
ollama pull qwen3:8b(or whatever you set in themodelfield).
No pip dependencies - the node talks to Ollama over plain HTTP (/api/generate), which is why there's nothing to install on the ComfyUI side.
Common issues
The big three: "connection refused"-style errors mean Ollama isn't running or isn't on localhost:11434. "model not found" means you set a model name that isn't pulled - run ollama pull <name>. And output that's not prose (chat preamble like "Here is your prompt:") is the classic dirty-output problem the KB warns about; the node's system prompt tries to suppress it, but if it leaks through, lower temperature and check your model - a big instruct-tuned model is more prone to chatting. Also: this node needs a local LLM that is comfortably uncensored for anime tags; if your model refuses, that's a model-choice problem, not a node bug - the community's standard answer is an abliterated or uncensored Qwen/Llama (the KB covers this exact pattern).
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| tags | STRING | Tag prompt input. Wire from a πΈ Library or prompt node. | |
| model | STRING | qwen3:8b | Ollama model name. Must be pulled via 'ollama pull <name>'. |
| seed | INT | 00β4294967295 | Seed for reproducibility. Same seed + same tags = same output. |
| temperature | FLOAT | 0.300β2 | 0 = very literal/consistent. Higher = more creative/varied. |
| max_tokens | INT | 22040β600 | Maximum output length in tokens. |
| prepend_tags | BOOLEAN | true | Prepend the original tags before the NL prose. Gives the CLIP encoder both tag signals and fluent context. |
| prependopt | STRING | Optional text to prepend to the output (e.g. quality tags, LoRA triggers). Appended before the refined prompt. | |
| appendopt | STRING | Optional text to append after the refined prompt (e.g. style tags, negative-space cues). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | Refined natural-language prompt, ready for your text encoder. |
| debug | STRING | Debug info: cleaned input, model settings, and raw LLM output. |