Avoid emitting NaN / Inf logprobs out of inference - #6993
Conversation
|
This PR has been automatically converted to draft because all PRs must start as drafts. When you are ready for review, click Ready for Review to begin the review process. This will:
See the contribution guide for more details. |
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
santhnm2
left a comment
There was a problem hiding this comment.
Can we add specific links to vLLM code to document parity for the scalar constants? (MIN_SAMPLING_TEMPERATURE and JSON_SAFE_LOGPROB_FLOOR)
Added the link for
|
Would it make sense to align these or is there no need? |
There is no need for two reasons:
|
| from typing import List, Optional | ||
|
|
||
| # Floor applied to temperature everywhere it divides logits to avoid inf/NaN. | ||
| MIN_SAMPLING_TEMPERATURE = 1e-6 |
There was a problem hiding this comment.
Why not add this to SamplingParams?
There was a problem hiding this comment.
If you mean the actual clamp, that is why not just have any tiny temperature value get automatically clamped in a __post_init__ whenever the request gets made, here are the reasons:
temperature=0means something special: greedy decode. We have no separate greedy flag (we probably should... follow-up PR). The OpenAI endpoints assume this "greedy is temperature 0" as they build the requests, and it would be strange for the sampling parameters to be modified away from it. If the first turn's response has different sampling parameters from the first turn's reply, external callers like Gym could get confused and call subsequent turns with non-greedy temperatures.- There were more reasons, but now that I'm responding to your comment and thinking critically, all other reasons are minor.
So it's just that we lack an is_greedy flag, and instead we rely on temperature=0.
I would want to address this in a follow-up PR because is_greedy is a design choice, whereas this is just a quick bug-fix to enable NeMo RL.
But you're right. I've put this on my radar now for a follow-up clean-up PR.
Signed-off-by: Teodor-Dumitru Ene <teodord.ene@gmail.com>
Signed-off-by: Teodor-Dumitru Ene <teodord.ene@gmail.com>
Signed-off-by: Teodor-Dumitru Ene <teodord.ene@gmail.com>
Signed-off-by: Teodor-Dumitru Ene <teodord.ene@gmail.com>
Signed-off-by: Teodor-Dumitru Ene <teodord.ene@gmail.com>
Signed-off-by: Teodor-Dumitru Ene <teodord.ene@gmail.com>
9b90964 to
03ce442
Compare
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/33684159614 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/33686162520 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/33711118299 |
What does this PR do?
There were several issues resolved in this PR.
top_p = 0.0as greedy/default; NeMo RL was usingtop_p = 1.0.-inf.Issue tracking
For PRs from open-source community contributors:
Linked issue:
Contribution process
Pre-checks
Code review
Feel free to message or comment @NVIDIA/mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.
Step 1: Mark PR as "Ready for Review"
.github/CODEOWNERS.Final Review might get declined if these requirements are not fulfilled.
Step 2: Final Review
For PRs that change
megatron/core, once all expert reviewers have approved, theFinal Reviewlabel is applied automatically and final reviewers are assigned.For PRs outside
megatron/core, this step is skipped.Step 3: Approved
Once all required reviewers have approved, the
Approvedlabel is applied automatically.Merge
Any member of mcore-engineers will be able to merge your PR.