Prime Intellect发布MoE训练加速内核
Prime Intellect Releases Prime Mega MoE: Trainable Fused MoE Kernel, 3.11x Faster Forward Pass
MoE训练是算力大户,这个工具把训练步长直接砍掉一半以上,对跑大规模稀疏模型的同学来说能省大量GPU开销,建议压测对比。
Prime Intellect has released Prime Mega MoE, a training extension of DeepSeek’s fused Mega MoE kernel. DeepSeek’s kernel only ran the forward pass. Prime Intellect added a fast, overlapping backward pass. That makes the fused kernel usable for training, not just inference. In its prime-rl trainer, full training steps on Qwen3 MoE models run up to 34% faster. Against TorchTitan, the gain reaches 55%. For teams training mixture-of-experts (MoE) models, that is a direct cut in GPU hours.
Prime Intellect 发布了 Prime Mega MoE,这是对 DeepSeek 的融合 Mega MoE 内核的训练扩展。DeepSeek 的内核仅运行前向传播。Prime Intellect 添加了快速且重叠的后向传播。这使得融合内核可用于训练,而不仅仅是推理。在其 prime-rl 训练器中,Qwen3 MoE 模型的完整训练步骤速度最高提升 34%。与 TorchTitan 相比,性能提升达到 55%。对于训练混合专家(MoE)模型团队而言,这意味着 GPU 机时的直接减少。
TL;DR
- Size: A GPU kernel, not a model. Tested on Qwen3-30B-A3B and Qwen3-235B-A22B (128 experts, top-8 routing).
- Runs on: NVIDIA Hopper (blockwise FP8) and Blackwell (MXFP8) GPUs, BF16 on both. Published numbers use 8×H200 nodes, 32 to 128 GPUs.
- Performance: 32% to 34% faster full training steps than the prime-rl baseline. 48% to 55% faster than TorchTitan.
- Best: 3.11x faster forward pass on a Qwen3-30B-A3B MoE layer (12.0 ms to 3.9 ms).
- Worst: 1.24x backward pass on a Qwen3-235B-A22B MoE layer (30.5 ms to 24.6 ms).
- 规模:这是一个 GPU 内核,而非模型。在 Qwen3-30B-A3B 和 Qwen3-235B-A22B(128 个专家,top-8 路由)上进行了测试。
- 支持平台:NVIDIA Hopper(分块 FP8)和 Blackwell(MXFP8)GPU,两者均支持 BF16。公布的数字基于 8×H200 节点,32 至 128 个 GPU。
- 性能:比 prime-rl 基线的完整训练步骤快 32% 至 34%。比 TorchTitan 快 48% 至 55%。
- 最佳表现:在 Qwen3-30B-A3B MoE 层的前向传播速度快了 3.11 倍(从 12.0 毫秒降至 3.9 毫秒)。
- 最差表现:在 Qwen3-235B-A22B MoE 层的后向传播速度慢了 1.24 倍(从 30.5 毫秒降至 24.6 毫秒)。
What is Prime Mega MoE?
什么是 Prime Mega MoE?
Prime Mega MoE is a fused, overlapping MoE kernel for training from Prime Intellect. It builds on the Mega MoE kernel in DeepSeek’s open-source DeepGEMM library.
Prime Mega MoE 是 Prime Intellect 提供的用于训练的融合、重叠式 MoE 内核。它建立在 DeepSeek 开源库 DeepGEMM 中的 Mega MoE 内核之上。
Why is MoE training communication-bound?
为什么 MoE 训练受通信限制?
In an MoE model, each token goes to a small subset of experts. Those experts sit on different GPUs. So every layer sends tokens out, runs expert math, and sends results back. This happens in the forward pass and again in the backward pass.
在 MoE 模型中,每个令牌被分配给一小部分专家。这些专家位于不同的 GPU 上。因此,每一层都会将令牌发送出去,执行专家计算,然后将结果发回。这在前向传播中发生一次,在后向传播中又发生一次。
In a standard setup, these are separate operations. The GPU sorts tokens and waits on the transport layer. Then it computes, hands results back, and waits again. Those waits are idle GPU time.
在标准设置中,这些是分开的操作。GPU 对令牌进行排序并等待传输层。然后它进行计算,交还结果,并再次等待。这些等待时间是空闲的 GPU 时间。
How does the fused kernel work?
融合内核是如何工作的?
DeepSeek’s Mega MoE, added to DeepGEMM in April 2026, replaces that chain with one kernel call. It fuses expert-parallel dispatch, the 2 expert linear layers, SwiGLU, and combine. While one token group is in transit, the kernel computes on a group that already arrived. It also skips intermediate tensors by using GPU-only scratch buffers. But it only shipped a forward implementation.
DeepSeek 于 2026 年 4 月添加到 DeepGEMM 中的 Mega MoE 用单次内核调用替换了该链条。它融合了专家并行分发、两个专家线性层、SwiGLU 和合并操作。当一个令牌组在传输途中时,内核会对已到达的组进行计算。它还通过使用仅限 GPU 的临时缓冲区跳过中间张量。但它仅发布了前向实现。
Prime Intellect wrote the missing backward kernel, also overlapping. Supported types are BF16, MXFP8 (Blackwell only) and blockwise FP8 (Hopper only). The prime-rl config also exposes an fp8_bwd mode: BF16 forward, FP8 backward.
Prime Intellect 编写了缺失的后向内核,同样具有重叠特性。支持的类型包括 BF16、MXFP8(仅限 Blackwell)和分块 FP8(仅限 Hopper)。prime-rl 配置还暴露了一个 fp8_bwd 模式:BF16 前向,FP8 后向。
How fast is Prime Mega MoE?
Prime Mega MoE 有多快?
All numbers below are self-reported by Prime Intellect. Training steps use 8×H200 nodes, FP8, 16,384-token sequences and full activation checkpointing. Each result is the mean of steps 6 to 20.
以下所有数据均由 Prime Intellect 自行报告。训练步骤使用 8×H200 节点、FP8 精度、16,384-token 序列以及完整的激活检查点(activation checkpointing)。每项结果均为第 6 至 20 步的平均值。
Full training step, seconds (lower is better):
完整训练步骤耗时,秒(越低越好):
| Model (cluster) | prime-rl baseline | TorchTitan (FP8) | Prime Mega MoE | Gain vs baseline | Gain vs TorchTitan |
|---|---|---|---|---|---|
| Qwen3-30B-A3B (32 H200) | 2.78 | 3.07 | 2.08 | 34% | 48% |
| Qwen3-235B-A22B (128 H200) | 12.72 | 14.98 | 9.65 | 32% | 55% |
| 模型(集群) | prime-rl 基线 | TorchTitan (FP8) | Prime Mega MoE | 相比基线的提升 | 相比 TorchTitan 的提升 |
|---|---|---|---|---|---|
| Qwen3-30B-A3B (32 H200) | 2.78 | 3.07 | 2.08 | 34% | 48% |
| Qwen3-235B-A22B (128 H200) | 12.72 | 14.98 | 9.65 | 32% | 55% |
Against TorchTitan, throughput rose from 5,337 to 7,886 tokens/s/GPU on the 30B model. On the 235B model, it rose from 1,094 to 1,697. The prime-rl baseline uses torch all-to-all plus DeepGEMM FP8 experts.
与 TorchTitan 相比,30B 模型的吞吐量从每 GPU 每秒 5,337 token 提升至 7,886 token。在 235B 模型上,从每 GPU 每秒 1,094 token 提升至 1,697 token。prime-rl 基线使用 torch all-to-all 加上 DeepGEMM FP8 experts。
Single MoE layer, milliseconds (1 node, 8×H200, EP=8, 128 experts, top-8, random routing):
单个 MoE 层耗时,毫秒(1 个节点,8×H200,EP=8,128 个专家,top-8,随机路由):
| Layer | Forward | Backward | Full layer (2x fwd + bwd) |
|---|---|---|---|
| Qwen3-30B-A3B | 12.0 to 3.9 (3.11x) | 15.4 to 8.2 (1.87x) | 39.3 to 15.9 (2.47x) |
| Qwen3-235B-A22B | 20.7 to 9.5 (2.17x) | 30.5 to 24.6 (1.24x) | 71.9 to 43.7 (1.64x) |
| 层 | 前向传播 | 反向传播 | 完整层(2x fwd + bwd) |
|---|---|---|---|
| Qwen3-30B-A3B | 12.0 降至 3.9 (3.11倍) | 15.4 降至 8.2 (1.87倍) | 39.3 降至 15.9 (2.47倍) |
| Qwen3-235B-A22B | 20.7 降至 9.5 (2.17倍) | 30.5 降至 24.6 (1.24倍) | 71.9 降至 43.7 (1.64倍) |
The pattern is clear. Forward gains are large, and backward gains are smaller. The headline “up to 3.11x” refers to the forward pass only.
模式很清晰。前向传播的收益较大,反向传播的收益较小。 headline “最高达 3.11 倍”仅指前向传播。
How does it compare with other fused MoE options?
它与其他融合 MoE 选项相比如何?
| Feature | Prime Mega MoE | DeepGEMM Mega MoE | TorchTitan + DeepEP | AMD Primus MegaMoE |
|---|---|---|---|---|
| Developer | Prime Intellect | DeepSeek | PyTorch, Nebius | AMD |
| Training (backward) | Yes, fused and overlapping | No, forward only | Yes (separate dispatch kernels) | Yes, per design docs |
| Compute and comms fused | Yes | Yes | No | Yes (dispatch+GEMM1, GEMM2+combine) |
| GPUs | Hopper, Blackwell | SM90, SM100 (library) | B200 in published runs | MI355X (gfx950) |
| Data types | BF16, MXFP8, blockwise FP8 | FP8xFP8, FP8xFP4 | BF16, MXFP8 grouped GEMMs | BF16, MXFP8 |
| Published speedup | Up to 55% step time vs TorchTitan | Not disclosed | Up to 41% on DeepSeek-V3 671B | Not disclosed |
| License | Apache 2.0 (prime-rl) | MIT | BSD-3-Clause | MIT |
| 特性 | Prime Mega MoE | DeepGEMM Mega MoE | TorchTitan + DeepEP | AMD Primus MegaMoE |
|---|---|---|---|---|
| 开发者 | Prime Intellect | DeepSeek | PyTorch, Nebius | AMD |
| 训练(反向传播) | 是,融合且重叠 | 否,仅前向传播 | 是(独立的分发内核) | 是,按设计文档 |
| 计算与通信融合 | 是 | 是 | 否 | 是(分发+GEMM1,GEMM2+合并) |
| GPU | Hopper, Blackwell | SM90, SM100(库) | 已发布运行中使用 B200 | MI355X (gfx950) |
| 数据类型 | BF16, MXFP8, blockwise FP8 | FP8xFP8, FP8xFP4 | BF16, MXFP8 grouped GEMMs | BF16, MXFP8 |
| 已发布的加速比 | 相比 TorchTitan 步骤时间最高减少 55% | 未披露 | DeepSeek-V3 671B 上最高提升 41% | 未披露 |
| 许可证 | Apache 2.0 (prime-rl) | MIT | BSD-3-Clause | MIT |
TorchTitan’s 41% gain comes from a different setup (B200, 671B model, BF16 baseline). It is not directly comparable.
TorchTitan 的 41% 增益来自不同的设置(B200、671B 模型、BF16 基线)。两者不可直接比较。
How do developers use it?
开发者如何使用它?
Prime Mega MoE is a dispatch backend in prime-rl. Set type = "mega_moe" under [trainer.model.moe.dispatch]. Choose precision from bf16, mxfp8, fp8 or fp8_bwd. The training kernels ship in a prebuilt DeepGEMM wheel from prime-kernels. The stock DeepGEMM build lacks them.
Prime Mega MoE 是 prime-rl 中的分发后端。在 [trainer.model.moe.dispatch] 下设置 type = "mega_moe"。从 bf16、mxfp8、fp8 或 fp8_bwd 中选择精度。训练内核随 prime-kernels 中的预构建 DeepGEMM wheel 一起提供。标准的 DeepGEMM 构建版本缺少这些内核。
Key Takeaways
关键要点
- Prime Mega MoE adds a fused, overlapping backward pass to DeepSeek’s Mega MoE.
- Full training steps run 32% to 34% faster than the prime-rl baseline.
- Against TorchTitan, steps run 48% to 55% faster on Qwen3 MoE models.
- Forward gains reach 3.11x, but backward gains drop to 1.24x on large layers.
- It ships in prime-rl as the mega_moe dispatch backend.
- Prime Mega MoE 为 DeepSeek 的 Mega MoE 添加了融合且重叠的反向传播。
- 完整训练步骤比 prime-rl 基线快 32% 至 34%。
- 与 TorchTitan 相比,在 Qwen3 MoE 模型上,步骤运行速度提升了 48% 至 55%。
- 前向传播性能提升达 3.11 倍,但在大层上反向传播性能提升降至 1.24 倍。
- 它作为 mega_moe 分发后端已集成到 prime-rl 中。
Check out the Prime Mega MoE blog post, the announcement on X, and the prime-rl repo. Also, feel free to follow us on Twitter and don’t forget to join our 150k+ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well.
请参阅 Prime Mega MoE 博客文章、X 平台上的公告以及 prime-rl 仓库。也欢迎在 Twitter 上关注我们,别忘了加入拥有超过 15 万成员的 ML SubReddit 并订阅我们的新闻通讯。等等!你也在 Telegram 上吗?现在你也可以加入我们的 Telegram 群组。
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力