Skip to content
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

FIX: Top logprob bug in Offline._parse_logprobs #47

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lucyfarnik
Copy link

The current implementation sometimes picks up on the incorrect decoded token because it implicitly assumes that the model always picks the token with the highest logprob (which is what logprob.rank==1 looks for). This leads to outputs such as these:
Screenshot 2025-01-20 at 12 44 54 PM
Notice how when you put together the Logprobs.token’s, you don’t get the same thing as the model's actual output (often because the model was "indecisive" between a number and a space). This then confuses Classifier._parse_logprobs which only looks at Logprobs.token to determine which sequence positions contain the model’s labels. In the case of the logs I screenshotted above, this leads to Classifier._parse_logprobs returning a list of the wrong length, which ultimately causes the assertion at scorers/classifier/classifier.py:133 to fail.

My PR fixes this by always setting Logprobs.token to the actual token which the model chose, rather than the token it was maximally likely to choose (but may or may not have actually chosen).

@CLAassistant
Copy link

CLAassistant commented Jan 20, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants