Implement binary search for bfp4 weight lowering based on sensitivity#5418
Open
kdimicTT wants to merge 3 commits into
Open
Implement binary search for bfp4 weight lowering based on sensitivity#5418kdimicTT wants to merge 3 commits into
kdimicTT wants to merge 3 commits into
Conversation
38cb8c4 to
51bac11
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5418 +/- ##
=======================================
Coverage 33.84% 33.84%
=======================================
Files 37 37
Lines 4990 4990
=======================================
Hits 1689 1689
Misses 3301 3301 ☔ View full report in Codecov by Harness. |
96aab6f to
0c57788
Compare
0c57788 to
6c12760
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem description
When running models with mixed precision, not all weights tolerate aggressive quantization equally. Lowering every weight to bfp_bf4 maximizes memory savings but often degrades accuracy below acceptable thresholds. There was no systematic way to find the optimal subset of weights to lower to bfp_bf4 while keeping accuracy above a target.
The sensitivity scores consumed by this script are produced by the per-weight scoring implemented in #5092.
What's changed
Adds
mixed_precision/lowering_search.pyscript that automates the search for the maximum number of weights that can be safely lowered to bfp_bf4.Approach: