Repository navigation
Conversation
|
Hi @HowieYin! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
|
@pytorchbot label "release notes: llm" "module: llm" "bug" |
Summary
Half sampling accumulates softmax and CDF in FP16. With 32768 zero logits, probabilities sum to 16 instead of 1; seed 42 returns token 694 instead of the FP32 result, 11111.
Use the existing FP32 buffer, as in the BF16 path (#22094), for temperature scaling, softmax and sampling. Keep greedy sampling on the original logits.
Test plan
Locally compiled
test_sampler.cppwith libtorch and GoogleTest on macOS arm64:./sampler_test— 11 passed. The three new large-vocabulary tests fail before the fix and pass after it, covering multinomial, top-p and top-k over repeated calls.Portable C++17 build with ASan/UBSan:
./portable_sampler_test— 3 passed. clang-format 18.1.3 andgit diff --checkpassed.AI assistance: TRAE.
cc @larryliu0820 @mergennachin @cccclai @helunwencser @jackzhxng @digantdesai