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

Generate: assistant should sample when the main model samples #33534

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

gante
Copy link
Member

@gante gante commented Sep 17, 2024

What does this PR do?

Fixes #32867

TL;DR in assisted generation, the assistant model must sample when the main model is sampling. Otherwise, mathematical properties in the corresponding code path do not hold (see speculative decoding paper).

This reverts #30778, where I forced the assistant model to always run greedy decoding for speed purposes (more matched candidate tokens = faster).

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gante!

@gante gante merged commit 77c5d59 into huggingface:main Sep 20, 2024
21 checks passed
@gante gante deleted the fix_32867 branch September 20, 2024 16:01
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

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.

Speculative sampling does not maintain probability distribution of main model
3 participants
  NODES
COMMUNITY 2
innovation 1
Project 5
USERS 1