Advanced Prompt Syntax
Most prompts need nothing more than plain text, perhaps with a prompt template or a few dynamic prompt alternatives. This page covers the syntax for finer control: making parts of a prompt count for more or less, blending prompts, and the advanced forms of dynamic prompts.
Attention weighting
Section titled “Attention weighting”Attention weighting makes parts of the prompt count for more or less than the rest. It uses Compel syntax, which applies to SD 1.5, SD 2.x and SDXL. Newer model families, including FLUX, Z-Image, CogView4 and Qwen Image, do not use it, and the symbols are passed to the model as ordinary text.
| Syntax | Effect |
|---|---|
trees+ / fog- | Increase or decrease a single word |
(golden hour light)+ | Weight a phrase |
(cinematic lighting)1.25 | Use an exact numeric weight |
(portrait with (blue eyes)1.3)1.1 | Nest weights |
("portrait photo", "oil painting").blend(0.7, 0.3) | Blend prompts |
("red silk dress", "studio portrait", "soft rim light").and() | Encode clauses separately |
colored pencil \(medium\) | Use literal parentheses |
Weighting with + and -
Section titled “Weighting with + and -”Append + to increase influence, or - to reduce it.
freckles+background crowd-(soft rim light)++- Single words can be weighted directly. Wrap phrases of several words in parentheses.
- Each additional
+or-compounds, in steps of roughly 10%. - One or two steps is usually enough. Extreme weighting can overpower the rest of the prompt.
Numeric weights
Section titled “Numeric weights”Use numeric weights when you want precise control instead of repeated plus or minus markers.
(cinematic lighting)1.25(background crowd)0.81 is neutral, values above 1 increase emphasis, and values between 0 and 1 reduce it. Wrap the weighted phrase in parentheses.
Groups can be nested, and the weights combine. In (portrait with (blue eyes)1.3)1.1, the outer group strengthens the whole phrase, and blue eyes gets even more emphasis.
Adjusting weights with the keyboard
Section titled “Adjusting weights with the keyboard”In a prompt field, select text and press Ctrl+Up or Ctrl+Down to raise or lower its attention. With no selection, the shortcut targets the word at the cursor. Selecting a group’s parentheses or weight targets its contents.
- A selection inside a group changes only the selected words. A selection crossing a group boundary changes the selected words on both sides.
- Symbolic weights move one
+or-step. Numeric weights change by0.1of effective attention, including inherited group weights. - The numeric attention preference controls new weights; existing group weights keep their style.
- Adjacent content with matching weights merges, and the adjusted content stays selected for the next keypress.
- Inside prompt functions, the shortcut adjusts prompt arguments and preserves function parameters. Use Ctrl+Z to undo a weight change.
Blending with .blend()
Section titled “Blending with .blend()”Use .blend() to mix the meaning of two or more prompts.
("portrait photo, 85mm lens", "oil painting, visible brushstrokes").blend(0.7, 0.3)Provide one weight for each prompt. Keeping the weights near a total of 1 makes the result easier to reason about, and quoting each prompt is safest, especially when they contain commas.
Combining clauses with .and()
Section titled “Combining clauses with .and()”Use .and() when you want separate prompt clauses encoded individually instead of as one long comma-separated sentence.
("red silk dress", "studio portrait", "soft rim light").and()This can behave differently from red silk dress, studio portrait, soft rim light. If a normal prompt keeps collapsing ideas together, .and() is worth testing.
Literal parentheses
Section titled “Literal parentheses”Unescaped parentheses are treated as weighting syntax. To include actual parentheses in the text, escape them with backslashes:
colored pencil \(medium\)A bear \(with razor-sharp teeth\) in a forestAdvanced dynamic prompt syntax
Section titled “Advanced dynamic prompt syntax”These additions to the dynamic prompt syntax give finer control over how variations are built.
Choosing more than one option
Section titled “Choosing more than one option”Put a number and $$ at the start of a group to pick several different options from it. They are joined with a comma:
portrait, {2$$rim light|fog|rain}gives prompts such as portrait, rim light,fog and portrait, fog,rain. To join them differently, put the separator between two $$:
portrait, {2$$ and $$rim light|fog|rain}gives prompts such as portrait, rim light and fog. A range picks a varying number of options: {1-3$$rim light|fog|rain} picks one, two or three.
Weighting options
Section titled “Weighting options”In Random sample mode, you can make some options more likely than others by putting a weight and :: in front of them:
a {0.7::red|0.2::green|0.1::blue} balloonmakes red balloons most common. Weights are ignored in All combinations mode, where every option appears once.
Variables
Section titled “Variables”A variable gives a group a name, so you can define it once and use it in several places. ${name={...}} defines it and ${name} uses it:
${color={red|blue}} a ${color} hat with a ${color} scarfEach use varies on its own, like a group written out in full, so this gives all four combinations from a red hat with a red scarf to a blue hat with a blue scarf. Variables are most useful for long lists you would otherwise repeat; for lists you use in many prompts, a wildcard is more convenient.
Comments
Section titled “Comments”Everything after a # is treated as a comment and left out of the prompt. Avoid # in ordinary prompts, since the rest of the prompt after it is dropped.