[BUG] cross-entropy loss not computed correctly when label_smoothing is enabled
Open
bug
community-request
waiting-on-customer
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 4.5k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 271
Description
**Describe the bug**
Currently, when `label_smoothing` is enabled, `mean_log_probs` is computed as a local mean ([code pointer](https://github.com/NVIDIA/Megatron-LM/blob/a5415fcfacef2a37416259bd38b7c4b673583675/megatron/core/tensor_parallel/cross_entropy.py#L87)). This is not the expected behavior for label smoothing, and can cause the `loss` to be different on different tensor parallel ranks.
**Expected behavior**
An extra all-reduce is needed on the `mean_log_probs` to make it right and consistent.
Contributor guide
Assessment
This issue has not been assessed yet.