Round Prompt Weight
Tidy up ugly (tag:1.23456789) numbers
- prompt
This is a cleanup node, not a creative one - and it's honest about it. If you've chained a few Prompt Weight nodes, or used Sample Tags With Weight to generate random emphasis values, you can end up with a prompt string full of noise like (detailed background:0.847293). Round Prompt Weight strips that down to something you can actually read.
How it works
It scans the prompt string for weighted terms in the standard (tag:weight) attention format, and rounds each weight to n decimal places - default 3, adjustable 0 to 100. So (masterpiece:1.234567) at n=3 becomes (masterpiece:1.235); at n=1 it becomes (masterpiece:1.2). Everything else in the string - the tags themselves, the surrounding text - passes through untouched.
Be clear-eyed about what this buys you: at 2–3 decimal places, rounding a weight is cosmetic. It won't measurably change what the sampler produces - you're not going to see a different image because you rounded 1.234567 to 1.235. What it actually does is make your prompt readable and loggable, which matters more than it sounds like once you're saving preset files or debugging why a chained-together prompt looks the way it does.
Inputs and outputs that matter
- prompt - the weighted prompt string to clean up.
- n - decimal places to round to, default
3.
Output is a single prompt string, weights rounded, everything else preserved.
Installing it
ComfyUI Manager → search ComfyUI-PromptUtilities → install → restart. Or:
cd ComfyUI/custom_nodes && git clone https://github.com/nkchocoai/ComfyUI-PromptUtilities
Pure Python, nothing to download, no dependencies to fight. It sits under the PromptUtilities category once ComfyUI restarts.
Where it fits
This node is meant to sit downstream, not at the start of your graph - it has nothing to do if there's no (tag:weight) syntax in the string yet. The natural pairing is right after Prompt Weight (which builds those weighted strings from separate prompt/weight pairs) or Sample Tags With Weight (which assigns random weights to sampled tags). Drop it in right before your CLIP Text Encode, or right before you save a prompt string out to a preset file for reuse.
Where people get burned
Two honest caveats. First, remember this is a CLIP-family concern - (tag:weight) syntax does nothing on the LLM-encoded models (Flux.2, Z-Image, Qwen-Image), so there's nothing for this node to round on those workflows; it's an SD1.5/SDXL-era tool. Second, don't over-invest in a tiny n value expecting a visual difference - rounding is for your own sanity reading the prompt back, not a quality knob. If you're chasing a specific look, the weight itself is the lever to pull, not its precision.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| n | INT | 30–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |