Prompt Benchmark Text Model Chat
PBTextModelChat Keeps the Loop Alive — One Seed, One Conversation With Your Ollama Model
- rating
- enhanced_prompt
- model
- text
- chat
The whole point of Prompt Bench is iteration: generate, look, rate, regenerate - and have the prompt improve, not just change. PBTextModelChat is the engine of that loop. Unlike its one-shot sibling PBTextModel, it keeps a running conversation with your local Ollama model, keyed by a session seed, so each new rating nudges the prompt forward instead of starting from scratch. Same seed, same conversation. Change the seed, fresh start.
What it is
The flagship node of inflamously/comfyui_prompt_bench. Every run, it takes your rating, folds it into the context of the whole conversation so far, asks Ollama for a revised prompt, and appends the exchange to the session. The chat output carries the full history, which is what PBListChatView renders for you. The whole flow from the README:
- Rate the latest image with PBRating.
- Feed the rating into this node.
- It asks Ollama for a better prompt, building on the session history.
- Send the result to PBStore to log it, and to PBListChatView to read the conversation.
How it works
The pack keeps a module-level dictionary _SESSION_CHATS, keyed by your session_seed. On each run it grabs the previous assistant reply (if any), assembles a message from that prior prompt, your system prompt, the rating converted into structured feedback, and your optional extra text - then posts the entire history to Ollama's /api/chat endpoint with streaming off, and appends the assistant's reply. The feedback builder is the clever part: scores of 1–2 become explicit rewrite rules ("explicitly define a single primary light source"), and priority is always "fix the lowest-scoring criteria first."
The inputs that matter
- session_seed (
INT) - the conversation's identity. This is the one to understand: reuse it to continue the same chat, change it to start a new one. It's a seed in the ComfyUI sense - you control the session by picking the number. - system_prompt (
STRING, multiline) - the standing instruction for the model. Set it once per session; it only gets applied when a session starts. - rating (
RATING) - structured feedback from PBRating. This is the loop's input each pass. - model (
COMBO) - Ollama model name, fetched live from your local server with a refresh button. - text (
STRING, optional) - extra input, folded into the request.
Outputs: enhanced_prompt (the latest revision - wire it to your text encode), model, text, and chat (the session history, for PBListChatView or PBStore).
Install
One pack, all five nodes - ComfyUI Manager, search "Prompt Bench", or:
cd ComfyUI/custom_nodes
git clone https://github.com/inflamously/comfyui_prompt_bench
Restart. No pip install, no model downloads from the pack. You need Ollama running locally at http://127.0.0.1:11434 with a model pulled (ollama pull llama3.2 works fine for this job), and the model dropdown will list whatever your server has.
The gotchas that actually bite
- Memory is RAM, not disk. Chat history lives in the Python module while ComfyUI runs. Restart ComfyUI and every session is gone - the seed number won't resurrect it. If the conversation matters, save it with PBStore before you restart. This is the one that's bitten everyone, and the README says it plainly.
- Context grows every run. Because the full history is re-sent each time, long sessions get slow and start drifting. When the model starts repeating itself, that's your cue to change the seed and start a fresh thread.
- The node re-executes every run (the pack marks it changed with a UUID each call), so it always costs an Ollama round-trip, even if you didn't touch it.
- Empty model list means Ollama isn't reachable at
127.0.0.1:11434, or you need to hit refresh.
It's a young pack - effectively no community footprint yet - so the source is small enough to read before you trust it, which is the right habit for any local-LLM node. But the pattern is sound: a small, uncensored local model rewriting your prompt against a rubric is one of the few genuinely useful LLM jobs in a ComfyUI graph. If you're chasing a prompt across generations, this is the node the rest of the pack exists to feed.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| session_seed | INT | 00–18446744073709550000 | Session key. Reuse to continue chat; change to start a new session. |
| 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 (4)
| Name | Type | Description |
|---|---|---|
| enhanced_prompt | STRING | — |
| model | STRING | — |
| text | STRING | — |
| chat | CHAT | — |