Skip to content

Prompt Attention Fixes - #8860

Merged
lstein merged 13 commits into
invoke-ai:mainfrom
joshistoast:fix/prompt-attn-fixes
Mar 7, 2026
Merged

Prompt Attention Fixes#8860
lstein merged 13 commits into
invoke-ai:mainfrom
joshistoast:fix/prompt-attn-fixes

Conversation

@joshistoast

@joshistoast joshistoast commented Feb 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Addresses issues, oversights and edge cases surrounding the prompt attention hotkey feature.

Fixes and Improvements:

  • Add more supported punctuations so they don't get parsed away;
  • Fixed floating point corruption, numeric weighting is now more predictable;
  • Added attention style preference to settings modal;
  • Added prompt functions to AST;
  • Now respects prompt functions like .blend(), .and() and .or();
  • Now respects mismatched and missing quote pairing in above prompt functions.
  • (more fixes will be added here as they come)

Related Issues / Discussions

Discussed in #8736

QA Instructions

Merge Plan

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions Bot added the frontend PRs that change frontend files label Feb 7, 2026
@DustyShoe

Copy link
Copy Markdown
Collaborator

Based on my quick testing, the outermost parentheses wrapping the entire chunked prompt are still being stripped. The same issue occurs with .and()

Example:

("high detail, (cinematic lighting)1.25, soft volumetric light, (sharp focus)+, professional photography",
 "a young woman with balanced natural proportions, medium length brown hair, neutral expression, casual modern clothing",
 "subtle rim light, shallow depth of field, natural skin texture, clean background")
.and()

Becomes

"high detail, (cinematic lighting)1.25, soft volumetric light, (sharp focus)+, professional photography+",
 "a young woman with balanced natural proportions, medium length brown hair, neutral expression, casual modern clothing",
 "subtle rim light, shallow depth of field, natural skin texture, clean background"
.and

@lstein lstein assigned lstein and DustyShoe and unassigned lstein and DustyShoe Feb 16, 2026
@lstein

lstein commented Feb 16, 2026

Copy link
Copy Markdown
Collaborator

I can confirm this behavior.

(one,two).and()

Select "one" and press ctrl-+, and it becomes:
one+,two.and

@lstein lstein left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still has issues with .add() and similar operators. See comments above.

@lstein lstein added the v6.12.0 Intended for 6.12.0 release label Feb 20, 2026
joshistoast and others added 2 commits February 23, 2026 21:46
account for mismatching quotes, missing quotes and other quote entities
@joshistoast

Copy link
Copy Markdown
Collaborator Author

@DustyShoe @lstein Last commit addresses quote craziness (mismatches, other entities, none at all)

@DustyShoe

Copy link
Copy Markdown
Collaborator

Looks like it’s working without major changes to the prompt structure.

However, I have a small nitpick: it still flattens the prompt if it is written in separate paragraphs.

For example:

("chunk 1, with many, words, bla bla, bla bla, bla bla",

 "chunk 2, with many, words, bla bla, bla bla, bla bla",

 "chunk 3, with many, words, bla bla, bla bla, bla bla",

 "chunk 4, with many, words, bla bla, bla bla, bla bla")
.and()

Becomes:

("chunk 1, with many, words, bla bla, bla bla, bla bla", "chunk 2, with many, words, bla bla, bla bla, bla bla", "chunk 3, with many, words, bla bla, bla bla, bla bla", "chunk 4, (with many)+, words, bla bla, bla bla, bla bla").and()
I would prefer that it not modify the structure of the prompt at all. Also it missed the space before .and()

@lstein

lstein commented Feb 28, 2026

Copy link
Copy Markdown
Collaborator

@joshistoast Are you intending to make changes in response to @DustyShoe 's nit? If not, I'm ok going ahead with an approval and merge and you can attend to this detail at a later date.

@joshistoast

Copy link
Copy Markdown
Collaborator Author

@joshistoast Are you intending to make changes in response to @DustyShoe 's nit? If not, I'm ok going ahead with an approval and merge and you can attend to this detail at a later date.

I can try getting to it this Monday. But I feel like if we keep delaying these important fixes for new bug reports, they'll never get merged in.

@joshistoast

Copy link
Copy Markdown
Collaborator Author

This should fix it

@joshistoast
joshistoast requested a review from lstein March 4, 2026 10:20

@lstein lstein left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is working well in my hands. There may be other weird edge conditions, but I couldn't find them easily.

@lstein
lstein enabled auto-merge (squash) March 7, 2026 01:10
@lstein
lstein merged commit fcdcd7f into invoke-ai:main Mar 7, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend PRs that change frontend files v6.12.0 Intended for 6.12.0 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants