Nodes/ymc-node-suite-comfyui/prompt - add weight
ComfyUI Node

prompt - add weight

Set an attention weight on one keyword without typing parentheses

By YMC-GitHub·Created 3 years ago·Updated about a year ago· 20
prompt - add weight
    • prompt
    prompt_keyword
    weight1.00

    Want to emphasize a single word in a prompt without hand-writing (keyword:1.3) and praying the parentheses balance? Prompt - add weight is the honest little node for it: a prompt_keyword text field and a weight slider from -3 to 3. Move the slider, and it outputs either the bare keyword (at exactly 1.0) or the wrapped (keyword:weight) form. That's the whole node, and that's fine.

    It's meant to sit upstream of whatever assembles your final prompt - feed its prompt output into a join or directly into your CLIP encode, alongside your other fragments. The slider being a float (not a text field) is the quiet improvement over the rest of this pack's string-obsessed text nodes: you can actually drag it while testing.

    How it works

    One rule, applied consistently:

    • weight == 1.0 → output is just the keyword, no wrapper (adding (keyword:1.0) is noise, so it's skipped)
    • anything else → (keyword:weight), with the weight rounded to 3 decimals

    Weights below 1 - down to the -3 floor - are supported, which gives you the suppression direction for free: (keyword:0.7) is a perfectly cromulent way to de-emphasize a token on SDXL-lineage models.

    Inputs and outputs

    • prompt_keyword - the word or phrase to weight
    • weight - FLOAT slider, default 1, range -3 to 3, step 0.01
    • Output: prompt - STRING, the keyword or its weighted wrapper

    Installing it

    # ComfyUI Manager: search "ymc suite" and install ymc-node-suite-comfyui
    # or:
    cd ComfyUI/custom_nodes
    git clone https://github.com/YMC-GitHub/ymc-node-suite-comfyui
    

    Restart after installing. Dependencies are four small pure-Python PyPI helpers that self-install; no models, no GPU footprint.

    Gotchas

    • The (word:weight) syntax is an SD1.5/SDXL-lineage feature. On the LLM-encoded encoders (Flux 2 Klein, Anima, Z-Image, most 2026 models), the wrapper is discarded - you're producing text that gets read as a literal instruction. Check what encoder your checkpoint uses before you spend a session tuning weights on a model that ignores them.
    • At exactly 1.0 the wrapper vanishes. That's intentional, but it means the output silently changes form as you drag through 1.0 - if a downstream node is parsing the string, that can surprise you.
    • The sibling prompt - add is for adding whole tags to a list; this one is for weighting one keyword. They compose well together, but they're not interchangeable.
    • WAS-conflict note as with the rest of the pack: if WAS Node Suite is installed too, Manager may flag shared node names between the packs.
    Categoryymc suite/text

    Inputs (2)

    NameTypeDefaultDescription
    prompt_keywordSTRING
    weightFLOAT1.00-3–3

    Outputs (1)

    NameTypeDescription
    promptSTRING