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

Question about evaluate_posterior function #171

Open
Hannibal046 opened this issue Dec 29, 2024 · 2 comments
Open

Question about evaluate_posterior function #171

Hannibal046 opened this issue Dec 29, 2024 · 2 comments

Comments

@Hannibal046
Copy link

Hi, Teams,

Thanks for the great work!

I have a question about the evaluate_posterior function, especially about this line:

qx = 1.0

Although it seems like a more strict version, it doesn't align with the original speculative sampling method. May I understand why?
image

@Liyuhui-12
Copy link
Collaborator

Because top-k sampling is used in the draft phase, when a previous draft token is rejected, the sampling probability of the current draft token is 1. This still aligns with the theoretical guarantees of speculative sampling, ensuring losslessness and greater efficiency. You can also refer to #50, which includes validation on the invariance of the distribution.

@Hannibal046
Copy link
Author

Thank you for the detailed explanation! Since the speculative decoding method in this implementation differs from the approach outlined in the paper, would it be possible for you to help me correct the following algorithm diagram? Do I understand the current implementation correctly?

image

This would help clarify the modifications and make it easier for everyone to understand the design choices.

Thanks in advance for your assistance!

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