mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[GH-ISSUE #4] test_core.py ref_out and out Inconsistent accuracy #1
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepGEMM#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ttanzhiqiang on GitHub (Feb 26, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/4
@LyricZhao commented on GitHub (Feb 26, 2025):
Can you print the diff (using the
calc_difffunction) of the two tensors? Normally the diff should be around 0.0007 (ref_outis computed with BF16, out is with FP8).@ttanzhiqiang commented on GitHub (Feb 26, 2025):
using the calc_diff function

Does it mean that the output of the fp8 function is not one-to-one corresponding to the fp16 output, but focuses on the sum result? Is it because the loss calculation is the sum result, so this method is used?
@LyricZhao commented on GitHub (Feb 26, 2025):
Yes. We normally use this diff function or MSE as precision reference. FP8 and BF16 naturally have numeric precision issues.
@ttanzhiqiang commented on GitHub (Feb 26, 2025):
That means that in inference, fp8 and fp16 outputs need to correspond one to one. Is it not possible to use this method and use sglang(https://github.com/sgl-project/sglang) solution instead?
@LyricZhao commented on GitHub (Feb 26, 2025):
For model inference, you do not need binary-level precision even if the model weights are BF16/FP16, but in such cases, this may lead to LLM benchmark accuracy drops (similar to model quantization). So it is totally doable to integrate into SGLang.
BTW, DeepSeek-V3 models are natively FP8 trained without such concerns. This repo mainly supports V3/R1, for some detailed customization, you may need extra efforts :)
@Maximilianxu commented on GitHub (Feb 26, 2025):
@LyricZhao I found that when
per_group_sizeis smaller than 128, the output is wrong. The case is:@ttanzhiqiang commented on GitHub (Feb 26, 2025):
@LyricZhao thanks for your reply
@zheanxu commented on GitHub (Feb 26, 2025):
@Maximilianxu Please refer to the doc of
m_grouped_gemm_fp8_fp8_bf16_nt_contiguouslink
@Maximilianxu commented on GitHub (Feb 26, 2025):
I didn't see the alignment requirements for the API with mask. But it still fails.
@zheanxu commented on GitHub (Feb 26, 2025):
@Maximilianxu Thank you for your feedback! The problem occurs when
expected_mexceedsmin the case ofm=64. I'll submit a fix for this shortly.