SD prompt debugger
When a Stable Diffusion prompt produces unexpected results, the cause is almost always mechanical rather than mysterious. The subject is past the 75-token boundary, a bracket is unmatched, two style terms cancel each other out, or a word in the negative prompt is quietly suppressing part of the scene you wanted. This debugger checks all of those issues and explains what to change.
How it works
The tool runs six deterministic text checks against your prompt and negative prompt — no image generation, no AI model, just rules:
token estimate → warn if > 75 (CLIP chunk boundary)
bracket matching → unbalanced ( ) or [ ] and missing weight colons
weight range check → flag (term:>1.5) which tends to "fry" images
conflict scan → opposing style/time/shot terms in one prompt
quality boosters → note if none present (model-dependent)
neg vs pos overlap → words appearing in both prompts
Token counting is an estimate based on word and punctuation boundaries — close enough to catch the overflow cases that matter, since the exact tokenisation depends on the CLIP tokeniser’s vocabulary.
The 75-token limit explained
SD’s CLIP text encoder processes text in chunks of 75 tokens (plus start and end tokens). When your prompt exceeds 75 tokens, it does not error — the text is split into additional chunks and processed sequentially. But there are two side effects:
- Tokens in later chunks have reduced influence on the output. The model weights early tokens more heavily because they are closest to the conditioning direction.
- Semantic coherence across the chunk boundary degrades. A subject described across the boundary of chunks 1 and 2 is less cohesive than one described entirely within chunk 1.
The practical rule: keep your subject, key descriptors, and the most important style terms within the first 60–70 tokens. Save quality boosters and secondary style tags for the end where they matter less if truncated.
Weight syntax pitfalls
AUTOMATIC1111-style weight syntax uses parentheses and a colon: (term:1.3) raises emphasis, (term:0.7) lowers it. Bare parentheses without a weight, like (term), multiply by 1.1. The most common errors:
- Missing colon:
(term 1.3)is not valid — the colon is required. - Unmatched brackets:
((term:1.3)leaves one bracket unmatched and may be parsed unpredictably. - Extreme weights: values above roughly 1.5 tend to distort the image. The model clips activations past a threshold and the excess manifests as halos, saturation spikes, and geometry distortion. Stay within 0.6–1.4 for reliable results.
- Square brackets:
[term]lowers weight (equivalent to about 0.9), the syntax used in some older guides. It works but is less precise than the explicit colon syntax.
Conflict and overlap checks
Style conflicts are the hardest prompt bugs to spot by eye because the terms are individually valid but semantically opposed. Examples of conflicting pairs this debugger catches:
minimalistandhighly detailed— the model cannot simultaneously simplify and densifydark, moodyin the positive prompt anddarkin the negative prompt — the negative quietly suppresses the deliberate darknessdaytime, golden houralongsidenight, moonlight— the model averages toward a confused twilight rather than either lighting condition
When the debugger flags an overlap between your positive and negative prompt, verify that the overlapping word is not central to your intended scene before removing it from the negative.
Tips and common fixes
- Front-load the subject. Keep the main subject and key descriptors inside the first ~60 tokens so they land in the first CLIP chunk.
- Use sane weights. Stay within roughly 0.6–1.4; extreme values above ~1.5 distort more than they help.
- Resolve conflicts. If you need both a detailed and a clean look, weight one direction explicitly rather than using contradictory terms at equal strength.
- SDXL needs fewer boosters. Quality tags like
masterpiece, best qualityhelp SD 1.5 but matter far less on SDXL, which was trained on cleaner descriptive captions rather than tag-style training data.