[GH-ISSUE #108] 从训练的角度出发,这个可以用在megatron里面吗 #63

Closed
opened 2026-10-26 21:11:35 +00:00 by bsakaguchi · 8 comments
Owner

Originally created by @duzhixing on GitHub (Jun 4, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/108

大模型FP8训练中,DeepSeek给了很好的先例。想请教一下DeepGemm可以和megatron想结合吗。

Originally created by @duzhixing on GitHub (Jun 4, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/108 大模型FP8训练中,DeepSeek给了很好的先例。想请教一下DeepGemm可以和megatron想结合吗。
Author
Owner

@LyricZhao commented on GitHub (Jun 9, 2025):

可以的,我们内部的训练都是 DeepGEMM。

<!-- gh-comment-id:2954555706 --> @LyricZhao commented on GitHub (Jun 9, 2025): 可以的,我们内部的训练都是 DeepGEMM。
Author
Owner

@foreverlms commented on GitHub (Jun 16, 2025):

@LyricZhao Hi,有几个问题想请教下:

  1. 使用 DeepGemm 做 FP8 训练,scale 是 runtime 进行的吗?如果 weight 本身是 FP8 的,那是不是不需要 scale 了?我看 DeepseekV3 论文里举得 Linear 例子仍然是保留高精度 weight,然后 runtime 量化到 fp8 进行训练,最后更新高精度 weight。
  2. 模型训完保存 checkpoint 时也是保存 fp8 格式吗?还是保存高精度呢?
    Thanks!
<!-- gh-comment-id:2974924033 --> @foreverlms commented on GitHub (Jun 16, 2025): @LyricZhao Hi,有几个问题想请教下: 1. 使用 DeepGemm 做 FP8 训练,scale 是 runtime 进行的吗?如果 weight 本身是 FP8 的,那是不是不需要 scale 了?我看 DeepseekV3 论文里举得 Linear 例子仍然是保留高精度 weight,然后 runtime 量化到 fp8 进行训练,最后更新高精度 weight。 2. 模型训完保存 checkpoint 时也是保存 fp8 格式吗?还是保存高精度呢? Thanks!
Author
Owner

@LyricZhao commented on GitHub (Jun 16, 2025):

使用 DeepGemm 做 FP8 训练,scale 是 runtime 进行的吗?如果 weight 本身是 FP8 的,那是不是不需要 scale 了?我看 DeepseekV3 论文里举得 Linear 例子仍然是保留高精度 weight,然后 runtime 量化到 fp8 进行训练,最后更新高精度 weight。

对的,activation 是 runtime 每次都要做;weight 就是每个 step update 参数之后 cast 一次,然后一直存着。

模型训完保存 checkpoint 时也是保存 fp8 格式吗?还是保存高精度呢?

具体细节不太方便透露,但原则是至少要有高精度的 weight,累加还是要往 FP32 上累加;至于 FP8 的是从 FP32 cast 过来还是存一个副本,那可以框架自己斟酌。

<!-- gh-comment-id:2974937193 --> @LyricZhao commented on GitHub (Jun 16, 2025): > 使用 DeepGemm 做 FP8 训练,scale 是 runtime 进行的吗?如果 weight 本身是 FP8 的,那是不是不需要 scale 了?我看 DeepseekV3 论文里举得 Linear 例子仍然是保留高精度 weight,然后 runtime 量化到 fp8 进行训练,最后更新高精度 weight。 对的,activation 是 runtime 每次都要做;weight 就是每个 step update 参数之后 cast 一次,然后一直存着。 > 模型训完保存 checkpoint 时也是保存 fp8 格式吗?还是保存高精度呢? 具体细节不太方便透露,但原则是至少要有高精度的 weight,累加还是要往 FP32 上累加;至于 FP8 的是从 FP32 cast 过来还是存一个副本,那可以框架自己斟酌。
Author
Owner

@foreverlms commented on GitHub (Jun 16, 2025):

谢谢解答!非常感谢开源。
One more question:

对的,activation 是 runtime 每次都要做;weight 就是每个 step update 参数之后 cast 一次,然后一直存着。

这个“一直存着”是指同时保留高精度和 fp8 两个?这样就是只利用 fp8 进行加速了吧,而不是来省显存。

<!-- gh-comment-id:2974952435 --> @foreverlms commented on GitHub (Jun 16, 2025): 谢谢解答!非常感谢开源。 One more question: > 对的,activation 是 runtime 每次都要做;weight 就是每个 step update 参数之后 cast 一次,然后一直存着。 这个“一直存着”是指同时保留高精度和 fp8 两个?这样就是只利用 fp8 进行加速了吧,而不是来省显存。
Author
Owner

@LyricZhao commented on GitHub (Jun 16, 2025):

这个“一直存着”是指同时保留高精度和 fp8 两个?这样就是只利用 fp8 进行加速了吧,而不是来省显存。

对的👍🏻 显存其实还是省的,因为 activation 都可以存 FP8,这个是大头。

<!-- gh-comment-id:2975014993 --> @LyricZhao commented on GitHub (Jun 16, 2025): > 这个“一直存着”是指同时保留高精度和 fp8 两个?这样就是只利用 fp8 进行加速了吧,而不是来省显存。 对的👍🏻 显存其实还是省的,因为 activation 都可以存 FP8,这个是大头。
Author
Owner

@foreverlms commented on GitHub (Jun 16, 2025):

这个“一直存着”是指同时保留高精度和 fp8 两个?这样就是只利用 fp8 进行加速了吧,而不是来省显存。

对的👍🏻 显存其实还是省的,因为 activation 都可以存 FP8,这个是大头。

谢谢解惑!

<!-- gh-comment-id:2975287579 --> @foreverlms commented on GitHub (Jun 16, 2025): > > 这个“一直存着”是指同时保留高精度和 fp8 两个?这样就是只利用 fp8 进行加速了吧,而不是来省显存。 > > 对的👍🏻 显存其实还是省的,因为 activation 都可以存 FP8,这个是大头。 谢谢解惑!
Author
Owner

@qijiaxing commented on GitHub (Jun 18, 2025):

我们内部有一个 结合deepGEMM & Megatron 的实验性代码,如果感兴趣的话,我们可以分享代码供参考,请发送邮件到 jqi@nvidia.com,包含姓名,公司,用途。

<!-- gh-comment-id:2983593735 --> @qijiaxing commented on GitHub (Jun 18, 2025): 我们内部有一个 结合deepGEMM & Megatron 的实验性代码,如果感兴趣的话,我们可以分享代码供参考,请发送邮件到 jqi@nvidia.com,包含姓名,公司,用途。
Author
Owner

@Opdoop commented on GitHub (Jun 28, 2025):

@qijiaxing 这个特性什么时候会merge到megatron里?🤔

<!-- gh-comment-id:3015067791 --> @Opdoop commented on GitHub (Jun 28, 2025): @qijiaxing 这个特性什么时候会merge到megatron里?🤔
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepGEMM#63
No description provided.