-
Notifications
You must be signed in to change notification settings - Fork 466
Changed tests from logits to topk logprobs #745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
370cd34
Working with logprob for testing
Manan17 465465b
Checking top k prologs
Manan17 12003ea
created a util function
Manan17 242bf55
Merge branch 'main' into logprobs
Manan17 c661eba
fixup
Manan17 6cededa
adding logprobs to all test files
Manan17 e736cb0
Merge branch 'main' into logprobs
Manan17 e2ca150
resolved issue
Manan17 ebee524
Merge branch 'main' into logprobs
Manan17 a24ad91
Merge branch 'linkedin:main' into logprobs
Manan17 14e40f2
Merge branch 'logprobs' of https://github.com/Manan17/Liger-Kernel in…
Manan17 4f4a9e0
change loss tolerance and logprob tolerance for gemma3
Manan17 8d73d79
Update benchmark.yml
Manan17 2c8ac3f
Update benchmark.yml
Manan17 ba6f637
Update benchmark.yml
Manan17 1105b56
adjust tolerance for gemma3_text
Manan17 752a665
Merge branch 'logprobs' of https://github.com/Manan17/Liger-Kernel in…
Manan17 821c730
Merge branch 'main' into logprobs
Manan17 0e0c75d
fixed checkstyle
Manan17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After removing all logprobs comparison, we can try setting it lower.
sglang only has atol and sets it to 5e-2 (decode_tolerance)
verl sets
(atol, rtol) = (1e-2, 1e-5), but it's mean of all logprobs not topkUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not work with lower tolerance.
For gemma3, it passes when atol=1e-1 and rtol=1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this out with fp32, it fails for most of the models where old logic for checking the logits is passing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are comparing values in log-space, the total tolerance here is actually relative tolerance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just check the rtol?
like: tolerance = rtol * torch.abs(tensor2)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolute diff for two logprobs (logA - logB) = relative diff for two probs (A / B), which means the whole tolerance (
atol + rtol * torch.abs(expected)) should be the maximum relative diff we can accept.I think that's also why sglang only has a single tolerance in their test.