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

globally normalized models #960

Open
denizyuret opened this issue Nov 3, 2023 · 1 comment
Open

globally normalized models #960

denizyuret opened this issue Nov 3, 2023 · 1 comment

Comments

@denizyuret
Copy link

Globally normalized models score sequences using the sum of unnormalized logits, as opposed to locally normalized ones which take a log_softmax at each token position before summing to compute the sequence score. They are strictly more expressive then locally normalized models (i.e. they can express a superset of probability distributions over sequences). It would take a one-line change in lm-evaluation-harness/lm_eval/base.py to allow evaluation of globally normalized models:

            # multi_logits = F.log_softmax(                                                                                            
            #     self._model_call(batched_inps), dim=-1                                                                               
            # ).cpu()  # [batch, padding_length, vocab]                                                                                
            multi_logits = self._model_call(batched_inps).cpu()

I just wanted to start a discussion to see if there is any interest and if there is a way we could make this an option for the evaluator. I can submit a pull request. (And I have some globally normalized models I'd like to share on hf-leaderboard ;).

@StellaAthena
Copy link
Member

Sure, I don't see why we shouldn't include this.

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

No branches or pull requests

2 participants