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

Top-K and Top-p sampling #7

Open
boblee22 opened this issue Oct 19, 2022 · 1 comment
Open

Top-K and Top-p sampling #7

boblee22 opened this issue Oct 19, 2022 · 1 comment

Comments

@boblee22
Copy link

Hi, thanks for your great work!

I have a question about the sampling process. When both top-K and top-p are enabled (e.g., https://github.com/allenai/RL4LMs/blob/main/scripts/training/task_configs/common_gen/t5_nlpo.yml#L44-L51), isn't top-p just ignored because the K most likely next words are filtered and the probability mass is redistributed among only those K next words? Please correct me if my understanding is wrong. Thank you!

@rajcscw
Copy link
Contributor

rajcscw commented Oct 22, 2022

This top p mask is quite different from typical top-p sampling. This is particular to NLPO algorithm. Before sampling, we generate a top p mask from the mask policy (a copy of policy from previous epochs). Depending on generation kwargs, top k is applied on top of this. For details, you can refer to our paper.

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