Nodes/Frog Node Pack/🐸 LLM Prompt Refiner (Ollama)
ComfyUI Node

🐸 LLM Prompt Refiner (Ollama)

Turn a tag soup into fluent natural language with a local LLM β€” no hallucination allowed

By RabbitThatIsPinkΒ·Created 3 months agoΒ·Updated 24 days agoΒ· 1
🐸 LLM Prompt Refiner (Ollama)
    • prompt
    • debug
    β—„tagsβ€”β–Ί
    β—„modelqwen3:8bβ–Ί
    β—„seed0β–Ί
    β—„temperature0.30β–Ί
    β—„max_tokens220β–Ί
    β—„prepend_tagstrueβ–Ί
    β—„prependβ€”β–Ί
    β—„appendβ€”β–Ί

    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, default qwen3: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:

    1. Pack: ComfyUI Manager β†’ search Frog Node Pack β†’ install, or cd ComfyUI/custom_nodes && git clone https://github.com/RabbitThatIsPink/FrogNodePack, restart, hard-refresh.
    2. Ollama: install from ollama.com and make sure it's running (ollama serve).
    3. Model: ollama pull qwen3:8b (or whatever you set in the model field).

    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).

    Category🐸 Node Pack/Utility

    Inputs (8)

    NameTypeDefaultDescription
    tagsSTRINGTag prompt input. Wire from a 🐸 Library or prompt node.
    modelSTRINGqwen3:8bOllama model name. Must be pulled via 'ollama pull <name>'.
    seedINT00–4294967295Seed for reproducibility. Same seed + same tags = same output.
    temperatureFLOAT0.300–20 = very literal/consistent. Higher = more creative/varied.
    max_tokensINT22040–600Maximum output length in tokens.
    prepend_tagsBOOLEANtruePrepend the original tags before the NL prose. Gives the CLIP encoder both tag signals and fluent context.
    prependoptSTRINGOptional text to prepend to the output (e.g. quality tags, LoRA triggers). Appended before the refined prompt.
    appendoptSTRINGOptional text to append after the refined prompt (e.g. style tags, negative-space cues).

    Outputs (2)

    NameTypeDescription
    promptSTRINGRefined natural-language prompt, ready for your text encoder.
    debugSTRINGDebug info: cleaned input, model settings, and raw LLM output.