Nodes/Mutantwork Power Pack/🧬 Mutant Prompt Optimizer
ComfyUI Node

🧬 Mutant Prompt Optimizer

Your 'masterpiece, 8k' boilerplate is doing nothing β€” this node strips it and rewrites the rest

By brerereton-beepΒ·Created 3 months agoΒ·Updated 3 months agoΒ· 1
🧬 Mutant Prompt Optimizer
    • optimized_prompt
    • optimization_report
    β—„prompta beautiful woman with stunning eyes, 8k, masterpiece, highly detailedβ–Ί
    β—„enable_denoisetrueβ–Ί
    β—„enable_weightingtrueβ–Ί
    β—„weight_scale1.00β–Ί

    Every prompt starts the same way: masterpiece, 8k, highly detailed, best quality. It feels like you're being thorough. The argument this node makes is that you're actually wasting tokens. Those quality words have appeared in so much training data that the model has learned to half-ignore them - they sit in your prompt, consume token budget, and activate nothing specific. ComfyUI-Mutantwork calls this semantic saturation, and Mutant Prompt Optimizer is the pack's fix: strip the dead weight and upgrade the vague phrases that remain into specific, weighted ones.

    There's a real idea underneath the buzzword, and the KB backs it up. masterpiece, best quality is alive on SDXL-lineage models (Illustrious, NoobAI, Pony) because those tags were trained in, and nearly inert elsewhere. And (word:1.3) attention weighting is a CLIP-era tool - it works on SD 1.5/SDXL text encoders and is silently discarded by LLM-encoded models like Flux 2, Z-Image or Anima. So file this node under "SDXL-lineage helper." On those checkpoints it's doing something genuinely useful.

    How it works

    It's a text-in, text-out node running two passes, in order:

    1. Weight injection - it walks a built-in dictionary of weak phrases and swaps them for weighted equivalents. good lighting becomes (cinematic rim lighting:1.3), realistic becomes (hyperrealistic photographic rendering:1.3), bokeh becomes (creamy f1.4 lens bokeh:1.3). Matches are case-insensitive and longest-phrase-first so soft lighting wins over soft.
    2. De-noising - it strips tokens on its "inflated" list: masterpiece, 8k, 4k, highly detailed, ultra detailed, stunning, artstation, octane render, and friends, using word-boundary regex so it doesn't butcher 4k inside 4k-resolution (well, mostly).

    After both passes it collapses doubled commas and spaces. That's it - no CLIP call, no model, nothing to download. It runs locally in milliseconds.

    Inputs and outputs

    Only a few matter:

    • prompt - your raw prompt, multiline. This is the one input you definitely touch.
    • enable_denoise and enable_weighting - the two toggles for the two passes, both on by default. Turn denoise off if you like your quality tokens, weighting off if the rewrites feel too aggressive.
    • weight_scale - a global multiplier (0.5–1.5, default 1.0) that rescales every injected weight. 1.3 and above pushes harder; 0.8 softens everything toward neutral.

    Outputs: optimized_prompt (STRING) wires straight into the positive input of a CLIP Text Encode node, and optimization_report (STRING) is a plain-text diff of what got stripped and what got injected - drop it into any text display node so you can actually see what changed.

    Install

    Same story as the rest of the pack: ComfyUI Manager, search ComfyUI-Mutantwork, install, restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/brerereton-beep/ComfyUI-Mutantwork.git
    pip install -r ComfyUI-Mutantwork/requirements.txt
    

    Then restart and look under the Mutantwork category. The requirements list numpy, Pillow, scipy, opencv-python and c2pa-python, but this node only ever imports numpy and Pillow - the rest of the list belongs to the pack's other nodes, and opencv/scipy aren't actually imported anywhere in the code. You can skip the heavy stuff if you only want this node.

    Common issues

    The main thing that trips people up is the wrong checkpoint family. Feed this node's output into a Flux or Z-Image workflow and the (phrase:weight) syntax does nothing - it's just literal text to an LLM encoder, possibly worse than nothing. Check the optimization_report before trusting the output: if it says "0 matches in dictionary" and your prompt had no obvious quality tokens, the node has nothing to offer that prompt.

    Also worth knowing: the dictionary is curated and opinionated - it's one person's taste in cinematic vocabulary. weight_scale 1.0 is a sane default; you'll see overcooking (oversaturated, distorted text emphasis) if you push toward 1.5 on models that don't like heavy weights. And since the denoise pass is a blunt instrument, don't rely on it to fix prompts that need restructuring - it removes words, it doesn't reorder them.

    CategoryMutantwork

    Inputs (4)

    NameTypeDefaultDescription
    promptSTRINGa beautiful woman with stunning eyes, 8k, masterpiece, highly detailedβ€”
    enable_denoiseoptBOOLEANtrueβ€”
    enable_weightingoptBOOLEANtrueβ€”
    weight_scaleoptFLOAT1.000.5–1.5β€”

    Outputs (2)

    NameTypeDescription
    optimized_promptSTRINGβ€”
    optimization_reportSTRINGβ€”