Skip to content

A question for the case with negative prompt and condition-based CFG #2

Description

@chaObserv

In practice, it's common to see the unconditional part being conditioned with a negative prompt, which is intended to reduce or suppress the elements the user has defined. I wonder if using the unconditional prediction for the start and the end still makes sense in such a situation.

Using the conditional prediction as the base term might be an option, since the original CFG can be rearranged into a condition-based formulation with the guidance weight reduced by 1 from the original.

# uncond base
cfg_result = uncond + w * (cond - uncond)

# cond base
cfg_result = cond + (w - 1) * (cond - uncond)

From this latter view, when the correction term goes to zero, the result will simply use the conditional prediction. Although we can apply beta-CFG scaling to this new correction term, I'm not sure if it still reflects the original intention of beta-CFG.

# Example
beta_cfg_result = cond + beta(t) * (w - 1) * (cond - uncond)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions