ZML_提示词token统一
When your positive has 40 tags and your negative has 4, fix the imbalance
- 正面条件
- 负面条件
ZML_提示词token统一 fixes a specific, nagging imbalance: your positive prompt has 30 comma-separated tags and your negative has three, and something in your pipeline behaves better when both sides are roughly the same length. The node counts tags on each side and pads the shorter one with a filler tag until the counts match.
The mechanism is simple and fully explained by the author's own docstring, which is rare and welcome. Split both prompts on commas (newlines count too - it normalizes them), count the tags on each side, and fill the short side with a repeating filler until it's as long as the long side. The concrete example they give: positive = 1girl,solo,hug, negative = sex, filler negative = nsfw → the negative output is sex,nsfw,nsfw. Three tags on each side, done.
What to set
- 填充正面 (positive filler) - the tag used to pad the positive side when it's short. Required, but can be empty (then the positive side just stays shorter).
- 填充负面 (negative filler) - same idea for the negative side.
- 正面条件 / 负面条件 (optional) - the actual prompts, force-input STRING sockets. These are what get balanced.
Outputs: 正面条件 and 负面条件 (STRING), both re-joined with commas. Wire them straight into your positive/negative CLIP encoders.
The honest question: does this matter?
Here's where you need to be careful, and the KB's prompt-engineering essay is the grounding for it. Tag-count balancing is a SDXL-lineage habit - it grew out of Illustrious/NoobAI/Pony workflows where the encoder is CLIP and tag lists behave like a token bag. On newer LLM-encoded models the rules change: your prompt is an instruction, not a tag bag, and the negative box may barely do anything. So this node is genuinely useful on the SDXL family (and it's clearly built for tag-style prompting - the filler is a single tag, not a sentence), and close to pointless on a 2026 LLM-encoder model. Check what your checkpoint is built on before you wire this in; the KB's own guidance is "check the model, don't assume."
When it does apply, it's a quiet workhorse: keep your negatives balanced to your positives across a batch sweep and you get consistent conditioning behavior run to run. Just know the filler is dumb - it repeats one tag, so pick something harmless.
Install
Part of ComfyUI-ZML-Image. Manager → search ComfyUI-ZML-Image, or:
cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-ZML-Image
restart. No models, no deps. Chinese-first UI, so the README's translation patch helps. It's a small, single-purpose node from a 160+-node one-person pack - if a behavior surprises you, the GitHub issues page is the support channel.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| 填充正面 | STRING | — | |
| 填充负面 | STRING | — | |
| 正面条件opt | STRING | — | |
| 负面条件opt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| 正面条件 | STRING | — |
| 负面条件 | STRING | — |