Nodes/comfyui-mrln-nodes/Prompt Enhance (MRLN)
ComfyUI Node

Prompt Enhance (MRLN)

Rewrite a prompt with an LLM under a target-model system prompt. ONE wire does it: the Prompt Template node's llm output carries the rendered prompt plus 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, ...). The optional prompt input enhances any other STRING instead and wins when both are wired. Backends: local Ollama / LM Studio (URLs in the Composer's Settings tab) or cloud Anthropic / OpenAI / Gemini / OpenRouter (API keys stored there, server-side only — never in widgets). 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). Ollama frees its VRAM right after the call by default so the sampler gets the GPU back. LoRA trigger words riding the llm wire are PROTECTED: they are demanded verbatim in the system prompt and verified after the rewrite — any span the LLM dropped or mutated is re-injected, so an enhancement can never disarm a LoRA.

By master-merlin·Created 16 days ago·Updated 7 days ago· 2
Prompt Enhance (MRLN)
    • prompt
    • report
    backend
    model
    temperature0.20
    seed0
    max_tokens512
    timeout60
    free_vram
    on_error
    llm
    prompt
    system
    CategoryMRLN/prompt

    Inputs (11)

    NameTypeDefaultDescription
    backendCOMBOLLM 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.
    modelSTRINGModel 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.
    temperatureFLOAT0.200–2Sampling temperature — keep low for faithful rewrites.
    seedINT00–18446744073709550000LLM 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_tokensINT51216–8192Generation 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).
    timeoutINT605–600Seconds to wait for the backend before giving up.
    free_vramCOMBOOllama 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_errorCOMBOWhen the backend is unreachable or errors: pass the ORIGINAL prompt through (render never dies, report says why) or raise and stop the queue.
    llmoptSTRINGThe 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).
    promptoptSTRINGOptional 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.
    systemoptSTRINGSystem prompt override. Empty = use the llm input's system prompt; set both and this one wins (template guides, user decides).

    Outputs (2)

    NameTypeDescription
    promptSTRINGThe enhanced prompt (or the original on pass-through).
    reportSTRINGWhat happened: backend, model, seed, cache/VRAM state, or the pass-through reason.