Nodes/Symbiotica/NS Prompt Tuner Load
ComfyUI Node

NS Prompt Tuner Load

A System Prompt That Improves Itself, One Queue Run at a Time

By symbiotica-ai·Created 6 months ago·Updated about 12 hours ago· 2
NS Prompt Tuner Load
    • system_prompt
    • refiner_context
    • status
    tuner_iddefault
    guidance
    version_override-1
    max_iterations12
    initial_prompt

    LLM prompt-rewriters are a blessing and a curse. They turn your rough idea into a strong image prompt - and then they refuse to stop. Every run is a slightly different prompt, so "find the best version" becomes a manual chase where you write down what worked. NS Prompt Tuner Load is the head of a loop that does that chasing for you: it serves the current best system prompt, and each queue run refines it against a design reference, saves the improved version, and the next run picks it up. Turn on Auto-Queue and the loop tunes itself.

    It's the more interesting half of a two-node system, so read this alongside NS Prompt Tuner Save. Load is what you put at the top of the graph; Save is the tail that records each improvement.

    How it works

    Each queue run is one iteration of a tuning loop. Load serves the current best prompt from a state file at output/prompt_tuner/<tuner_id>.json - first run of a new tuner_id seeds v0 from your initial_prompt. You wire that system_prompt into your generator LLM (this pack's NS LLM Chat, or any LLM node), it produces an image prompt, your sampler renders it, and a refiner LLM compares the result against your design reference. Save parses the refiner's CRITIQUE / VERDICT / PROMPT … END PROMPT reply and appends the improved prompt as version v+1. Next run serves that. Auto-Queue = self-improving prompt.

    The node's cache fingerprint is the state file, so each saved version actually drives a fresh run instead of serving a cached answer.

    Inputs that matter

    • tuner_id - one tuning experiment, one state file. Case and punctuation are folded, so Bakery Sheet and bakery-sheet are the same tuner. New experiment = new id.
    • guidance - rough notes on what to improve ("palette is good, keep the counts"). Changing it re-opens a converged tuner and steers the next critique.
    • initial_prompt - the seed system prompt, used only on the first run of a new tuner.
    • max_iterations - lifetime cap on refinements (default 12). Treat this as your spend ceiling on Auto-Queue; 0 means unlimited.
    • version_override - -1 = latest (tuning mode). 0 = the original prompt. N = serve vN pinned: the loop never halts, Save records nothing, and repeated runs are fully cached. This is your production/rollback mode.

    Outputs: system_prompt (wire to your generator LLM and into the refiner's join), refiner_context (wire into the refiner's prompt), and status (handy into a Preview Any).

    Install and setup

    Part of the Symbiotica pack. ComfyUI Manager → search "Symbiotica", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/symbiotica-ai/comfyui-nodes.git symbiotica
    pip install -r symbiotica/requirements.txt
    

    Restart. You'll need LLM API keys (Anthropic, Gemini, etc. - whichever your chat nodes use) via Settings → Symbiotica or env vars. No models to download.

    Troubleshooting

    • The loop halts with an error - a refiner reply without a PROMPT: section (a refusal or commentary) or without the final END PROMPT line (token-cap truncation) is rejected on purpose. The loop stops rather than saving a poisoned prompt. Rerun.
    • It stops after a few runs saying Save is unrecorded - keep the Save node wired and unmuted. It's what records refinements and advances max_iterations. Muted Save = no progress, and the loop tells you so after three unrecorded serves.
    • Inconsistent results between runs - fix your sampler seed so the prompt is the only variable. You can't tune a moving target.
    • A corrupt state file - the node fails loudly with its path. Repair, delete, or switch tuner_id. State is per-machine: a RunPod install tuning the same id keeps its own lineage.
    • It converged too early - change guidance to reopen a converged tuner and push the refiner in a new direction.
    Categoryneuralsins/LLM

    Inputs (5)

    NameTypeDefaultDescription
    tuner_idSTRINGdefaultName of this tuning experiment. Each id has its own state file (output/prompt_tuner/<id>.json) and version history. Case and punctuation are folded: 'Bakery Sheet' and 'bakery-sheet' are the same tuner.
    guidanceSTRINGRough notes on what to improve next. Changing this re-opens a converged tuner and steers the refiner.
    version_overrideINT-1-1–100000-1 = latest version (tuning mode). 0 = the initial prompt. N = serve vN pinned: never halts, Save records nothing, and repeat runs are fully cached (rollback / production mode).
    max_iterationsINT120–10000Stop the loop once this many refinements exist for this tuner_id (lifetime count, not per-session). 0 = unlimited — no spend ceiling on Auto-Queue.
    initial_promptoptSTRINGSeed system prompt (becomes v0 on the first run of a new tuner_id; after that the state file owns the lineage).

    Outputs (3)

    NameTypeDescription
    system_promptSTRING
    refiner_contextSTRING
    statusSTRING