Skip to content

Better handle types and overflows in softmax (especially lagacy and stable)#1476

Open
jmitrevs wants to merge 3 commits into
fastmachinelearning:mainfrom
jmitrevs:sofmax_fix
Open

Better handle types and overflows in softmax (especially lagacy and stable)#1476
jmitrevs wants to merge 3 commits into
fastmachinelearning:mainfrom
jmitrevs:sofmax_fix

Conversation

@jmitrevs
Copy link
Copy Markdown
Contributor

@jmitrevs jmitrevs commented May 20, 2026

Description

The legacy softmax was prone to overflow, so this PR made it use an accumulator type. Also, for stable, the default types are better chosen. There are some changes in latency, as well, to avoid overflow, but my feeling is that latency can often behave badly, so this doesn't fix that.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change which adds functionality)

Tests

The standard softmax tests should still pass. One could consider adding specific overflow tests, like we have in the current version of the brevitas tutorial.

Checklist

  • I have read the guidelines for contributing.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have installed and run pre-commit on the files I edited or added.
  • I have added tests that prove my fix is effective or that my feature works.

@jmitrevs jmitrevs added the please test Trigger testing by creating local PR branch label May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

please test Trigger testing by creating local PR branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant