Sign In

Prompt Syntax Tips - Weight Gradient Method

Prompt Syntax Tips - Weight Gradient Method

Sharing a tip that's been helping me recently. Very useful for when LoRA's or TI's are coming out a little over cooked.

The syntax follows the format :

[ A : B : X ]

Where A and and B are prompts or keywords, and X is a number to control what step that A is replaced by B. I recommend using percent of total steps for X (0-1) instead of a specific step number. (This syntax applies to Automatic1111, but I believe it also works in ComfyUI)

Defining a "weight gradient" is applying this syntax for the same prompt keywords at different weights. In most cases, to reduce the impact of over cooking, a weight gradient would look like this:

[ (A : 0.9) : (A : 0.6) : 0.5 ]

The prompt A starts at 90% weight for the first half of generation, then reduces to 60% for the second half.

See the difference between these two examples:

When left at a constant weight, the output is overcooked above a weight of 0.6.

But if we switch to a weight of 0.5 after 25% of the steps have been generated, even a weight of 1.1 yields interesting results. Also notice the subtle differences between the [0.6 : 0.5 : 0.25] weight gradient and the 0.6 constant weight, being able to drop the weight by 0.1 for 75% of the steps.

This method works well because the overall composition is generally well established by the midpoint. When to reduce weight and by how much will vary depending on what aspect of your image is getting overcooked.

A additional supplement to this technique includes adding a constant weight for A

[ (A : 0.9) : (A : 0.7) : 0.5 ], (A :0.5)

Hope this helps you fine tune your results just the way you like!
Happy prompting!

3

Comments