Prompt Enhance (MRLN)
An LLM rewrite that can't lose your trigger words
- prompt
- report
LLM prompt-enhancers are everywhere now, and the community has learned their failure modes the hard way: they add detail you never asked for, they emit chat instead of a clean prompt, and they eat your trigger words. Prompt Enhance (MRLN) is built around those specific failures rather than pretending they don't exist. It's the optional LLM rewrite stage of this pack, and it takes exactly ONE wire - the llm output of the Prompt Template node.
That wire is the interesting part. It doesn't just carry the rendered prompt; it carries the selected profile's system prompt - which tells the LLM how the target image model wants its prompts, prose for KREA/FLUX, tags for SDXL/Pony - plus the LoRA trigger words riding the prompt. Those trigger words are protected: demanded verbatim in the system prompt, verified after the rewrite, and any span the model dropped or mutated is re-injected. An enhancement can never disarm a LoRA, which is more than most enhancers on the market can claim.
How it works
Backends are local Ollama / LM Studio (URLs configured in the Composer's Settings tab) or cloud Anthropic / OpenAI / Gemini / OpenRouter (API keys stored server-side, never in node widgets - in the browser, only keyed backends are even listed). The rewrite is deterministic per seed where the backend supports it, cached per input so re-queues never re-call, and a failing backend passes the original prompt through instead of killing the render - switchable with on_error.
Ollama gets special treatment: free_vram: after call (the default) unloads the LLM immediately so the diffusion model gets the GPU back. On a single card that's the difference between an enhancer you can live with and one that OOMs every render.
The inputs that matter
backendandmodel-modelis required for Ollama; LM Studio falls back to its loaded model; cloud backends fall back to a sensible default.temperature- keep it low. 0.2 is the default, and it's the right number for faithful rewrites.free_vram-after callis the one-GPU recommendation.keep 5mif you're iterating hard,always keeponly on a second GPU.on_error-pass throughmeans a dead backend never kills a render;raisestops the queue loudly instead.
There are two optional inputs worth knowing: prompt enhances any other STRING and wins when both it and llm are wired (use it on text from any node), and system overrides the profile's system prompt when you want to steer the rewrite yourself.
Outputs: prompt - the enhanced prompt, or the original on pass-through - and report, which tells you backend, model, seed, cache/VRAM state, or the pass-through reason.
The honest take
The README says it plainly: this node is best on thin hand-typed prompts and tag→prose conversion - the curated library usually renders better un-rewritten. So it's not a "make everything better" button. It's for when you have a rough idea you want expanded for a specific target model, or a tag list you want turned into prose for a FLUX/KREA-class model. The max_tokens handling is a nice touch: a keep-everything rewrite can never be shorter than its input, so the cap auto-raises rather than silently truncating the tail of a long prompt (the report notes when that happens).
How to install it
Same pack, same note: ComfyUI Manager can't find this pack yet - the registry flagged v0.1.1 on six severity: info matches (including the LLM backend calls, which is part of why it's flagged), so it's absent from Manager's search. Review hiccup, not a broken node. Manual install:
cd ComfyUI/custom_nodes
git clone https://github.com/master-merlin/comfyui-mrln-nodes ComfyUI-MRLN-Nodes
Restart ComfyUI. No extra Python dependencies - requirements.txt is deliberately empty. You'll want Ollama running if you use the local path, but that's a separate install.
Common issues
- The render works but the prompt is unchanged - backend unreachable with
on_error: pass through. Check thereportoutput; it names the reason. - VRAM contention on one GPU - Ollama and the diffusion model fighting over the card. Set
free_vramtoafter calland don't keep the LLM resident. - "Model name required" - Ollama needs a real model id like
gemma3:12b; it won't guess.
A dead backend never breaks a render by default, which is the right default - but it also means "it silently did nothing" is the failure mode to watch for.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| backend | COMBO | LLM backend. Local: Ollama / LM Studio (URLs in the Composer's Settings tab). Cloud backends need an API key stored there — in the browser only keyed ones are listed. | |
| model | STRING | Model name, e.g. 'gemma3:12b' (Ollama) or an LM Studio model id. Required for Ollama; LM Studio falls back to its loaded model; cloud backends fall back to a sensible default. In the browser this becomes a dropdown of installed models plus pull suggestions Ollama downloads on pick. | |
| temperature | FLOAT | 0.200–2 | Sampling temperature — keep low for faithful rewrites. |
| seed | INT | 00–18446744073709550000 | LLM seed for reproducible rewrites (where the backend supports it). 0 derives a stable seed from the prompt + system text, so identical inputs enhance identically. |
| max_tokens | INT | 51216–8192 | Generation cap for the rewrite. Auto-raised when the input is longer than the cap allows — a keep-everything rewrite can never be shorter than its input (the report notes when this happens). |
| timeout | INT | 605–600 | Seconds to wait for the backend before giving up. |
| free_vram | COMBO | Ollama keep_alive: 'after call' unloads the LLM immediately so the diffusion model gets the VRAM back (recommended on one GPU); 'keep 5m' keeps it warm for rapid iteration; 'always keep' pins it loaded until Ollama stops (second GPU / big VRAM). LM Studio manages its own lifetime. | |
| on_error | COMBO | When the backend is unreachable or errors: pass the ORIGINAL prompt through (render never dies, report says why) or raise and stop the queue. | |
| llmopt | STRING | The Prompt Template node's llm output — the single wire: {target, prompt, protect, system, params}. It carries the rendered prompt, the profile's system prompt, and the LoRA trigger words that are enforced verbatim (dropped ones are re-injected). | |
| promptopt | STRING | Optional override: enhance this STRING instead of the prompt carried inside the llm input (wins when both are wired). Use it to enhance text from any other node. | |
| systemopt | STRING | System prompt override. Empty = use the llm input's system prompt; set both and this one wins (template guides, user decides). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | The enhanced prompt (or the original on pass-through). |
| report | STRING | What happened: backend, model, seed, cache/VRAM state, or the pass-through reason. |