Skip to content

Conversation

merrymercy
Copy link
Contributor

@merrymercy merrymercy commented Dec 30, 2024

The existing code computes the logprob of output tokens in LogitsProcessor. However, this logprob can be different form the real logprob we used in Sampler because the logprob in LogitsProcessor does not include temperature, top-p, or grammar mask.

This PR fixes it by computing the logprob in Sampler, so we unify the code path and make sure the logprob is the real logprob that we sample from.

Closes #2178

@merrymercy merrymercy changed the title Refactor logprob computation Refactor logprob computation to return the real logprob used in sampling Dec 30, 2024
@merrymercy merrymercy merged commit 9c6ba24 into main Dec 30, 2024
16 of 17 checks passed
@merrymercy merrymercy deleted the pr-fix-sampling branch December 30, 2024 12:51
XiaotongJiang pushed a commit to XiaotongJiang/sglang that referenced this pull request Jan 3, 2025
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
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.

[Feature] Get the real logprobs to analyze decoding
1 participant