Prompt Benchmark Text Model
A One-Shot Ollama Prompt Rewriter for When You Don't Want a Conversation
- rating
- enhanced_prompt
- model
- text
PBTextModel is the stateless sibling in the Prompt Bench pack: you feed it a rating, it asks your local Ollama model to rewrite the prompt once, and it's done. No session memory, no conversation to manage - which is exactly what you want when you're treating a prompt rewrite as a single clean step rather than a back-and-forth.
What it is
Part of inflamously/comfyui_prompt_bench, a small local-LLM helper. The pitch: rate an image with PBRating, this node sends that rating plus your system prompt to Ollama, and the returned text is an improved prompt ready to feed back into your sampler. It's the "local LLM as prompt enhancer" pattern that's become routine in ComfyUI workflows - everything stays on your machine, no API key, no subscription.
How it works
Under the hood it's a single HTTP call. The node builds a text prompt out of your system prompt, the rating context (serialized as JSON), and your optional extra text, then hits Ollama's /api/generate endpoint (the raw completion route, not the chat one) with streaming off. No message history is kept or sent - each run is independent, which makes the behavior fully reproducible for a given rating and seed.
One quirk worth knowing: the pack's model_basic.py returns the same generated string on both the enhanced_prompt and text outputs. They're aliases, not different things. Wire either one into your text encode node.
Inputs and outputs
- system_prompt (
STRING, multiline) - instruction to the model. This is your real lever: "Rewrite with more specificity, keep the subject" does most of the work. - rating (
RATING) - the structured feedback from PBRating. Required. - model (
COMBO) - Ollama model name. The list is fetched live from your local Ollama server, and there's a refresh button on the widget for when you pull a new model mid-session. - text (
STRING, optional) - extra user input to fold in.
Outputs: enhanced_prompt (STRING), model (STRING), text (STRING). Feed enhanced_prompt into your CLIP Text Encode (or however your checkpoint wants a prompt - for LLM-encoder models like Flux you can pass the text straight through).
Install
The pack installs as one unit - ComfyUI Manager, search "Prompt Bench", or:
cd ComfyUI/custom_nodes
git clone https://github.com/inflamously/comfyui_prompt_bench
Then restart. No pip dependencies (the pack is stdlib plus ComfyUI's own aiohttp), and it downloads no models itself. What you do need is an Ollama server running at http://127.0.0.1:11434 with at least one model pulled:
ollama pull llama3.2
Gotchas
- Empty model dropdown = Ollama isn't running (or the list needs a refresh). The model list comes from
http://127.0.0.1:11434/api/tags; if that endpoint is down you get an empty combo, and running the node throws "Ollama generation failed." - Output is raw LLM text. Because it uses
/api/generaterather than the chat endpoint, you don't get chat scaffolding like "Here is your enhanced prompt:" leaking into the result - but you should still eyeball it before it hits your sampler, since the model can drift from your intent. That's the standing weakness of every local enhancer, not this pack specifically. - No memory. If you want the rewrite to build on the previous rewrite, you need PBTextModelChat with its session seed - that's the iterative loop; this node is the one-shot version.
For a quick "rate and improve once" step, PBTextModel is the lean choice. When you want to chase a prompt across several generations, reach for its chat sibling.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| system_prompt | STRING | System prompt applied to the Ollama model. | |
| rating | RATING | — | |
| model | COMBO | Ollama model name. Refresh to fetch the current local model list. | |
| textopt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| enhanced_prompt | STRING | — |
| model | STRING | — |
| text | STRING | — |