miniTE 技术报告:基于原生 NVFP4 的稳定高效强化学习
原题miniTE Technical Report: Stable and Efficient Reinforcement Learning with Native NVFP4
推荐理由miniTE 将低精度强化学习的不稳定性追到数值误差和执行差异。训练团队可借此区分本地计算加速、更新质量和端到端收益。
读前速览
miniTE 技术报告介绍了用于稳定原生 NVFP4 强化学习的 TRIAGE 方法,以及一个在 8×B300 GPU 上相比 BF16 实现 1.33-1.37 倍加速的框架,同时指出了与 BF16 级别学习效果之间仍存在的差距。
原生 NVFP4 强化学习因数值不匹配累积而在训练后期变得不稳定
实验表明,量化误差、激活缩放粒度、KV 缓存精度、检查点转换以及框架执行差异会导致训练-采样对数概率差距不断扩大、熵异常以及数百步后奖励崩溃,且稠密模型比 MoE 模型更早出现失败。
TRIAGE 通过更新方向控制残余不匹配风险来稳定学习
TRIAGE 根据量化不匹配方向与梯度方向之间的一致性,在高风险 token 片段中调整策略更新,从而降低数值误差对学习动态的影响,而无需实现完美的数值匹配。
miniTE 框架将量化策略与计算后端分离,使低精度训练切实可行
miniTE 提供分层接口、显式精度配方、选择性量化、数值监控与确定性执行模式,使开发者能够在现有工作流中替换计算路径,同时评估正确性、学习行为与运行时成本。
与 Transformer Engine 的联合优化实现了显著加速,但尚未达到 BF16 级别的学习效果
采用连续布局、设备端 amax 计算、分组 GEMM 与算子融合的逐 token NVFP4 实现,在 8×B300 上带来 1.33-1.37 倍学习器更新加速与 1.64 倍服务吞吐量,然而权重转换/同步开销与残余敏感性使得在线 RL 中仍无法匹配 BF16 的最终结果。
算子匹配与微小数值差距并不能保证等价的学习结果
报告表明,即使算子对齐且平均不匹配降低,低精度训练仍对误差方向、局部结构、更新规则与同步瓶颈敏感,需要在误差容忍度与优化目标对齐方面开展进一步研究。
完整摘要
这份来自 LMSYS 的技术报告研究了原生 NVFP4 强化学习在训练后期的不稳定性,将失败原因追溯到量化误差、激活缩放粒度、KV 缓存精度,以及训练与推理框架之间的执行不一致。作者提出了 TRIAGE,一种方向感知算法,根据不匹配程度与更新方向在高风险片段中调整更新,从而提升稳定性与任务表现。他们还提出了 miniTE,一个模块化框架,将量化策略、线性层与计算后端分离,以减少数值差异并优化低精度计算。与 NVIDIA Transformer Engine 的联合工作实现了逐 token NVFP4,采用连续布局、设备端元数据、amax 复用、分组 GEMM 与算子融合。在 8×B300 GPU 上,采用 BF16 反向传播的 miniTE 在完整学习器更新上实现 1.33-1.37 倍加速,而固定输出服务测试达到 1.64 倍吞吐量。报告坦诚指出,更低的不匹配与更快的本地计算尚不能保证 BF16 级别的学习效果或端到端 RL 加速,并强调了权重同步瓶颈以及进一步研究误差容忍度与更新规则的必要性。
目录 · 40 节
- 问题与诊断 · 原生 NVFP4 强化学习在训练后期可能变得不稳定。我们考察量化、激活缩放、KV 缓存和执行路径,并研究它们的误差如何影响更新。Problem and diagnosis · Native NVFP4 RL can become unstable late in training. We examine quantization, activation scaling, KV caches, and execution paths, then study how their errors affect updates.
- 算法与工程 · TRIAGE 通过更新方向控制残余失配风险。miniTE 减少数值执行差异,并优化低精度计算。我们分别评估这两者。Algorithm & engineering · TRIAGE controls residual mismatch risk through update direction. miniTE reduces numerical execution differences and optimizes low-precision computation. We evaluate them separately.
- 实测提升 · 在 8×B300 上,使用 BF16 反向传播的 miniTE 在完整学习器更新中的速度约为 BF16 的 1.33–1.37 倍。另一项固定输出的服务测试中,吞吐量约提升至 1.64 倍。Measured gains · On 8×B300, miniTE with BF16 backward achieves approximately 1.33–1.37× BF16 speed for complete learner updates. A separate fixed-output serving test reaches approximately 1.64× throughput.
- 局限与待解决问题 · 在所报告的在线 RL 运行中,权重转换和同步偏移采样带来了收益。实际使用的 miniTE 检查点在五项任务的平均表现上仍低于 BF16。算子匹配且误差差距较小,并不保证学习效果达到 BF16 水平;误差容忍度、更新规则和最终结果仍需进一步研究。Limits and open questions · In the reported online RL run, weight conversion and synchronization offset sampling gains. The practical miniTE checkpoint also remains below BF16 on the five-task average. Matching operators and obtaining a small gap do not guarantee BF16-level learning; error tolerance, update rules, and final outcomes need further study.
摘要Abstract
原生 NVFP4 强化学习必须在量化误差和执行误差下保持稳定,同时带来切实的效率提升。我们通过考察量化格式、激活缩放、KV 缓存精度以及会影响策略概率的框架差异,研究训练后期的不稳定性。TRIAGE 根据高风险片段中的失配情况和更新方向调整更新,以解决残余失配问题,从而提升稳定性和任务表现。miniTE 将量化策略、线性层和计算后端分离,提供精度配置、对齐检查和性能分析。围绕 Transformer Engine 的逐 token NVFP4 路径开展的协作,则利用连续布局、设备端元数据、amax(最大绝对值)复用、分组 GEMM 和融合,降低准备与调度开销。在 8×B300 上,miniTE 的两条路径均采用 BF16 反向传播,与 BF16 相比,完整学习器更新的配对加速比约为 1.33–1.37×。另一个固定输出的服务测试实现了约 1.64× 的 BF16 吞吐量。这些学习效果和系统结果来自不同配置;较低的失配和更快的本地计算尚不能证明其学习效果达到 BF16 水平,也不能证明端到端强化学习速度有所提升。Native NVFP4 reinforcement learning must remain stable under quantization and execution error while delivering practical efficiency gains. We investigate late-training instability by examining quantization formats, activation scaling, KV-cache precision, and framework differences that affect policy probabilities. TRIAGE addresses residual mismatch by adjusting updates in high-risk segments according to the mismatch and update directions, improving stability and task performance. miniTE separates quantization policy, linear layers, and compute backends, providing precision configuration, alignment checks, and performance analysis. Joint work on Transformer Engine’s per-token NVFP4 path uses contiguous layouts, device-side metadata, amax (maximum absolute value) reuse, grouped GEMM, and fusion to reduce preparation and dispatch overhead. On 8×B300, both miniTE paths with BF16 backward achieve approximately 1.33–1.37× paired speedups over BF16 for complete learner updates. A separate fixed-output serving test reaches approximately 1.64× BF16 throughput. These learning and system results come from separate configurations; lower mismatch and faster local computation do not yet establish BF16-level learning or an end-to-end RL speedup.
1. 引言1. Introduction
大型语言模型的强化学习会反复执行 rollout、策略概率重新计算、梯度更新和权重同步。较长的响应会增加生成和训练的 token 量,因此低精度计算更具价值。Blackwell 支持原生 NVFP4 矩阵乘法,先前的预训练工作已证明,通过缩放、混合精度和合适的舍入策略可以进行低比特训练 [1]。强化学习循环还必须衔接训练框架和推理框架所采用的数值实现。Reinforcement learning for large language models repeatedly performs rollouts, policy-probability recomputation, gradient updates, and weight synchronization. Long responses increase the token volume for both generation and training, making low-precision computation valuable. Blackwell supports native NVFP4 matrix multiplication, and prior pretraining work has demonstrated low-bit training with scaling, mixed precision, and suitable rounding strategies [1]. An RL loop must additionally connect the numerical implementations used by the training and inference frameworks.
我们早期的 NVFP4 实验最初提升了奖励,但随后出现熵异常、训练与采样之间的对数概率差距不断扩大,以及奖励下降等问题。量化误差、检查点转换、激活缩放、KV 缓存精度,以及两端的算子执行都会影响结果。仅替换一个量化算子,或确认两端都使用了 NVFP4,并不能解决所有这些问题。Our early NVFP4 runs improved reward initially but later developed abnormal entropy, growing training–sampling log-probability gaps, and declining reward. Quantization error, checkpoint conversion, activation scaling, KV-cache precision, and operator execution on both sides affected the outcome. Replacing a single quantization operator, or confirming that both sides used NVFP4, did not resolve all of these issues.
我们首先描述这些故障,然后通过受控实验识别并定位其成因。由此形成互补的算法与工程两条路径。TRIAGE 修改更新规则,以控制残差失配对学习的影响。miniTE 则着眼于数值执行,在减少可避免差异的同时,将低精度计算转化为切实的效率提升。We first describe the failures, then use controlled experiments to identify and locate their causes. This leads to complementary algorithmic and engineering tracks. TRIAGE changes the update rule to control the effect of residual mismatch on learning. miniTE acts on numerical execution, reducing avoidable differences while turning low-precision computation into practical efficiency gains.
在大型训练框架中,更改缩放粒度或 GEMM 后端可能需要调整层包装器、分组布局、通信和自动微分。miniTE 将量化策略与这些共享功能分离,使开发者能够在现有训练工作流中替换计算路径,随后评估其数值正确性、学习效果和运行时开销。In a large training framework, changing scale granularity or a GEMM backend can require changes to layer wrappers, grouped layouts, communication, and autograd. miniTE separates quantization policy from these shared functions, allowing developers to replace a compute path within an existing training workflow and then evaluate its numerical correctness, learning behavior, and runtime cost.
第 2 节追溯原生 NVFP4 强化学习失败的情况并进行诊断。第 3 节介绍 TRIAGE 及其结果。第 4–7 节介绍 miniTE、实现优化、实验和使用方法。我们分别报告算法结果和系统性能,并列出每项实验的配置。Section 2 traces native NVFP4 RL failures and their diagnosis. Section 3 presents TRIAGE and its results. Sections 4–7 describe miniTE, implementation optimizations, experiments, and usage. We report algorithmic outcomes and system performance separately, with the configuration for each experiment.
2. 为什么原生 NVFP4 强化学习会变得不稳定2. Why Native NVFP4 RL Becomes Unstable
2.1 训练过程中出现故障2.1 Failure Develops During Training
我们使用 Qwen3-4B 和 Qwen3-30B-A3B [4,5,6],在 DAPO 数学任务上运行 GRPO。在早期的原生 NVFP4 运行中,奖励正常上升,随后训练表现开始恶化。在 TRIAGE 分析的训练轨迹中,4B 模型在约 300 步后变得不稳定,而 30B 模型的失配则在约 700 步后开始迅速扩大。要诊断这一过程,需要对整个训练期间进行测量,而不能只依赖单个初始误差值或一段较短的损失曲线。We run GRPO on DAPO mathematics tasks with Qwen3-4B and Qwen3-30B-A3B [4,5,6]. In early native NVFP4 runs, reward increased normally before training deteriorated. In the trajectories analyzed by TRIAGE, the 4B model became unstable after approximately 300 steps, while mismatch in the 30B model began growing rapidly after approximately 700 steps. Diagnosing this process requires measurements over training time rather than a single initial error value or a short loss curve.
我们跟踪奖励、熵、训练与采样之间的对数概率差,以及下游任务得分。对于响应 \(i\) 中的 token \(t\),定义 \[ \delta_{i,t}=\log\pi_{\mathrm l}(y_{i,t}\mid x_i,y_{i,<t})-\log\pi_{\mathrm s}(y_{i,t}\mid x_i,y_{i,<t})。 \] 其中,\(x_i\) 是提示,\(y_{i,t}\) 是当前 token,\(y_{i,<t}\) 是它前面生成的前缀。学习器和采样器分别赋予条件概率 \(\pi_{\mathrm l}\) 和 \(\pi_{\mathrm s}\);\(\log\) 表示自然对数。差值为负表示学习器赋予的概率较低,为正则表示其赋予的概率较高。平均绝对差是对正在评估的 token 的 \(|\delta_{i,t}|\) 求平均。We track reward, entropy, the training–sampling log-probability gap, and downstream task scores. For token tt in response ii , define δi,t =logπl( yi,t ∣xi, yi,<t )−logπs( yi,t ∣xi, yi,<t ) \delta_{i,t}=\log\pi_{\mathrm l}(y_{i,t}\mid x_i,y_{i,<t})-\log\pi_{\mathrm s}(y_{i,t}\mid x_i,y_{i,<t}) . Here xi x_i is the prompt, yi,t y_{i,t} is the current token, and yi,<t y_{i,<t} is its generated prefix. The learner and sampler assign conditional probabilities πl \pi_{\mathrm l} and πs \pi_{\mathrm s} ; log\log denotes the natural logarithm. A negative gap means the learner assigns a lower probability, and a positive gap means it assigns a higher one. Mean absolute gap averages ∣ δi,t ∣ |\delta_{i,t}| over the tokens being evaluated.
2.2 量化误差、转换误差与执行不匹配2.2 Quantization Error, Conversion Error, and Execution Mismatch
量化误差是将低精度计算与高精度参考结果进行比较。训练与采样不匹配则是比较学习器和采样器的实际执行情况。检查点转换和推理后端适配也可能引入额外误差。因此,在集成 RL 之前,我们会比较 BF16 推理、在线 NVFP4 量化,以及使用离线转换后的 NVFP4 权重进行推理。Quantization error compares low-precision computation with a higher-precision reference. Training–sampling mismatch compares the actual executions of the learner and sampler. Checkpoint conversion and inference-backend adaptation can introduce additional error. Before integrating RL, we therefore compare BF16 inference, online NVFP4 quantization, and inference using offline-converted NVFP4 weights.
NVFP4 使用 E2M1 表示量化值:E 和 M 分别表示指数位数和尾数位数,另有一个符号位。解码后得到 \(\hat{x}=q\,s_b\,s_g\),其中 \(q\) 是 E2M1 值,\(s_b\) 是由 16 个元素共享的 E4M3 块缩放因子,\(s_g\) 是 FP32 外层缩放因子。具体方案决定外层缩放因子是按张量、按专家还是按行计算。NVFP4 represents quantized values in E2M1: E and M give the exponent and mantissa bit counts, with one additional sign bit. Decoding gives x^=q,sb,sg \hat x=q,s_b,s_g , where qq is the E2M1 value, sb s_b is an E4M3 block scale shared by 16 elements, and sg s_g is an FP32 outer scale. The recipe determines whether the outer scale is computed per tensor, per expert, or per row.
E2M1 数据占用 4 位。每 16 个元素组成一个数据块,共享一个 E4M3 缩放因子,此外还有一个外层 FP32 缩放因子。点击载荷位并更改缩放因子,即可查看有限值和重构结果。示例中的缩放因子都是可表示的值。E2M1 data occupy 4 bits. Each block of 16 elements shares an E4M3 scale, with an additional outer FP32 scale. Click the payload bits and change the scales to inspect finite values and reconstruction. The example scales are representable values.
打开交互式图表:检查数值、切换配置、下载 SVG / CSVOpen interactive figure: inspect values, switch configurations, download SVG / CSV
Qwen3-0.6B NVFP4 预训练检查点最初因融合式 QKV 结构处理不当而出现严重的性能下降。修复后,BF16、一维量化和二维块缩放量化的 Lambda 平均准确率分别约为 0.3043、0.3056 和 0.3109。因此,在将此类故障归因于 FP4 格式之前,必须先检查转换和结构适配是否正确。A Qwen3-0.6B NVFP4 pretraining checkpoint initially suffered severe performance degradation because its fused QKV structure was handled incorrectly. After the fix, mean Lambda accuracy was approximately 0.3043 for BF16, 0.3056 for one-dimensional quantization, and 0.3109 for two-dimensional block-scaled quantization. Conversion and structural adaptation must therefore be checked before attributing such a failure to the FP4 format.
对于 Qwen3-4B,在线量化使 Lambda-base 和 Math23K 的分数相较于 BF16 分别降低了 0.0355 和 0.047。离线转换又分别带来了 0.0089 和 0.019 的额外降幅。这些对比区分了由格式和数值路径造成的损失,以及由转换和缩放因子处理额外引入的损失。For Qwen3-4B, online quantization reduced Lambda-base and Math23K scores by 0.0355 and 0.047 relative to BF16. Offline conversion introduced additional reductions of 0.0089 and 0.019. These comparisons separate the loss from the format and numerical path from the additional loss introduced by conversion and scale handling.
在强化学习中,即使双方使用相同的格式,结果也可能存在显著差异。早期配置产生了以下平均绝对对数概率差值:In RL, the two sides can differ substantially even when they use the same format. Early configurations produced the following mean absolute log-probability gaps:
| Training / sampling precision | Dense | MoE |
|---|---|---|
| BF16/BF16 | 0.0110 | 0.0172 |
| NVFP4/NVFP4 | 0.1142 | 0.0668 |
| NVFP4/BF16 | 0.1376 | 0.0621 |
| BF16/NVFP4 | 0.1690 | 0.0747 |
表 1. 早期训练与采样对比。稠密模型为 Qwen3-4B;MoE 模型为 Qwen3-30B-A3B。这些结果定位了这组配置中的错误来源。Table 1. Early training–sampling comparisons. The dense model is Qwen3-4B; the MoE model is Qwen3-30B-A3B. These results locate error sources within this set of configurations.
将离线 ModelOpt 转换替换为在线量化后,稠密模型仍存在约 0.1142 的差距。在两侧使用相同的量化/GEMM 运算符也仍会产生残余差异。因此,我们将调查范围扩大到输入组织方式、尺度计算以及量化前后的操作。Replacing offline ModelOpt conversion with online quantization still left a gap of approximately 0.1142 for the dense model. Using the same quantization/GEMM operators on both sides also left residual differences. We therefore expanded the investigation to input organization, scale computation, and operations surrounding quantization.
2.3 激活精度、缩放粒度与 KV 缓存2.3 Activation Precision, Scaling Granularity, and the KV Cache
在固定 NVFP4 权重的情况下,提高激活精度可用于测试激活量化的影响。W 和 A 分别表示权重和激活;后面的数字表示它们的位宽,因此 W4A16 表示使用 4 位权重和 16 位激活:With NVFP4 weights fixed, increasing activation precision tests the effect of activation quantization. W and A denote weights and activations; the following numbers give their bit widths, so W4A16 uses 4-bit weights and 16-bit activations:
| Weights / activations | Dense gap | MoE gap |
|---|---|---|
| W4A16 | 0.0139 | 0.0166 |
| W4A8, MXFP8 activations | 0.0363 | 0.0227 |
| W4A4, NVFP4 activations | 0.0903 | 0.0445 |
表 2. 使用相应的未量化推理适配路径进行的激活精度比较。该实验与表 1 属于研究的不同阶段,并非同一项消融实验。Table 2. Activation-precision comparisons using the corresponding unquant inference adaptation paths. This experiment and Table 1 belong to different stages of the investigation and are not a single ablation.
W4A16 将差距缩小到接近 BF16 参考值,表明在此配置中,激活量化是一个重要因素。在另一种固定配置下,将 KV 缓存从 FP8 改为 BF16,可将差距从 0.0721 降至 0.0583。采样器状态的精度也会影响跨框架一致性。W4A16 brings the gap close to the BF16 reference, identifying activation quantization as an important factor in this configuration. In another fixed configuration, changing the KV cache from FP8 to BF16 reduces the gap from 0.0721 to 0.0583. Sampler-state precision also affects cross-framework agreement.
接下来我们考察缩放域。Sampler 解码会处理当前 token,而 learner 通常一次处理完整响应。如果激活值的外层缩放采用张量级 amax,同一个 token 所获得的缩放值可能会因其批次中的其他 token 而异。按 token 计算 amax 会将归约范围限制在当前行,从而消除这种依赖关系。We next examine the scaling domain. Sampler decoding processes the current token, whereas the learner typically processes a full response at once. If the activation’s outer scale uses tensor-wide amax, the same token can receive different scales depending on the other tokens in its batch. Per-token amax restricts the reduction domain to the current row and removes this dependency.
设 \(x\) 为参考向量,\(\hat{x}\) 为其解码近似向量,二者均包含 \(n\) 个元素。相对 L2 误差为 \(\frac{\|\hat{x}-x\|_2}{\|x\|_2}\);信噪比为 \(\mathrm{SNR}=20\log_{10}\left(\frac{\|x\|_2}{\|\hat{x}-x\|_2}\right)\),单位为 dB;平均绝对误差为 \(\mathrm{MAE}=n^{-1}\sum_{j=1}^{n}|\hat{x}_j-x_j|\)。符号 \(\|\cdot\|_2\) 表示欧几里得范数。相对误差和信噪比要求参考向量非零。相对 L2 误差和 MAE 越低,或信噪比越高,表示重建结果越接近参考向量。Let xx be a reference vector and x^ \hat x its decoded approximation, each with nn elements. Relative L2 error is ∣x^−x∣2/∣x∣2 |\hat x-x|_2/|x|_2 ; signal-to-noise ratio is SNR=20 log10 (∣x∣2/∣x^−x∣2) \mathrm{SNR}=20\log_{10}(|x|_2/|\hat x-x|_2) , in dB; and mean absolute error is MAE=n−1 ∑j=1n ∣ x^j −xj∣ \mathrm{MAE}=n^{-1}\sum_{j=1}^{n}|\hat x_j-x_j| . The notation ∣⋅∣2 |\cdot|_2 denotes the Euclidean norm. Relative error and SNR assume a nonzero reference vector. Lower relative L2 and MAE, or higher SNR, indicate closer reconstruction.
目标 token 的 32 个输入保持不变;滑块只改变批次中另一个 token 的 amax。有限的 E2M1/E4M3 码本采用舍入到最近偶数的方式,展示块缩放值、重构值和相对 L2 误差。这是一个数学示例,而非模型或 GPU 测量;其中不包含 RHT、SR、FTZ 和填充。打印版本展示默认振幅下构造的输入和重构值。The target token’s 32 inputs remain fixed; the slider changes only another token’s amax in the batch. A finite E2M1/E4M3 codebook with round-to-nearest-even shows block scales, reconstructed values, and relative L2 error. This is a mathematical example rather than a model or GPU measurement; it excludes RHT, SR, FTZ, and padding. The print version shows the constructed inputs and reconstructed values at the default amplitude.
打开交互式图表:查看数值、切换配置、下载 SVG / CSVOpen interactive figure: inspect values, switch configurations, download SVG / CSV
缩放粒度并不能决定所有量化误差。我们在真实 QKV 输入上扫描指数位宽和尾数位宽。在 E=2 且 E4M3 缩放因子固定时,将 M 从 1 增至 4,平均 SNR 从 19.88 dB 提升至 34.96 dB,相对 L2 误差则从 0.10140 降至 0.01807。增加指数位宽并不总能带来改善,还可能与缩放因子的可表示范围产生不良交互。这些模拟格式用于识别敏感因素,并非额外的硬件原生 NVFP4 格式。Scaling granularity does not determine all quantization error. We sweep exponent and mantissa widths on real QKV inputs. With E=2 and E4M3 scales fixed, increasing M from 1 to 4 raises mean SNR from 19.88 dB to 34.96 dB and reduces relative L2 from 0.10140 to 0.01807. Increasing exponent width does not always help and can interact poorly with the scale’s representable range. These simulated formats identify sensitive factors; they are not additional hardware-native NVFP4 formats.
在一种配置中,按 token 计算的 amax 仅使初始差距略微变化,从 0.05532 变为 0.05501;但后续运行表明训练过程更加平稳。这促使我们考察误差方向、局部结构及其在训练过程中的演变,而不是仅依赖初始平均值。In one configuration, per-token amax changes the initial gap only slightly, from 0.05532 to 0.05501, while later runs show smoother training. This motivates examining error direction, local structure, and its evolution during training rather than relying on the initial average alone.
D1 · Exponent and Mantissa Sweeps: Real QKV Inputs, Simulations, and Initial RL Measurements真实 QKV 输入:可变尾数位宽Real QKV Inputs: Varying Mantissa Width
| Format | SNR E4M3 | SNR E8M0 | Rel-L2 E4M3 | Rel-L2 E8M0 |
|---|---|---|---|---|
| E2M1 | 19.88 | 17.11 | 0.10140 | 0.13950 |
| E2M2 | 26.23 | 23.98 | 0.04885 | 0.06322 |
| E2M3 | 31.19 | 30.31 | 0.02767 | 0.03051 |
| E2M4 | 34.96 | 36.41 | 0.01807 | 0.01513 |
表 2-1. 在实际预填充和单 token 生成过程中从 36 层收集的 QKV 输入,按层汇总。模拟格式并不意味着支持新硬件。Table 2-1. QKV inputs collected from 36 layers during real prefill and single-token generation, summarized across layers. The simulated formats do not imply new hardware support.
真实输入:指数范围和尺度范围Real Inputs: Exponent Range and Scale Range
| Data format | SNR with E4M3 (dB) | SNR with E8M0 (dB) |
|---|---|---|
| E2M1 | 19.88 | 17.11 |
| E3M1 | 21.50 | 19.7 |
| E4M1 | 14.39 | 19.7 |
| E5M1 | 0.0 (maximum exceeds E4M3 range) | 19.7 |
| Data format | Relative L2 with E4M3 | Relative L2 with E8M0 |
|---|---|---|
| E2M1 | 0.10140 | 0.13950 |
| E3M1 | 0.08478 | ~0.103 |
| E4M1 | 0.28937 | ~0.103 |
| E5M1 | 0.99698 (maximum exceeds E4M3 range) | ~0.103 |
在测量的输入范围内,E3M1/E4M1/E5M1 与 E8M0 缩放因子的表现相似。将 E4M3 缩放因子与更宽的数据范围结合,可能会导致缩放范围问题。因此,对于这些输入,增加指数位数不一定能提高精度。E3M1/E4M1/E5M1 with E8M0 scales behave similarly over the measured input range. Combining E4M3 scales with a wider data range can create scale-range problems. More exponent bits therefore do not necessarily improve accuracy for these inputs.
初始 RL 差距:指数位宽与尾数位宽Initial RL Gap: Exponent and Mantissa Width
| Data format | Initial gap with E4M3 |
|---|---|
| E2M1 | 0.05800700932741165 |
| E3M1 | 0.11516289412975311 |
| E4M1 | 3.412203073501587 |
| E5M1 | nan |
| Data format | Initial gap with E4M3 |
|---|---|
| E2M1 | 0.05800700932741165 |
| E2M2 | 0.042353976517915726 |
| E2M3 | 0.03562581539154053 |
| E2M4 | 0.031815189868211746 |
表 2-2. 记录的初始间隙,包括 NaN 结果。这些用于衡量初始一致性;长期训练效果另行评估。Table 2-2. Recorded initial gaps, including NaN outcomes. These measure initial agreement; long-run training is evaluated separately.
模拟输入与真实输入对比Simulated Inputs and Real-Input Comparisons
| Data format | Scale format | MAE | SNR dB |
|---|---|---|---|
| E5M1 | E4M3 | 1.485030 | 0.00 |
| E4M1 | E4M3 | 0.132963 | 20.48 |
| E3M1 | E4M3 | 0.127780 | 20.63 |
| E2M1 | E4M3 | 0.154619 | 19.62 |
| E5M1 | E8M0 | 0.128281 | 20.18 |
| E4M1 | E8M0 | 0.128281 | 20.18 |
| E3M1 | E8M0 | 0.128515 | 20.18 |
| E2M1 | E8M0 | 0.176643 | 17.97 |
| Data format | Scale format | MAE | SNR dB |
|---|---|---|---|
| E2M4 | E4M3 | 0.017888 | 36.91 |
| E2M3 | E4M3 | 0.034627 | 31.58 |
| E2M2 | E4M3 | 0.070138 | 26.04 |
| E2M1 | E4M3 | 0.142116 | 20.17 |
| E2M4 | E8M0 | 0.018970 | 37.03 |
| E2M3 | E8M0 | 0.038432 | 30.93 |
| E2M2 | E8M0 | 0.079777 | 24.93 |
| E2M1 | E8M0 | 0.176643 | 17.97 |
表 2-3. 两组模拟输入批次的 MAE/SNR,分别对应指数和尾数扫描。它们将输入分布效应与位宽效应区分开来,并且不同于对真实 QKV 均值的重复测量。完整的格式摘要如下。Table 2-3. MAE/SNR from two simulated input batches, corresponding to exponent and mantissa sweeps. They separate input-distribution effects from bit-width effects and are distinct from repeated measurements of real QKV means. The complete format summary follows.
| Format | Mean SNR | Worst SNR | Mean MAE | Mean relative L2 |
|---|---|---|---|---|
| E2M4 + E8M0 | 36.41 | 35.87 | 0.007954 | 0.01513 |
| E2M4 + E4M3 | 34.96 | 29.58 | 0.007589 | 0.01807 |
| E2M3 + E4M3 | 31.19 | 28.12 | 0.014404 | 0.02767 |
| E2M3 + E8M0 | 30.31 | 29.73 | 0.016283 | 0.03051 |
| E2M2 + E4M3 | 26.23 | 25.03 | 0.027865 | 0.04885 |
| E2M2 + E8M0 | 23.98 | 23.64 | 0.034200 | 0.06322 |
| E3M1 + E4M3 | 21.50 | 17.81 | 0.045411 | 0.08478 |
| E2M1 + E4M3 | 19.88 | 19.53 | 0.058788 | 0.10140 |
| E5M1/E4M1/E3M1 + E8M0 | ~19.7 | ~19.3 | ~0.051 | ~0.103 |
| E2M1 + E8M0 | 17.11 | 16.66 | 0.077184 | 0.13950 |
| E4M1 + E4M3 | 14.39 | 0.71 | 0.067209 | 0.28937 |
| E5M1 + E4M3 | 0.03 | 0.00 | 0.577118 | 0.99698 |
2.4 不匹配必须结合更新方向进行解读2.4 Mismatch Must Be Interpreted Alongside Update Direction
设 A_i 表示响应 i 的优势,即衡量其奖励相对于同组其他响应的高低。图中将其简写为 A,并用 δ 表示某个 token 的差距。在 GRPO 中,正优势通常会提高采样 token 的概率;负优势通常会降低其概率。当权重同步时,差距反映的是执行差异。学习器更新后,差距还包含相对于固定采样策略的参数变化。Let Ai A_i denote the advantage of response ii , measuring its reward relative to other responses in the same group. The figure abbreviates it as AA and writes a token’s gap as δ\delta . In GRPO, a positive advantage tends to increase sampled-token probabilities; a negative advantage tends to decrease them. At synchronized weights, the gap reflects execution differences. After learner updates, it also includes parameter changes relative to the fixed sampling policy.
当学习者低估某个 token(δ < 0)时,负优势更新会进一步降低其概率,从而可能放大局部偏差;正优势更新则往往会缩小偏差。当学习者高估该 token(δ > 0)时,情况正好相反。When the learner underestimates a token (δ < 0), a negative-advantage update lowers its probability further and can amplify the local discrepancy; a positive-advantage update tends to reduce it. The roles reverse when the learner overestimates the token (δ > 0).
因此,干预需要同时考虑差距的大小和更新方向。TRIAGE 根据优势和差距的符号来识别局部风险。这种局部分析为该算法提供了依据;实际更新还取决于跨 token 耦合和优化器。Intervention therefore needs both gap magnitude and update direction. TRIAGE uses the signs of advantage and gap to identify local risk. This local analysis motivates the algorithm; actual updates also depend on cross-token coupling and the optimizer.
改变 advantage 和 gap 的符号,以检查局部放大或收缩情况以及 TRIAGE 的方向条件。这展示了第 2.4 节中的局部分析。门控激活还取决于片段风险,而实际更新则取决于跨 token 耦合和优化器。Change the signs of advantage and gap to inspect local amplification or contraction and TRIAGE’s direction condition. This illustrates the local analysis in Section 2.4. Gate activation also depends on segment risk, and actual updates depend on cross-token coupling and the optimizer.
A > 0,δ < 0A > 0, δ < 0
学习器会低估,而正优势会提高概率,使其在局部上趋近采样器。TRIAGE 修复则单独作用于正优势响应中的负向片段。The learner underestimates and positive advantage raises probability, locally approaching the sampler. TRIAGE repair separately acts on negative segments in positive-advantage responses.
A > 0,δ > 0A > 0, δ > 0
这可能会在局部放大不匹配。TRIAGE 不会衰减每个产生放大效应的象限:其门控方向条件是优势为负且差距为负。This can locally amplify mismatch. TRIAGE does not attenuate every amplifying quadrant: its gate direction condition is negative advantage and negative gap.
A < 0,δ < 0A < 0, δ < 0
学习器低估了,而负优势会进一步降低概率。这满足 TRIAGE 门控的方向条件;衰减程度还取决于分段均值差距和尾部风险。The learner underestimates and negative advantage lowers probability further. This meets the TRIAGE gate direction condition; attenuation also depends on segment mean gap and tail risk.
A < 0,δ > 0A < 0, δ > 0
学习器会高估,而负优势会降低概率,使其在局部上趋近于采样器。The learner overestimates and negative advantage lowers probability, locally approaching the sampler.
打开交互式图表:检查数值、切换配置、下载 SVG / CSVOpen interactive figure: inspect values, switch configurations, download SVG / CSV
2.5 平均值可能掩盖局部风险2.5 Averages Can Hide Local Risk
在每个模型的一条诊断轨迹中,方向性变化先于全局尾部的激增。将响应划分为每段 64 个 token 后,少数尾部密集的片段造成了部分严重不匹配。包含这些片段的响应,其平均差距仍可能很小。In one diagnostic trajectory for each model, directional changes precede the explosion of the global tail. When responses are divided into 64-token segments, a small fraction of tail-dense segments accounts for part of the severe mismatch. A response containing these segments can still have a small average gap.

实验结果Experimental results
图1. TRIAGE 补充分析中的方向分布和负尾部。上方各面板显示按原始 ∣A∣|A| 加权的区域占比;下方各面板显示负尾部深度 −q₀.₀₅(δ)(−q_{0.05}(\delta)),其中 q₀.₀₅(q_{0.05})是 token 间隔的第 5 百分位数,∣A∣|A| 为绝对优势。4B 分析使用直接间隔;30B 分析使用路由回放后的残差间隔。阶段定义和局部阈值见附录。Figure 1. Directional distributions and negative tails from TRIAGE’s supplementary analysis. The upper panels show region shares weighted by the original ∣A∣|A| ; the lower panels show negative-tail depth, −q0.05(δ) -q_{0.05}(\delta) , where q0.05 q_{0.05} is the fifth percentile of the token gaps and ∣A∣|A| is the absolute advantage. The 4B analysis uses direct gaps; the 30B analysis uses residual gaps after routing replay. Stage definitions and local thresholds are given in the appendix.
这些发现带来了两项需求:一种用于管理现有堆栈中高风险更新的算法,以及一套用于比较规模、精度和算子路径的共享接口。接下来我们将介绍 TRIAGE,然后说明 miniTE 如何将对齐、实验和高效执行整合到一个可复用的框架中。These findings create two needs: an algorithm to manage risky updates in existing stacks, and shared interfaces for comparing scales, precisions, and operator paths. We next introduce TRIAGE, then describe how miniTE brings alignment, experimentation, and efficient execution into a reusable framework.
诊断 · §2Diagnosis · §2
在 NVFP4 权重固定的情况下,W4A16 将差距缩小到接近 BF16 参考水平;将 KV 缓存从 FP8 改为 BF16,可将差距从 0.0721 降至 0.0583。With NVFP4 weights fixed, W4A16 brings the gap close to the BF16 reference level; moving the KV cache from FP8 to BF16 reduces the gap from 0.0721 to 0.0583.
3. 分诊:原生 NVFP4 强化学习的方向感知稳定化3. TRIAGE: Direction-Aware Stabilization of Native NVFP4 RL
3.1 机制3.1 Mechanism
TRIAGE 基于一个已包含截断重要性采样(TIS)[10] 等重要性修正的策略目标运行。它保留原生 NVFP4 前向计算,并通过修改优化目标来处理残余不匹配。该方法结合了分段诊断、方向选择性门控和有界修复。TRIAGE operates on a policy objective that already includes importance corrections such as truncated importance sampling (TIS) [10]. It retains native NVFP4 forward computation and manages residual mismatch by modifying the optimization objective. The method combines segment diagnostics, a direction-selective gate, and bounded repair.
该门控会按 64 个 token 的片段统计平均间隔和深尾部 token 数量,以评估风险。对于负优势的高风险片段,它只会衰减负间隔 token 的更新权重;其他 token 则保留原始权重。随后在每个响应内部对加权损失进行归一化,从而重新分配更新贡献。The gate uses mean gap and deep-tail token counts in 64-token segments to assess risk. In high-risk segments with negative advantage, it attenuates update weights only for negative-gap tokens; all other tokens retain their original weights. The weighted loss is then normalized within each response, redistributing update contributions.
修复机制为正优势响应中的负分段偏移提供信号。它对 128 个 token 的分段中的平均差距施加单侧伪 Huber 惩罚,其导数有界,从而提高活跃分段中的学习器对数概率。门控机制可减少有风险的更新,而修复机制则提供分段级别的纠正信号。参数和归一化方法详见附录 B。Repair adds a signal for negative segment offsets in positive-advantage responses. It applies a one-sided pseudo-Huber penalty with bounded derivative to mean gaps in 128-token segments, increasing learner log probabilities in active segments. The gate reduces risky updates, while repair supplies a segment-level corrective signal. Parameters and normalization are specified in Appendix B.
3.2 稳定性与任务性能3.2 Stability and Task Performance
TRIAGE 的 NVFP4 基线已在两侧采用逐 token 激活缩放。该实验测量的是原生技术栈中的残差失配。TRIAGE 对 4B 模型完成了 600 步训练,对 30B 模型完成了 1,700 步。对于 4B,TIS 虽延缓了不稳定现象,但未能将其消除;对于 30B,TIS 完成了训练,但训练后期的性能较弱。TRIAGE’s NVFP4 baselines already use per-token activation scaling on both sides. The experiment measures residual mismatch in that native stack. TRIAGE completes 600 training steps for 4B and 1,700 for 30B. TIS delays but does not prevent instability for 4B; for 30B, it completes training with weaker late-stage performance.
该图使用熵、奖励和差距指标,对比了两个模型的四种训练方法。可切换模型、指标或步数范围。曲线在记录的终点处停止。默认显示原始值;也可选择居中 15/21 点均值。The figure compares four training methods across two models using entropy, reward, and gap. Switch model, metric, or step range. Traces stop at their recorded endpoints. Raw values are the default; centered 15/21-point means are selectable.
打开交互式图表:查看数值、切换配置、下载 SVG / CSVOpen interactive figure: inspect values, switch configurations, download SVG / CSV
图 2. TRIAGE 训练动态。上排为 30B,下排为 4B。从左到右依次为:熵损失、奖励和平均绝对差距。Figure 2. TRIAGE training dynamics. The upper row is 30B and the lower row 4B. From left to right: entropy loss, reward, and mean absolute gap.
| Configuration | 4B checkpoint | Five-math-task mean | 30B checkpoint | Five-math-task mean |
|---|---|---|---|---|
| BF16 | 600 | 58.26% | 1,700 | 72.41% |
| NVFP4 | 300† | 47.10% | 700† | 65.87% |
| NVFP4 + TIS | 300† | 50.76% | 1,700 | 63.18% |
| NVFP4 + TRIAGE | 600 | 58.49% | 1,700 | 70.96% |
表 3. AIME24、AIME25、MATH-500、AMC23 和 GSM8K [11,12,13] 上的非加权平均值。† 表示在出现不稳定性之前保存的检查点。最终结果与等预算比较结果区分开来,前者采用了不同的训练时长。Table 3. Unweighted mean over AIME24, AIME25, MATH-500, AMC23, and GSM8K [11,12,13]. † marks a checkpoint saved before instability. Final results with different training durations are distinguished from equal-budget comparisons.
在共享的 4B step-300 检查点上,TRIAGE 得分为 53.03%,比原生 NVFP4 和 TIS 分别高出 5.93 和 2.27 个百分点。因此,在训练预算相同的情况下,TRIAGE 也能带来收益。框架吞吐量在 miniTE 测试环境中进行评估。At the shared 4B step-300 checkpoint, TRIAGE scores 53.03%, exceeding native NVFP4 and TIS by 5.93 and 2.27 percentage points. Its benefit therefore also appears at equal training budgets. Framework throughput is evaluated in the miniTE test environment.
3.3 互补的算法与工程方向3.3 Complementary Algorithm and Engineering Tracks
TRIAGE 和 miniTE 在上述问题的不同阶段介入。残余不匹配仍然存在时,TRIAGE 会调整更新。miniTE 则直接检查并改进量化、算子及其调用方式,同时降低执行成本。接下来的章节将探讨剩余的工程问题:如何比较数值路径并降低其执行成本。我们分别评估这两条路线;将二者结合能带来多少额外收益,仍有待测试。TRIAGE and miniTE intervene at different points in the problems identified above. TRIAGE changes updates when residual mismatch remains. miniTE directly examines and improves quantization, operators, and their invocation while reducing execution cost. The following sections address the remaining engineering questions: how to compare numerical paths and reduce their execution cost. We evaluate the two tracks separately; additional gains from combining them remain to be tested.
4. miniTE:对齐数值执行并优化低精度计算4. miniTE: Aligning Numerical Execution and Optimizing Low-Precision Compute
4.1 控制数值差异与执行成本4.1 Controlling Numerical Differences and Execution Cost
NVFP4 实验经常需要进行局部修改:调整激活值的缩放粒度、为选定层采用更高精度、修改反向传播格式,以及更换量化或 GEMM 实现。当这些选择与模型模块、分布式通信和训练脚本紧密耦合时,每次实验都必须重新检查周边逻辑,因此更难定位错误。NVFP4 experiments repeatedly require local changes: activation-scale granularity, higher precision for selected layers, backward formats, and quantization or GEMM implementations. When these choices are tightly coupled to model modules, distributed communication, and training scripts, each experiment must also revisit surrounding logic, making errors harder to locate.
miniTE 在执行层解决这些问题,明确量化规则,并在数值边界一致的条件下比较 learner 和 sampler。它提供普通线性层、LayerNorm–线性组合模块,以及 MoE GroupedLinear 模块。统一的量化接口连接 Python 参考实现与优化后的后端。Megatron 和上层 RL 系统仍负责协调训练,而 SGLang 等推理框架则负责采样 [7,8]。miniTE 专注于集成、比较和优化数值策略与算子。miniTE addresses these issues at the execution layer, making quantization rules explicit and comparing the learner and sampler at matching numerical boundaries. It provides ordinary linear layers, combined LayerNorm–linear modules, and MoE GroupedLinear modules. A common quantization interface connects Python references and optimized backends. Megatron and the upper-level RL system still orchestrate training, while inference frameworks such as SGLang perform sampling [7,8]. miniTE focuses on integrating, comparing, and optimizing numerical policies and operators.
图 3. miniTE 框架和 MoE 计算路径。右侧面板展开了 GroupedLinear 的逐 token NVFP4 前向路径和三种反向传播选项,并展示了稠密打包方式。节点说明依据代码,涵盖张量形状、缩放、布局、amax 复用、GEMM 调度和并行约束。学习器与采样器的检查会对比编码和缩放值、专家输出以及 token 对数概率,并确保权重版本、缩放域、舍入方式和组合方式相匹配。Figure 3. miniTE framework and MoE compute paths. The right panel expands the GroupedLinear per-token NVFP4 forward path and three backward choices, with dense packaging illustrated. Node descriptions follow the code for tensor shapes, scaling, layout, amax reuse, GEMM dispatch, and parallel constraints. Learner–sampler checks compare codes and scales, expert outputs, and token log probabilities under matched weight versions, scale domains, rounding, and composition.
打开交互式图表:查看数值、切换配置、下载 SVG / CSVOpen interactive figure: inspect values, switch configurations, download SVG / CSV
4.2 分层接口与 Transformer 引擎集成4.2 Layered Interfaces and Transformer Engine Integration
模块层保留训练框架所需的参数、自动求导和分布式接口。量化策略层规定格式和缩放因子。计算后端负责实现量化和 GEMM。开发者可以先通过参考实现验证数值行为,再将 CUDA、CUTLASS 或 TE 实现集成到相同接口之后。The module layer retains parameters, autograd, and distributed interfaces needed by the training framework. The quantization-policy layer specifies formats and scales. Compute backends implement quantization and GEMM. Developers can validate numerical behavior with a reference before integrating CUDA, CUTLASS, or TE implementations behind the same interfaces.
| Layer | Components | Extension point |
|---|---|---|
| Module | Linear, LayerNormLinear, GroupedLinear |
Model integration and distributed wrappers |
| Precision configuration | RecipeSpec, get_qlinear_params, QLinearParams |
Named selection; activation, weight, gradient, and fprop/dgrad/wgrad precision |
| Quantization interfaces | quantize, group_quantize |
Quantization parameters, scale granularity, padding, grouping |
| Matrix multiplication | qgemm and backends |
Encoded data, scale layouts, GEMM dispatch |
| Diagnostics | Tensor statistics, profiling, cross-framework collection and comparison | Numerical regression and profiling |
表 4. miniTE 的职责。新的数值策略主要在量化层和后端层实现,并复用共享的模块逻辑。Table 4. miniTE responsibilities. New numerical policies are primarily implemented in the quantization and backend layers, reusing shared module logic.
TE 集成是核心设计要求。miniTE 遵循现有的 Linear 接口和检查点参数名称,使 Megatron 封装器能够替换相应模块,同时复用周边的训练工作流。针对每种集成路径,都会验证参数加载、额外状态和并行模式,以平衡迁移成本与行为一致性。TE integration is a core design requirement. miniTE follows existing Linear interfaces and checkpoint parameter names so Megatron wrappers can replace the corresponding modules while reusing the surrounding training workflow. Parameter loading, extra state, and parallel modes are validated for each integration path to balance migration cost and behavioral consistency.
配方注册表存储名称、用途和依赖项元数据;参数工厂则将所选配方转换为 QLinearParams。注册表和检查入口仅使用 Python 标准库。算子导入会延迟到相应的工厂分支中,因此开发者可以先检查配置,再准备其 CUDA、TE 和编译依赖项。参考路径与优化路径继续共用上层模块。The recipe registry stores names, purposes, and dependency metadata; the parameter factory converts the selection into QLinearParams. The registry and inspection entry points use only the Python standard library. Operator imports are deferred to the corresponding factory branches, so developers can inspect a configuration before preparing its CUDA, TE, and compiled dependencies. Reference and optimized paths continue to share the upper-level modules.
4.3 精度配方与选择性量化4.3 Precision Recipes and Selective Quantization
第 2 节中的 W4A16、W4A8 和 W4A4 实验要求分别配置权重和激活值。miniTE 还会分别为前向传播(fprop)、输入梯度(dgrad)和权重梯度(wgrad)设置梯度精度和 GEMM 参数。因此,新的前向量化策略无需绑定特定的反向传播精度。The W4A16, W4A8, and W4A4 experiments in Section 2 require independent configuration of weights and activations. miniTE additionally separates gradient precision and GEMM settings for forward propagation (fprop), input gradients (dgrad), and weight gradients (wgrad). A new forward quantization policy therefore need not commit to a particular backward precision.
版本 1.0.0 通过 MINITE_RECIPE 或 get_qlinear_params 选择命名配方,包括 nvfp4_per_token 和 nvfp4_per_token_bf16_bwd。显式指定的层级 qlinear_params 优先于环境变量选择器。层名称覆盖和按层编号排除量化功能支持敏感性分析。开发可以从参考量化开始:确定缩放因子和编码方式,选择 GEMM 后端,然后比较全精度与量化后的反向传播路径。Version 1.0.0 selects named recipes through MINITE_RECIPE or get_qlinear_params, including nvfp4_per_token and nvfp4_per_token_bf16_bwd. Explicit layer qlinear_params take priority over environment selectors. Layer-name overrides and layer-number quantization exclusions support sensitivity analysis. Development can begin with reference quantization: establish scales and encoding, choose a GEMM backend, then compare full-precision and quantized backward paths.
miniTE CUTLASS 和 miniTE per-token 是 MoE GroupedLinear 的两种实现。两者都使用 NVFP4 前向计算,并按 token 计算激活的外部缩放因子。CUTLASS 指的是一种矩阵乘法实现,而 per-token 指的是一种缩放粒度;这两个术语并不互斥,TE per-token 路径也会调用 CUTLASS 内核。主要区别如下。miniTE CUTLASS and miniTE per-token are two implementations of MoE GroupedLinear. Both use NVFP4 forward computation and compute activation outer scales per token. CUTLASS names a matrix-multiplication implementation, whereas per-token names a scaling granularity; the terms are not mutually exclusive, and the TE per-token path also calls CUTLASS kernels. The main differences are below.
| Property | miniTE CUTLASS | miniTE per-token |
|---|---|---|
| Activation outer scale | One per token | One per token |
| Weight outer scale | One per expert weight tensor | One per row of the flattened expert weights |
| Quantization and GEMM interfaces | miniTE packing and CUTLASS V2 grouped GEMM | TE per-token bulk quantization and grouped GEMM, with list/dense packaging |
| Recipe | nvfp4_cursor2_cutlass_v2 |
nvfp4_per_token |
两条路径均使用 MXFP8 反向传播和 BF16 反向传播进行了测试。反向传播精度单独配置,无法根据路径名称推断。报告中的 BF16 反向传播性能采用了层旁路(layer bypass),即保存原始 BF16 操作数并跳过反向量化。专用的 nvfp4_per_token_bf16_bwd 运算符是另一种独立实现,需要单独进行性能测量。Both paths were tested with MXFP8 backward and BF16 backward. Backward precision is configured separately and cannot be inferred from the path name. The reported BF16-backward performance uses the layer bypass, which saves the original BF16 operands and skips backward quantization. The dedicated nvfp4_per_token_bf16_bwd operator is a separate implementation and requires its own performance measurements.
该图展示了针对两种 miniTE 路径测量的前向选项和两种反向选项。BF16 反向计算使用保存的原始 BF16 操作数;更改反向计算精度不会影响 NVFP4 前向路径。静态版本展示的是 BF16 反向计算。The diagram shows the forward and two backward choices measured for both miniTE paths. BF16 backward uses saved original BF16 operands; changing backward precision leaves the NVFP4 forward path unchanged. The static version shows BF16 backward.
打开交互式图表:查看数值、切换配置、下载 SVG / CSVOpen interactive figure: inspect values, switch configurations, download SVG / CSV
公共选择器通过一个注册表解析配方,并按常用、参考和实验用途分组。这些分组说明用途。describe 会报告前向/反向行为和请求的布局;doctor 会检查所选运行时的前置条件。每个结果都会记录前向和反向精度、量化覆盖率以及源代码修订版本。Public selectors resolve recipes through one registry, grouped by common, reference, and experimental use. These groups describe purpose. describe reports forward/backward behavior and requested layout; doctor checks the selected runtime prerequisites. Each result records forward and backward precision, quantization coverage, and source revision.
4.4 数值监控、性能分析与对齐诊断4.4 Numerical Monitoring, Profiling, and Alignment Diagnostics
低精度故障可能会在训练后期出现。因此,miniTE 提供可配置的数值与性能数据采集功能。开发者可以按模块、实例、rank 和 step 检查激活值、权重、输出和梯度的最小值、最大值、均值及范数,并保存张量以复现异常。分析器会生成 Chrome 跟踪记录和内核计时统计,并分别统计计算、准备工作以及调用间隔。Low-precision failures may emerge late in training. miniTE therefore provides configurable numerical and performance collection. Developers can inspect activation, weight, output, and gradient minima, maxima, means, and norms by module, instance, rank, and step, and save tensors to reproduce anomalies. The profiler produces Chrome traces and kernel timing statistics, separating computation, preparation, and gaps between calls.
首先,要比较 learner 和 sampler,必须先对齐它们的输入。MoE dispatch 可能会改变两侧的 token 顺序;如果直接逐元素相减,就会把排列差异误判为数值误差。我们收集路由信息、专家 FC1/FC2 张量和 token 对数概率,对齐 token 与专家的身份,然后比较输出、量化数据和缩放因子。Comparing the learner and sampler first requires aligning their inputs. MoE dispatch can change token order on the two sides; direct elementwise subtraction would then mistake permutation differences for numerical error. We collect routing information, expert FC1/FC2 tensors, and token log probabilities, align token and expert identities, and then compare outputs, quantized data, and scales.
诊断会区分实际内核输出、钩子边界和参考回放。当融合内核内部的中间结果无法直接采集时,回放可以帮助定位问题,但其来源仍会明确标注。回放结果一致,并不等同于实际执行结果一致。随后,可以沿着输入与路由、量化、GEMM 以及输出概率,追踪每项配方或内核变更。Diagnostics distinguish actual kernel outputs, hook boundaries, and reference replay. Replay can locate an issue when an intermediate inside a fused kernel cannot be collected directly, but its provenance remains explicit. Agreement in replay is different from agreement in actual execution. Each recipe or kernel change can then be traced through inputs and routing, quantization, GEMM, and output probabilities.
4.5 训练-推理对齐与确定性执行(确定性模式)4.5 Train–Inference Alignment and Deterministic Execution (Deterministic Mode)
低比特训练的稳定性取决于量化精度,以及算子在训练和推理时的行为是否一致。即使采用相同的量化策略,算子实现、归约顺序或并行执行上的细微差异也可能累积成数值偏差,从而影响训练。Low-bit training stability depends on quantization precision and on whether operators behave consistently in training and inference. Even with the same quantization policy, small differences in operator implementations, reduction order, or parallel execution can accumulate into numerical discrepancies that affect training.
因此,我们在 miniTransformer 中实现了确定性模式:逐层替换 Megatron 算子,使其使用与 SGLang 推理相同的内核、公式和规约顺序。多个经过校验的关键层实现了位精确一致。We therefore implement deterministic mode in miniTransformer: layer-by-layer replacement of Megatron operators makes them use the same kernels, formulas, and reduction order as SGLang inference. Multiple checked key layers achieve bit-exact agreement.
这种逐层对齐与第 4.4 节中的张量和路由身份检查相配合。在原始记录中,严格配置禁用了 TIS,而非严格参考配置启用了 TIS。因此,该图保留了执行路径与算法校正的联合身份信息;逐位精确的层一致性和端到端对数概率差距则分别报告。This layerwise alignment works with the tensor and routing-identity checks in Section 4.4. In the original record, TIS is disabled for the strict configuration and enabled for non-strict references. The figure therefore retains the joint identity of execution paths and algorithmic correction; bit-exact layer agreement and the end-to-end log-probability gap are reported separately.
训练动态:奖励、差距和熵根据训练记录随步骤 0–1199 变化,端点分别为 871/1199/1189。默认采用居中的 15 点平均。策略梯度损失显示在下方的四面板图中。严格对齐保留原始的联合干预配置。Training dynamics: reward, gap, and entropy follow the training records over steps 0–1199, with endpoints 871/1199/1189. The default is a centered 15-point mean. policy-gradient loss is shown in the four-panel figure below. Strict alignment retains the original joint-intervention configuration.
打开交互式图表:查看数值、切换配置、下载 SVG / CSVOpen interactive figure: inspect values, switch configurations, download SVG / CSV
Reward, gap, entropy, and policy-gradient loss
图 4. 训练–采样对齐:奖励、平均绝对对数概率差、熵和策略梯度损失。粗线表示 15 步移动平均。对齐配置在测量区间内将差值降至约 10⁻⁸,并在后期保持相对稳定的奖励。此比较中有多个实现选项同时发生变化。Figure 4. Training–sampling alignment: reward, mean absolute log-probability gap, entropy, and policy-gradient loss. Thick lines are 15-step moving averages. The aligned configuration reaches a gap of approximately 10−810^{-8} over the measured interval and maintains relatively steady late-stage reward. Multiple implementation choices change together in this comparison.
在这项实验中,对齐配置下的训练与推理对数概率差降至约 10⁻⁸,后期奖励保持稳定,扰动也更小。未对齐的 NVFP4 则在后期出现奖励下降,同时熵和对数概率差上升。在此配置下,训练与推理之间的差异较小,NVFP4 的强化学习动态也更稳定。这是对不同实现配置进行的一次单次运行比较,其中多个选项同时发生了变化。这项严格对齐实验独立于第 6 节中的实用学习和吞吐量实验。In this experiment, the aligned train–inference log-probability difference falls to approximately 10−810^{-8} , with steady late-stage reward and smaller perturbations. Unaligned NVFP4 shows a late reward decline accompanied by rising entropy and log-probability difference. Within this configuration, smaller train–inference discrepancies accompany steadier NVFP4 RL dynamics. This is a single-run comparison of different implementation configurations with multiple choices changing together. This strict alignment experiment is separate from the practical learning and throughput experiments in Section 6.
miniTE 提供对齐能力,以及实现这些能力所需的配置、调试和扩展接口。新的低精度策略可以遵循相同的验证流程,从本地正确性验证到 RL 训练。miniTE provides alignment capabilities together with the configuration, debugging, and extension interfaces needed to implement them. New low-precision policies can follow the same validation process from local correctness to RL training.
对齐 · §4.5Alignment · §4.5
在严格对齐的配置下,训练与推理的对数概率差距保持在约 10⁻⁸,且后期奖励稳定。Under the strictly aligned configuration, the train–inference log-probability gap stays around 10⁻⁸, with stable late-stage reward.
5. 使用 Transformer Engine 联合实现和优化 NVFP45. Joint NVFP4 Implementation and Optimization with Transformer Engine
5.1 逐 Token 缩放的数值与实现选择5.1 Numerical and Implementation Choices for Per-Token Scaling
我们与 NVIDIA 围绕 TE 对 NVFP4 的支持开展联合测试与实现工作,并将逐 token 配方及其接口作为重要的集成点 [9]。缩放粒度会影响数值行为,也会影响 amax 的计算、缩放因子的存储以及 GEMM 尾处理开销。因此,需要同时评估准确性与速度。We conduct joint testing and implementation work with NVIDIA around TE’s NVFP4 support, using the per-token recipe and its interfaces as an important integration point [9]. Scale granularity affects numerical behavior as well as amax computation, scale storage, and GEMM epilogue cost. Accuracy and speed therefore need to be evaluated together.
NVFP4使用E2M1对数据进行编码,对每个包含16个元素的块使用E4M3缩放因子,并通过外层FP32缩放因子调整范围 [1]。设 si s_i 是第 ii 行的外层缩放因子,bi,j b_{i,j} 是该行长度为16的块。那么NVFP4 encodes data in E2M1, uses an E4M3 scale for each block of 16 elements, and adjusts the range with an outer FP32 scale [1]. Let si s_i be the outer scale of row ii , and bi,j b_{i,j} its length-16 block. Then
di,j = QE4M3 ( amax( bi,j ) 6si ) ,x^=si di,j QE2M1 ( x si di,j ) . d_{i,j}=Q_{\mathrm{E4M3}}\!\left(\frac{\operatorname{amax}(b_{i,j})}{6s_i}\right), \qquad \hat x=s_i d_{i,j}Q_{\mathrm{E2M1}}\!\left(\frac{x}{s_i d_{i,j}}\right).逐张量缩放在整个张量上共用一个外部缩放因子;逐 Token 缩放则为每一行分别计算缩放因子。后者降低了对其他 Token 最大值的依赖,并可在各行数值幅度差异很大时缓解块缩放下溢问题。它仍无法消除行内动态范围限制和 FP4 舍入误差,而且需要更细粒度的计算支持。公开系统也会将逐 Token NVFP4 前向计算与更高精度的反向计算结合起来 [2]。Per-tensor scaling shares one outer scale across a tensor; per-token scaling computes it per row. The latter reduces dependence on other tokens’ maxima and can mitigate block-scale underflow when row magnitudes differ greatly. It still retains within-row dynamic-range and FP4 rounding error, and requires finer-grained compute support. Public systems also combine per-token NVFP4 forward computation with higher-precision backward computation [2].
我们保留多种方案,并将数值选择与实现优化分别评估。局部量化误差更低,本身并不能证明 RL 训练更加稳定。同样,额外归约操作的成本也会结合完整计算路径进行评估。We retain multiple recipes and evaluate numerical choices separately from implementation optimizations. Lower local quantization error alone does not establish more stable RL training. The cost of additional reductions is likewise evaluated over the full computation path.
D2 · 20k-Step Language-Model Loss: Per-Token versus Per-Tensor Scaling
实验结果Experimental results
图 5-1。Ling MoE,单 GPU,随机种子 11,训练 20,000 步。两种 NVFP4 配置均采用 RHT、SR 和 2D 权重量化。左图显示绝对损失;右图显示相对于相同数据上 BF16 损失的差值。最后 1k 步的相对差距分别为:逐张量 +1.317%,逐 token +1.060%。Figure 5-1. Ling MoE, single GPU, seed 11, 20,000 steps. Both NVFP4 configurations use RHT, SR, and 2D weight quantization. The left panel shows absolute loss; the right subtracts BF16 loss on the same data. Relative gaps over the final 1k steps are per-tensor +1.317% and per-token +1.060%.
在图示尺度下,绝对损失值相近;与 BF16 相减后,可以看出较小的差异。这为该缩放选择提供了长期语言模型损失方面的证据。它不同于第 6.2.2 节中的 RL+TIS 轨迹,也不能单独证明 RL 的稳定性。Absolute losses are close at the plotted scale; subtraction from BF16 reveals the smaller differences. This supplies long-run language-model loss evidence for the scaling choice. It is distinct from the RL+TIS trajectories in Section 6.2.2 and does not independently establish RL stability.
5.2 连续内存布局与分组 GEMM 调用5.2 Contiguous Layouts and Grouped GEMM Invocation
原始的分组接口可能会将量化数据和缩放因子拆分为单独的专家张量,然后为 GEMM 重建指针、步幅和布局。随着专家数量增加,Python/ATen 切片、列表构建、临时内存分配以及元数据从主机到设备的传输,可能会抵消 FP4 算术带来的性能提升。Original grouped interfaces may split quantized data and scales into separate expert tensors, then reconstruct pointers, strides, and layouts for GEMM. As expert counts increase, Python/ATen slicing, list construction, temporary allocation, and host-to-device metadata transfers can offset FP4 arithmetic gains.
我们将量化输出组织为连续缓冲区,并通过偏移量描述专家边界,直接将其传入稠密分组 GEMM。FP4 数据、块缩放因子和外层缩放因子通过同一接口传递,避免量化后拆分、计算前重新组装。设备端元数据构建和工作区复用减少了内存分配与同步拷贝。零 token 专家和填充数据也由同一分组路径处理。We organize quantization outputs into contiguous buffers and describe expert boundaries with offsets, passing them directly to dense grouped GEMM. FP4 data, block scales, and outer scales travel through the same interface, avoiding splitting after quantization and reassembly before computation. Device-side metadata construction and workspace reuse reduce allocation and synchronous copies. Zero-token experts and padding are handled within the same grouped path.
此优化改变了数据组织方式和调用方式。密集量化和 GEMM 接口会针对操作数和输出与原始列表路径进行核对;性能则通过组合后的实现进行测量。后续修订 b641179 将密集路径、GEMM 设置和融合整合到一起。核心重复测试保留其原始修订标识。This optimization changes data organization and invocation. Dense quantization and GEMM interfaces are checked against the original list path for operands and outputs; performance is measured for the combined implementation. Revision b641179 later combines the dense path, GEMM settings, and fusion. The core repeated tests retain their original revision identity.
5.3 在数据产生处计算 amax5.3 Computing amax Where Data Are Produced
一个独立的 amax 内核会先扫描激活值,之后量化器再读取一遍。我们会寻找那些已经沿着生产者到消费者路径遍历数据的操作。A separate amax kernel first scans activations, after which the quantizer reads them again. We look for operations that already traverse the data along the producer-to-consumer path.
对于 MoE FC1,输入会经过分发和置换,因此可以在重新排列 token 的同时累积逐行 amax。填充时会同时处理激活值和 amax,因此量化可以复用外部统计数据,跳过重复归约。For MoE FC1, inputs pass through dispatch and permutation, allowing rowwise amax to be accumulated during token reordering. Padding processes activations and amax together, so quantization can reuse the external statistics and skip repeated reduction.
对于 MoE FC2,最好将 amax 与激活计算融合。我们使用 _weighted_swiglu_row_amax_kernel 作为融合内核,沿用 JIT 编译实现,并在遍历列时累积 amax。该统计量针对路由器加权后的 SwiGLU 输出,也就是传入 FC2 量化的张量。复用现有的内存和计算路径,可以避免为了计算 amax 而再次完整扫描 FC2 输入。For MoE FC2, amax is better fused with activation computation. We use _weighted_swiglu_row_amax_kernel as the fused kernel, following the JIT-compiled implementation and accumulating amax while traversing columns. The statistic applies to the SwiGLU output after router weighting, exactly the tensor passed to FC2 quantization. Reusing the existing memory and computation path avoids another complete scan of the FC2 input for amax.
FC1 变换如下:The FC1 transformation is:
Original: sort → pad(activation) → amax → quantization
Fused: sort + amax → pad(activation, amax) → quantization
FC2 会与加权后的激活值一同生成 amax,并在后续量化中复用它:FC2 produces amax together with weighted activations and reuses it in subsequent quantization:
Original: SwiGLU × router weight → activation → amax → quantization
Fused: weighted SwiGLU + row-amax → activation, amax → quantization
收益必须涵盖生产者、填充操作和消费者。跳过 amax 的模块级模拟并不总是更快,因此仅仅消除一个内核本身并不能证明完整流程有所收益。第 6 节使用了包含周边工作的学习器计时结果。The benefit must cover the producer, padding, and consumer. Module-level simulations that skip amax are not always faster, so eliminating one kernel does not by itself establish a complete-flow benefit. Section 6 uses learner timings that include surrounding work.
5.4 内核优化及其适用范围5.4 Kernel Optimizations and Their Scope
内核级优化涉及跨 CTA 的 amax 归约、FC1/FC2 GEMM 流水线、scale 布局传输,以及 epilogue 中的激活/amax 融合。具体实现细节和适用范围如下。Kernel-level optimization addresses cross-CTA amax reduction, FC1/FC2 GEMM pipelines, scale-layout transfer, and activation/amax fusion in the epilogue. The implementation details and applicable scope follow.
Expand: Kernel-Level Implementation Details1. Row-amax:使用集群共享内存进行跨 CTA 归约。逐 token NVFP4 的 K1 阶段会对每一行的各个 K 瓦片计算 amax。原始路径使用 atomicMax 合并瓦片结果。优化后的路径中,各 CTA 首先计算局部 amax,并写入 leader CTA 的共享缓冲区。leader 在集群内进行归约。若一个集群覆盖所有 K 瓦片,则可直接得出最终的 row-amax;覆盖范围更大时则回退到原子操作。在记录的测试中,n_cluster=16 且 k_tile=128 时可覆盖 K=2048;将瓦片增大到 256 时可覆盖 K=4096。此优化仅替换 K1 amax;K2 cast 仍独立执行。多集群方案没有带来收益,因此已移除。该优化适用于单个集群覆盖 K 的全部或大部分范围的情况,不应将其收益外推到更大的 K 值。1. Row-amax: cluster shared memory for cross-CTA reduction. The K1 stage of per-token NVFP4 reduces amax across K-tiles for every row. The original path combines tile results with atomicMax. In the optimized path, CTAs first compute partial amax and write to the leader CTA’s shared buffer. The leader reduces within the cluster. A cluster covering all K-tiles directly produces final row-amax; larger ranges fall back to atomics. In the recorded tests, n_cluster=16 and k_tile=128 cover K=2048, while increasing the tile to 256 covers K=4096. This replaces only K1 amax; K2 cast remains separate. The multi-cluster scheme showed no benefit and was removed. The optimization applies where a single cluster covers all or most of K, without extrapolating its benefit to larger K.
2. FC1/FC2 GEMM:根据归约长度选择 tile 和 pipeline。两层都使用分组 NVFP4 GEMM,但它们的 K 长度和 epilogue 重叠条件不同。FC1 的 K 更长,MMA 循环也更多。MMA_N=256 配合 2SM 会增加每个 CTA 的工作量,让 epilogue 工作有更多机会与 MMA 重叠。FC2 的 K 较短;若使用 256 列并搭配 OverlappingAccum,epilogue 读取可能会与下一阶段的 MMA 写入相互竞争。因此,FC2 使用 MMA_N=128 和 2SM。TMEM 有 512 列。两阶段的 256 列 tile 会占满这部分容量,没有空间留给 scale,因此需要采用 OverlappingAccum 策略,而不是默认的 TMEM 分配方式。这些配置针对测试过的 FC1/FC2 形状;最优选择会因形状而异。2. FC1/FC2 GEMM: choose tiles and pipelines by reduction length. Both layers use grouped NVFP4 GEMM, but their K lengths and epilogue-overlap conditions differ. FC1 has a longer K and MMA loop. MMA_N=256 with 2SM increases work per CTA and gives epilogue work more opportunity to overlap MMA. FC2 has a shorter K; reusing 256 columns with OverlappingAccum can make epilogue reads compete with MMA writes for the next stage. It therefore uses MMA_N=128 and 2SM. TMEM has 512 columns. A two-stage 256-column tile fills that capacity, leaving no room for scales and requiring an OverlappingAccum strategy instead of default TMEM allocation. These are configurations for the tested FC1/FC2 shapes; the optimal choice varies with shape.
3. 融合 swizzle:在 cast 时直接写入 GEMM 所需的 scale 布局。下游 GEMM 要求特定的 swizzle scale-factor 布局。原始实现会先生成紧凑的 M-major scales,然后启动 nvte_swizzle_scaling_factors,增加一次 kernel 启动和全局内存流量。融合实现为 launch_grouped_fused_cast_bf16 增加了 with_swizzle 路径,在 DO_ROW 中直接写入 cuBLASLt 128M × 4K tile 布局。禁用该路径时,仍可使用紧凑布局和单独的转换步骤。这样无需中间的 scale 重排,同时保留原有的量化公式。后续的 miniTE 逐 token 测试发现,融合与非融合路径的量化载荷逐位完全一致,scales 还原到相同布局后也完全一致,最终输出同样完全一致。3. Fused swizzle: write the GEMM scale layout directly during cast. Downstream GEMM requires a specific swizzled scale-factor layout. The original implementation produces compact M-major scales, then launches nvte_swizzle_scaling_factors, adding a kernel launch and global-memory traffic. The fused implementation adds a with_swizzle path to launch_grouped_fused_cast_bf16, writing the cuBLASLt 128M × 4K tile layout directly in DO_ROW. When disabled, the compact layout and separate conversion remain available. This eliminates intermediate scale reordering while retaining the quantization formula. Subsequent miniTE per-token tests found bit-exact agreement in quantized payloads, scales restored to the same layout, and final outputs between fused and unfused paths.
4. 激活与 epilogue 融合:在 FC1 输出处计算门控和统计量。MoE FC1 会生成成对的 gate/up 张量,通常后接 SwiGLU 或 GeGLU,并在输出侧计算 amax,以供后续量化使用。融合的 epilogue 会执行 alpha/bias 校正、成对的 gate/up 激活、路由器概率加权以及 D 侧 amax。根据配置,它会保留对 GLU 前中间结果 C 的可选写入;FP8 路径还可以生成输出缩放因子。核心数据流如下:4. Activation and epilogue fusion: compute gating and statistics at the FC1 output. MoE FC1 produces paired gate/up tensors, usually followed by SwiGLU or GeGLU and output-side amax for subsequent quantization. The fused epilogue performs alpha/bias correction, paired gate/up activation, router-probability weighting, and D-side amax. Depending on the configuration, it preserves optional writes of the pre-GLU intermediate C; the FP8 path can also generate output scale factors. The core dataflow is:
ACC = block-scaled GEMM(A, B)
ACC = ACC × α_a[m] (optionally × α_b[n]) + bias
C = gate | up (pre-GLU, width N; optionally written)
D = act(gate, up) × prob (SwiGLU/GeGLU, width N/2)
Reduce D amax concurrently; FP8 can generate output scale factors
原位计算激活值和统计信息,可减少对完整 gate/up 中间结果的写入和后续读取,以及单独的激活函数/amax 内核启动。目前,这种融合针对的是 FC1 后立即执行门控激活和量化统计的前向路径。每项优化是否纳入主要性能配置均单独记录;完整收益仍以相应模块和学习器的计时结果为准。Computing activation and statistics in place reduces writes and subsequent reads of complete gate/up intermediates, together with separate activation/amax kernel launches. This fusion currently targets forward paths in which FC1 immediately feeds gated activation and quantization statistics. Inclusion in the main performance configuration is recorded separately for each optimization; complete benefits remain based on the corresponding module and learner timings.
5.5 联合测试如何为实现方案的选择提供依据5.5 How Joint Testing Informs Implementation Choices
联合工作按照参考实现、优化实现、模块对比和模型测试的流程进行。在固定配置下进行对比,可验证接口和布局变更;跨配置对比则用于评估精度选择及其代价。BF16、原生 TE NVFP4、我们的 CUTLASS 路径以及上游逐 token 实现分别承担不同的基线角色。Joint work follows reference implementation, optimized implementation, module comparison, and model testing. Comparisons at a fixed recipe validate interface and layout changes; comparisons across recipes evaluate precision choices and their costs. BF16, native TE NVFP4, our CUTLASS path, and the upstream per-token implementation serve different baseline roles.
该流程将 TE 的能力集成到 miniTE 中,并将 miniTE 中发现的瓶颈反馈到 TE 接口和内核。按 token 划分的实现与讨论已公开发布于 PR #3045 [9]。相关结果附有修订记录、补丁和测试范围;贡献归属及上游合并状态以实际记录为准。This process integrates TE capabilities into miniTE and brings bottlenecks found in miniTE back to TE interfaces and kernels. Public per-token implementation and discussion are available in PR #3045 [9]. Revisions, patches, and test scope accompany the results; attribution and upstream merge status follow the actual records.
5.6 探索单次融合5.6 Exploring Single-Pass Fusion
我们还研究了针对融合 SwiGLU-FFN 路径的在线 amax 补偿,这类路径无需将完整的中间激活物化。FC2 会在得知整行 amax 之前就处理激活的 K 分块。该方法维护逐行运行 amax,并在外部缩放因子增大时,将先前的部分累加值转换到新的缩放尺度,从而连接 FC1、SwiGLU、量化和 FC2。We also investigate online amax compensation for fused SwiGLU-FFN paths that avoid materializing the full intermediate activation. FC2 consumes activation K-tiles before the full-row amax is known. The method maintains a running rowwise amax and converts earlier partial accumulations to the new scale whenever the outer scale increases, connecting FC1, SwiGLU, quantization, and FC2.
这一路径主要减少中间激活的内存流量和独立的内核调用。补偿可在累加各个 tile 的贡献时保持尺度一致;先前生成的 E4M3 块尺度和 E2M1 编码仍取决于当时采用的尺度和舍入方式。因此,我们将其保留为一项融合研究方向,分别评估补偿误差、与两遍执行相比的量化差异,以及完整调用链带来的收益。第 6 节将单独评估这一原型,不与主要的 B300 学习器配置合并。This path primarily reduces intermediate-activation memory traffic and separate kernel calls. Compensation maintains a consistent scale when accumulating tile contributions; the E4M3 block scales and E2M1 codes produced earlier still depend on the scale and rounding used at that time. We therefore retain it as a fusion research direction, evaluating compensation error, quantization differences from two-pass execution, and the complete call-chain benefit separately. This prototype is evaluated separately from the main B300 learner configuration in Section 6.
Expand Online Amax Compensation Quantization算法:在当前行尺度下累积 FC2 部分输出Algorithm: accumulate FC2 partial outputs in the current row scale
令 Pi P_i 表示 FC2 K-tile ii 对应的 SwiGLU 激活。完成相应 gate/up 切片的 FC1 归约,然后计算 SwiGLU、逐行绝对最大值以及每个 16 元素块的最大值。运行中的逐行 amax 和外层 scale 为Let Pi P_i denote the SwiGLU activation for FC2 K-tile ii . Complete the FC1 reduction for the corresponding gate/up slice, then compute SwiGLU, the rowwise absolute maximum, and the maximum of each 16-element block. The running rowwise amax and outer scale are
gi=max( gi−1 ,rowmax(∣Pi∣)),gsi= gi2688 ,2688=6×448. g_i=\max\bigl(g_{i-1},\operatorname{rowmax}(|P_i|)\bigr),\qquad gs_i=\frac{g_i}{2688},\qquad 2688=6\times448.对于块 \(b_b\),量化器生成 \(bs_{i,b}=Q_{\mathrm{E4M3}}\bigl(\operatorname{amax}(P_{i,b})/(6gs_i)\bigr)\) 和 \(q_{i,b}=Q_{\mathrm{E2M1}}\bigl(P_{i,b}/(bs_{i,b}gs_i)\bigr)\)。FC2 块缩放 MMA 计算For block bb , the quantizer produces b si,b = QE4M3 (amax( Pi,b )/(6gsi)) bs_{i,b}=Q_{\mathrm{E4M3}}\bigl(\operatorname{amax}(P_{i,b})/(6gs_i)\bigr) and qi,b = QE2M1 ( Pi,b /(b si,b gsi)) q_{i,b}=Q_{\mathrm{E2M1}}\bigl(P_{i,b}/(bs_{i,b}gs_i)\bigr) . FC2 block-scaled MMA computes
ΔOi=(qi⊙bsi), W~2,i ,Oi= Oi−1 g si−1 gsi +ΔOi,Y=Ok,gsk,g sW2 . \Delta O_i=(q_i\odot bs_i),\widetilde W_{2,i},\qquad O_i=O_{i-1}\frac{gs_{i-1}}{gs_i}+\Delta O_i, \qquad Y=O_k,gs_k,gs_{W2}.这里,W~2,i \widetilde W_{2,i} 包含权重块缩放因子,但不包含外层权重缩放因子 g sW2 gs_{W2};后者沿 K 维保持恒定。逐行激活缩放因子和外层权重缩放因子会分别沿对应的输出维度广播。如果外层权重缩放因子因 tile 而异,应将这种变化纳入每个部分结果,而不是在最后统一乘以一个公共因子。激活 bs 在 MMA 内部按块应用;只有外层 gs 会延迟到 epilogue 阶段处理。Here,
W~2,i
\widetilde W_{2,i}
includes the weight block scales but excludes the outer weight scale
g
sW2
gs_{W2}
, which is constant along K. The rowwise activation scale and outer weight scale are broadcast over their corresponding output dimensions. If the outer weight scale varies by tile, incorporate that variation into each partial instead of applying one common factor at the end. Activation bs is applied block by block inside MMA; only the outer gs is deferred to the epilogue.
数值条件:避免饱和并不意味着对所有 gs 都具有不变性Numerical conditions: avoiding saturation does not imply invariance for every gs
对于固定数据,gs≥amax(P)/2688 可使未舍入的块缩放因子保持在 E4M3 的最大值 448 以内。在线运行的 amax 涵盖当前 tile 的最大值,因此当前 tile 满足此条件,不会发生上限饱和。For fixed data, gs≥amax(P)/2688gs\ge\operatorname{amax}(P)/2688 keeps the unrounded block scale within the E4M3 maximum of 448. The online running amax covers the current tile maximum, so the current tile satisfies this condition against upper-range saturation.
如果没有 E4M3 舍入,\(b_s\cdot g_s=\operatorname{amax}(P_b)/6\),因此块缩放因子可以抵消外部缩放的变化。实际中,\(b_s\) 的舍入会使这个乘积产生与缩放相关的舍入残差;较大的 \(g_s\) 也可能使较小的块进入次正规数或下溢范围。如果码本始终处于正规数范围内、避开其边界,并且采用一致的舍入方式,那么按 2 的幂进行重缩放可以保持解码后的步长不变。任意缩放比例则不具备这一保证。Without E4M3 rounding,
bs⋅gs=amax(Pb)/6bs\cdot gs=\operatorname{amax}(P_b)/6
, allowing the block scale to cancel an outer-scale change. In practice, rounded bs leaves a scale-dependent rounding residual in this product; a large gs may also push small blocks into the subnormal or underflow range. Power-of-two rescaling can preserve the decoded step size when the codebook stays in the normal range, avoids its boundaries, and uses consistent rounding. Arbitrary scale ratios do not have this guarantee.
原始的重尾示例使用一行激活值,其 amax 约为 29。设计尺度和该尺度的四倍都得到 0.099 的 rel-L2;将尺度降至设计值的四分之一,则 rel-L2 升至 0.52:The original heavy-tailed example uses one activation row with amax approximately 29. The design scale and four times that scale both yield rel-L2 0.099; reducing the scale to one quarter of the design value raises rel-L2 to 0.52:
| Outer scale | rel-L2 | Block-scale upper-range behavior |
|---|---|---|
| amax / 2688 | 0.099 | 1/16 reaches 448 exactly, without exceeding it |
| 4 × amax / 2688 | 0.099 | No block reaches the upper limit |
| amax / (4 × 2688) | 0.52 | 6/16 exceeds the upper limit and is clipped |
此示例说明了饱和条件以及在指定缩放乘数下误差相等的作用。它并未证明所有高于下界的缩放值都会产生相同的编码或误差。This example illustrates the role of the saturation condition and equal error under the specified scale multiplier. It does not establish identical codes or errors for every scale above the lower bound.
补偿:在统一的外部尺度下合并各部分结果Compensation: merge partials in one common outer scale
ΔOi \Delta O_i 尚未乘以其 tile 的 gsi gs_i,因此不同缩放 tile 的局部结果无法直接相加。该递推关系会将旧累加器转换为当前尺度。在理想实数运算中展开后可得 ΔOi \Delta O_i has not yet been multiplied by its tile’s gsi gs_i , so partials from differently scaled tiles cannot be added directly. The recurrence converts the old accumulator to the current scale. Expanding it in ideal real arithmetic gives
Oi= ∑j≤i ΔOj gsj gsi ,Okgskg sW2 =∑jΔOjgsjg sW2 . O_i=\sum_{j\le i}\Delta O_j\frac{gs_j}{gs_i},\qquad O_k gs_k gs_{W2}=\sum_j\Delta O_j gs_j gs_{W2}.恒等变换会恢复每个已量化 tile 的外层尺度。它不会重新计算之前的 bs 或 q,因此无法保证与使用已知完整行 amax 进行的两遍量化在位级上等价。FP32 比率、乘法和累加也会产生舍入误差,因此必须在数值比较中进行检查。The identity restores the outer scale of each already-quantized tile. It does not recompute earlier bs or q, and therefore does not establish bitwise equivalence to two-pass quantization with a known full-row amax. FP32 ratios, multiplication, and accumulation also round and must be checked in numerical comparisons.
原始诊断使用两个切片,其 amax 分别为 1 和 100,并以 FP32 结果作为参考。直接相加缩放比例不同的部分结果,得到的 rel-L2 为 2618%。在求和前恢复每个切片的缩放比例,以及使用顺序比率补偿,这两种方法记录的 rel-L2 均为 6.0%,处于本例的量化误差范围内。The original diagnostic uses two slices with amax 1 and 100 and an FP32 reference. Directly adding differently scaled partials yields rel-L2 2618%. Restoring each slice’s scale before summation and using sequential ratio compensation both yield a recorded rel-L2 of 6.0%, within the quantization-error range of this example.
| Merge method | rel-L2 (%) | Interpretation |
|---|---|---|
| Add both partials directly | 2618 | Mix outputs represented in different outer scales |
| Restore each gs, then add | 6.0 | Restore each tile’s actual contribution |
| Running-scale ratio compensation, then restore gs | 6.0 | Perform the same scale conversion recursively |
实现流程与开销Implementation flow and overhead
该融合原型通过 CuTeDSL 面向 SM100(Blackwell)。FC1 在 TMEM 中累加对应的 gate/up 切片,然后将其传输到寄存器中执行 SwiGLU、绝对行最大值计算和量化,并将运行中的 amax 存储在工作区中。FC2 直接使用 E2M1 数据和 E4M3 块缩放因子。其 epilogue 从 TMEM 中取回部分结果,并在寄存器或 SMEM 中对其进行补偿和合并。在正常数值范围内,核心流程如下:The fusion prototype targets SM100 (Blackwell) through CuTeDSL. FC1 accumulates the corresponding gate/up slice in TMEM, then transfers it to registers for SwiGLU, absolute rowmax, and quantization, with running amax stored in a workspace. FC2 directly consumes E2M1 data and E4M3 block scales. Its epilogue retrieves partials from TMEM and compensates and merges them in registers or SMEM. The core flow in the normal numerical range is:
Inputs: X, W_FC1, W_FC2
Initialize gamax = 0, gs_prev = 0, O = 0
for each FC2 K-tile i:
Complete FC1 reduction for gate/up slice → SwiGLU → P_i
rowmax = max(|P_i|); gamax = max(gamax, rowmax)
If gamax = 0: this row contributes zero; skip computation
gs = gamax / 2688
Generate E4M3 bs and E2M1 q per 16-element block
FC2 block-scaled MMA → ΔO_i (includes block scales, excludes gs)
O = O × (gs_prev / gs) + ΔO_i
gs_prev = gs
Y = O × gs_prev × gs_W2; all-zero rows output zero
SwiGLU 的输出可能为负数,因此 rowmax 必须使用 max(|P|)。对于全零行或块,显式设置 q=0,以避免 0/0。如果非零块的缩放因子发生下溢,则应用量化器的零值规则,并记录相应的误差。SwiGLU outputs can be negative, so rowmax must use max(|P|). Explicitly set q=0 for all-zero rows or blocks to avoid 0/0. If a nonzero block’s scale underflows, apply the quantizer’s zero-value rule and record the associated error.
该路径避免了完整 FP32 中间激活的写入和读取,但 O 必须留在 TMEM 之外,因此每个 K-tile 都会增加部分数据传输和一次合并。在所提供的 B200 Qwen3-30B-A3B 形状测试记录中,该原型的速度比未融合的 TE 两级链路快 4–8 倍,精度也接近该链路。与融合的单级路径相比,对于 512-token 小批量,合并开销更加明显;而在 4096 tokens 时,差距约为 5%。因此,Prefill 和更大的批量值得进一步评估。本原型的形状测试与第 6 节中的完整 B300 learner 测试分开测量。This path avoids writing and reading the full FP32 intermediate activation, but O must remain outside TMEM, adding partial transfers and a merge for every K-tile. In the supplied B200 Qwen3-30B-A3B shape-test record, the prototype is 4–8× faster than the unfused TE two-level chain, with accuracy close to that path. Against the fused single-level path, merge overhead is more visible for a 512-token small batch, while the gap at 4096 tokens is approximately 5%. Prefill and larger batches are therefore useful workloads for further evaluation. This prototype shape test is measured separately from the complete B300 learner tests in Section 6.
6. 评估:数值正确性、学习能力与执行效率6. Evaluation: Numerical Correctness, Learning, and Execution Efficiency
我们通过检查量化、接口、矩阵乘法和梯度来验证前述实现选择,然后评估长期学习效果。接下来,我们测量完整的学习器更新、模块、服务和在线 RL 阶段。每项实验都会报告其结果,以及这些结果如何为实现选择提供依据。We validate the preceding implementation choices by checking quantization, interfaces, matrix multiplication, and gradients, then evaluating long-run learning. We next measure complete learner updates, modules, serving, and online RL stages. Each experiment reports its result and how it informs implementation choices.
正文呈现了关键趋势和结果。完整的形状、梯度、重复运行和配置数据随相应章节一并提供。网页阅读器会将这些内容放在各自标题下;打印版则将它们汇集于附录 C。The main text presents key trends and results. Complete shape, gradient, repeated-run, and configuration data accompany the corresponding sections. The web reader provides these under their titles; printing collects them in Appendix C.
6.1 设置与测量范围6.1 Setup and Measurement Scope
本节评估 miniTE 系统性能;第 3 节报告 TRIAGE 的算法结果。主要性能模型为 Qwen3-30B-A3B,部署在单节点、配备 8×B300 的环境中,TP/PP/CP/EP = 1/1/1/4。学习器测试使用长度为 4096 的序列、微批量大小为 1、GBS 为 128;每次更新处理 524,288 个 token,并使用相同的检查点、随机种子和冻结的 DAPO 文本。模块、学习器、服务和在线 RL 测试采用不同的计时范围。This section evaluates miniTE system performance; Section 3 reports TRIAGE’s algorithmic results. The main performance model is Qwen3-30B-A3B on one node with 8×B300 and TP/PP/CP/EP = 1/1/1/4. Learner tests use sequence length 4096, micro-batch size 1, and GBS 128, processing 524,288 tokens per update from the same checkpoint, seed, and frozen DAPO text. Module, learner, serving, and online RL tests have distinct timing scopes.
| Experiment | Question | Measurement scope |
|---|---|---|
| Quantization / API / GEMM / gradients | Does optimization alter numerics? Where does error arise? | Reference kernel or FP32 golden; matching inputs |
| Long-run training and task evaluation | Does the configuration sustain effective learning? | Training trajectories and checkpoint evaluations |
| Module forward / direct F+B | Where are local gains and backward costs? | Quantization and expert GEMM; dispatch excluded |
| Fixed-text learner update | Do local optimizations improve complete updates? | Forward, backward, communication, optimizer, data loading |
| Fixed-output serving | How much does sampling capacity improve? | Eight-engine output throughput; learner and sync excluded |
| Online RL stages | Which system costs offset compute gains? | Logprob + actor train and conversion/sync measured separately |
| Configuration | Forward path | Backward / coverage | Role |
|---|---|---|---|
| TE BF16 | TE BF16 GroupedLinear | BF16 | High-precision reference and baseline |
| TE NVFP4 | Native TE per-tensor NVFP4 | Tested native recipe; non-expert layers BF16 | Existing NVFP4 path |
| miniTE CUTLASS | Custom CUTLASS NVFP4 | MXFP8 and BF16 backward tested separately | Custom path and precision choice |
| miniTE per-token | Per-token NVFP4 based on PR #3045 | MXFP8 and BF16 backward; expert-only | Per-token path and optimization chain |
| TE per-token | Fixed upstream per-token implementation | Same module-forward recipe; full-model coverage/backward documented separately | Module implementation and configuration timing reference |
表 6-1. 比较身份。两种 miniTE 路径均使用 MXFP8 和 BF16 反向传播进行测试;主要学习器配置使用 BF16 反向传播。Table 6-1. Comparison identities. Both miniTE paths are tested with MXFP8 and BF16 backward; the main learner configurations use BF16 backward.
- 模块测试使用五个独立进程,并在每次运行的稳态块内取中位数。4k/16k/64k/128k 表示每个 rank 在派发前的 token 数量。Module tests use five independent processes, taking the median within steady-state blocks for each run. The 4k/16k/64k/128k sizes denote pre-dispatch tokens per rank.
- 核心学习器测试进行 10 次独立运行,每次运行 20 次更新,前 5 次作为预热,第 6 至第 15 次更新用于测量。计算吞吐量和配对加速比时,分别剔除各自的最小值和最大值后再求平均。Core learner tests use ten independent runs of 20 updates, with the first five as warmup and updates 6–15 measured. Throughput and paired speedups each discard their own minimum and maximum before averaging.
- 完整的优化链针对每种配置使用一个进程,并执行 17 次更新。经过两次预热更新后,剔除 15 次实测更新时间中的最小值和最大值;吞吐量根据剩余 13 次更新时间的平均值计算。这些更新都属于同一个进程。The complete optimization chain uses one process per configuration and 17 updates. After two warmup updates, the minimum and maximum of 15 measured update times are removed; throughput is computed from the mean of the remaining 13 times. These updates belong to one process.
- 核心修订版为 miniTE 953f17f9;优化运行使用 b641179,并启用了稠密路径、GEMM 类型和融合。TE 的零 token 专家更新以及第 3 次运行中的干扰见附录 A.3。The core revision is miniTE 953f17f9; the optimization run uses b641179 with the dense path, GEMM-kind, and fusion. TE’s zero-token-expert update and interference in run 3 are described in Appendix A.3.
6.2 正确性与学习行为6.2 Correctness and Learning Behavior
6.2.1 量化、API、GEMM 和梯度的独立检查6.2.1 Separate Checks for Quantization, APIs, GEMM, and Gradients
在进行完整训练前,我们会验证局部数值边界。API 和布局优化会在固定配置下比较编码、缩放因子和输出。量化计算会在反量化后与 FP32 参考结果进行比较。反向传播测试则根据直通估计器(STE)语义,将梯度的方向、幅度和符号与 FP32 梯度进行对比。这样可以区分格式误差与优化引入的误差。We validate local numerical boundaries before full training. API and layout optimizations compare encoding, scales, and outputs at a fixed recipe. Quantized computation is compared with FP32 references after dequantization. Backward tests check direction, magnitude, and signs against FP32 gradients under straight-through estimator (STE) semantics. This distinguishes format error from error introduced by an optimization.
miniTE 的逐 token 密集量化和分组 GEMM 通过了 28/28 项位级等价性检查。融合布局在七个合成案例和真实激活案例中均未引入差异。对于经过测试的配置,这些布局变更保留了量化结果。miniTE per-token dense quantization and grouped GEMM pass 28/28 bitwise equivalence checks. Fused layouts add no discrepancy in seven synthetic and real-activation cases. For the tested configurations, these layout changes preserve the quantization results.
D4 · Eight Operator Paths and Their References| Category | Operator / path | Test target | Reference / criterion |
|---|---|---|---|
| miniTE CUTLASS | group_quantize_nvfp4_pertoken_swizzled |
Per-token NVFP4 activation quantization | Bit-exact against per-group reference; dequantization follows FP4/E4M3 scale semantics |
| miniTE CUTLASS | group_quantize_nvfp4_tensor_global_packed |
Per-tensor/global NVFP4 weight packing | FP4 data and swizzled scales match per-expert quantize_weight_nvfp4_swizzled |
| miniTE CUTLASS | grouped_cutlass_gemm_v2 / v2_evt |
FP4 grouped GEMM | FP32 GEMM golden after dequantization |
| CUTLASS end-to-end | miniTE CUTLASS GroupedLinear | Module forward and backward | Pure BF16 grouped matmul / FP32 golden gradients |
| miniTE per-token | nvfp4_per_token_group_quantize_bulk_dense |
TE per-token group quant dense API | PR#3045 list API; bitwise identical |
| miniTE per-token | nvfp4_cutlass_grouped_per_token_gemm_dense |
TE per-token grouped GEMM dense API | PR#3045 list API; bitwise identical |
| miniTE per-token | fused swizzle / unfused swizzle | Does scale-layout fusion add numerical error? | Fused and unfused end-to-end bit-exact |
| Both miniTE backward paths | dgrad / wgrad | Backward-gradient correctness | FP32 golden gradients; expected cosine > 0.99 under STE semantics |
表 6-2. 正确性检查中使用的对象和引用。Table 6-2. Objects and references used in correctness checks.
D5 · Extreme Inputs, Subnormals, and Scale Underflow| Test | Result | Notes |
|---|---|---|
| CUTLASS activation quantization and weight packing | 50 passed | Includes 16 new extreme cases; 8 benchmark cases deselected |
| per-token dense quantization: extreme inputs | 8 passed | Extreme inputs for miniTE per-token dense quantization |
| CUTLASS weight-layout argument regression | 8 passed | Existing bit-exact regressions unaffected |
表 6-3. 极端输入的工程回归测试。通过测试的数量反映的是案例覆盖率,而非模型训练稳定性或统计显著性。Table 6-3. Engineering regression tests for extreme inputs. Passed-test counts describe case coverage rather than model-training stability or statistical significance.
- 按 token 激活量化:FP4 数据和缩放因子与按组参考实现逐位匹配。极端幅值、接近 BF16 最大值的数值、次正规数以及混合幅值输入均不会产生 NaN/Inf。次正规数行的全局缩放因子可能被冲刷为零。Per-token activation quantization: FP4 data and scales match the per-group reference bitwise. Extreme magnitudes, values near the BF16 maximum, subnormals, and mixed-magnitude inputs produce no NaN/Inf. Global scales for subnormal rows can flush to zero.
- 逐张量/全局权重打包:编码和交错缩放因子与逐专家参考实现一致。一个次正规数专家保留了约 9e-41 的输入值,相对 L2 误差约为 1.56e-2。全局缩放检查采用 3% 的相对容差,而非要求每个浮点缩放因子都逐位相等。Per-tensor/global weight packing: Encoding and swizzled scales match the per-expert reference. A subnormal expert retains inputs around 9e-41 with relative L2 around 1.56e-2. Global-scale checks use a 3% relative tolerance rather than bitwise equality for every floating-point scale.
- miniTE 的逐 token 密集量化:q_row、块缩放因子和 row_amax 与上游列表路径一致。非常小的行可能因块解码缩放因子下溢而变为零。经过测试的生产路径要求 m_splits 是 128 的倍数。miniTE per-token dense per-token quantization: q_row, block scales, and row_amax match the upstream list path. Very small rows can become zero through block decode-scale underflow. The tested production path requires m_splits to be multiples of 128.
这些不同的清零和缩放行为有助于区分格式范围、浮点数 FTZ 和接口问题。These distinct zeroing and scale behaviors help distinguish format range, floating-point FTZ, and interface issues.
FP32 尾处理也有直接的数值验证支持。普通的 miniTE CUTLASS 分组 GEMM 和 EVT 路径都会在反量化后与 FP32 黄金参考结果进行比较:FP32 epilogues also have direct numerical support. Both ordinary miniTE CUTLASS grouped GEMM and the EVT path are compared with the FP32 golden reference after dequantization:
| Kernel | cosine | max_abs | norm_rmse |
|---|---|---|---|
grouped_cutlass_gemm_v2 |
≥ 0.999994 | ≤ 0.0156 | ≤ 0.0033 |
grouped_cutlass_gemm_v2_evt |
≥ 0.999999 | ≤ 0.0078 | ≤ 4e-5 |
表 6-4. miniTE CUTLASS GEMM 精度。EVT 将 norm_rmse 上界从约 0.0033 降至 4e-5 左右,支持在此路径中采用高精度 epilogue。Table 6-4. miniTE CUTLASS GEMM accuracy. EVT reduces the norm_rmse bound from approximately 0.0033 to the 4e-5 range, supporting a high-precision epilogue in this path.
与纯 BF16 前向计算相比,GroupedLinear 的余弦相似度约为 0.99095,norm_rmse 约为 0.135,远高于 GEMM 相对于其自身反量化参考值的误差。前者包含 FP4 导致的信息损失;后者检验的是 GEMM 的实现。参考值决定了准确性指标衡量的内容。Against pure BF16 forward computation, GroupedLinear has cosine similarity around 0.99095 and norm_rmse around 0.135, substantially larger than GEMM error against its own dequantized reference. The former includes information lost to FP4; the latter checks GEMM implementation. The reference determines what the accuracy metric measures.
BF16 反向传播的 dgrad/wgrad 与 BF16 参考值高度吻合,最大相对 L2 约为 0.001663。MXFP8 反向传播的相对 L2 约为 0.03765,符号一致率约为 98.8%。这支持在第 4 节中独立选择反向传播精度;第 6.4 节则测量其执行成本。BF16 backward dgrad/wgrad closely match the BF16 reference, with maximum relative L2 approximately 0.001663. MXFP8 backward has relative L2 approximately 0.03765 and sign agreement around 98.8%. This supports independently selecting backward precision in Section 4; Section 6.4 measures its execution cost.
D6 · Complete Gradient Results for Both miniTE Paths: Cosine, Relative L2, Sign Agreement, and Expert Metrics| Backend | Backward path | dgrad cosine (min) | dgrad rel-L2 (max) | dgrad sign agreement (min) | wgrad cosine (min) | wgrad rel-L2 (max) | wgrad sign agreement (min) | Expert cosine (min) |
|---|---|---|---|---|---|---|---|---|
| miniTE CUTLASS | MXFP8 bwdquant | 0.999292 | 0.037626 | 98.802% | 0.999291 | 0.037653 | 98.802% | 0.999287 |
| miniTE per-token | MXFP8 bwdquant | 0.999292 | 0.037626 | 98.802% | 0.999291 | 0.037653 | 98.802% | 0.999287 |
| miniTE CUTLASS | BF16 backward | 0.999999 | 0.001660 | 100.000% | 0.999999 | 0.001663 | 100.000% | 0.999998 |
| miniTE per-token | BF16 backward | 0.999999 | 0.001660 | 100.000% | 0.999999 | 0.001663 | 100.000% | 0.999998 |
| BF16 PyTorch reference | BF16 matmul | 0.999999 | 0.001660 | 100.000% | 0.999999 | 0.001663 | 100.000% | 0.999998 |
表 6-5. 不同随机种子和形状下的最坏情况梯度指标。参考实现以 FP32 计算 dX=dY, WBF16⊤ dX=dY,W_{\mathrm{BF16}}^\top 和 dW=dY⊤ XBF16 dW=dY^\top X_{\mathrm{BF16}}。符号一致率为 100% 并不意味着 FP32 位级相等。Table 6-5. Worst-case gradient metrics across seeds and shapes. The reference computes dX=dY, WBF16⊤ dX=dY,W_{\mathrm{BF16}}^\top and dW=dY⊤ XBF16 dW=dY^\top X_{\mathrm{BF16}} in FP32. A 100% sign-agreement rate does not imply bitwise FP32 equality.
D7 · Dense APIs and Fused versus Unfused Scale Layouts| Test object | Shape coverage | Result |
|---|---|---|
nvfp4_per_token_group_quantize_bulk_dense |
Small, 8 experts, 32 experts, extreme inputs | q / scale / amax all bitwise identical |
nvfp4_cutlass_grouped_per_token_gemm_dense |
small, fc1-ish, fc2-ish | GEMM output bitwise identical, max_abs = 0 |
表 6-6. 密集接口的形状覆盖率和结果。Table 6-6. Shape coverage and results for the dense interfaces.
| Case | fused vs unfused Rel-L2 | cosine | max_abs | FP4 data mismatch | Scale mismatch |
|---|---|---|---|---|---|
| Synthetic, multiple seeds / token counts | 0 | 1.0 | 0 | 0 / 96 groups | 0 / 96 groups |
| real dump | 0 | 1.0 | 0 | 0 / 12 groups | 0 / 12 groups |
表 6-7。融合/未融合输出和中间结果的差异。生产环境中的 miniTE 逐 token 路径与早期实验路径的形状约束不同;本表报告生产路径的检查结果。Table 6-7. Differences in fused/unfused outputs and intermediates. The production miniTE per-token path has different shape constraints from earlier experimental paths; this table reports the production-path checks.
6.2.2 补充长期学习评估6.2.2 Supplementary Long-Run Learning Evaluation
图 5 对比了 BF16+TIS、原生 NVFP4+TIS 和 miniTE+TIS。miniTE 在前 1,000 步中持续提升奖励,并在训练后期超过原生 NVFP4;在这一阶段,BF16 获得了更高的奖励。两种 NVFP4 配置的平均对数概率差距相近,但学习轨迹不同。因此,平均差距不能替代任务性能。Figure 5 compares BF16+TIS, native NVFP4+TIS, and miniTE+TIS. miniTE maintains reward growth during the first 1,000 steps and exceeds native NVFP4 later in the run; BF16 achieves higher reward over this interval. The two NVFP4 configurations have similar mean log-probability gaps but different learning trajectories. Average gap alone is therefore not a substitute for task performance.
这些曲线包含 6,000 个间隔和奖励观测值。三个配置都使用 TIS,步数范围为 0–999。默认设置保留居中的 21 点均值;请检查原始值或缩放范围。The curves contain 6,000 gap and reward observations. All three configurations use TIS, over steps 0–999. The default preserves the centered 21-point mean; inspect raw values or zoom the range.
打开交互式图表:查看数值、切换配置、下载 SVG / CSVOpen interactive figure: inspect values, switch configurations, download SVG / CSV
图 5. 实用 miniTE 路径与基线的学习动态。每种配置均进行了 1 次运行,步数为 0–999。左侧面板显示平均绝对对数概率差距;右侧面板显示奖励。细线表示原始值,粗线表示居中的 21 步均值。所有配置均使用 TIS。这是与严格对齐参考不同的一项实验。Figure 5. Learning dynamics of the practical miniTE path and baselines. Each configuration has one run over steps 0–999. The left panel shows mean absolute log-probability gap; the right shows reward. Thin lines are raw values, thick lines centered 21-step means. All configurations use TIS. This is a separate experiment from the strict alignment reference.
这项补充实验使用 Qwen3-30B-A3B-Base。BF16、原生 TE NVFP4 和 miniTE 均使用 TIS,并禁用了路由重放。表 6-8 使用各自第 999 步的检查点,对四项数学任务和 IFEval 进行了评估 [11,12,13,14]。每项 AIME 基准测试均取六次评估的平均值;MATH-500、GSM8K 和 IFEval 均取四次评估的平均值。IFEval 使用提示级严格准确率。BF16 检查点采用 BF16 推理进行评估,两个 NVFP4 检查点均采用 NVFP4 推理进行评估。This supplementary run uses Qwen3-30B-A3B-Base. BF16, native TE NVFP4, and miniTE all use TIS, with routing replay disabled. Table 6-8 evaluates four mathematics tasks and IFEval on the respective step-999 checkpoints [11,12,13,14]. Each AIME benchmark averages six evaluations; MATH-500, GSM8K, and IFEval each average four. IFEval uses Prompt-level Strict accuracy. The BF16 checkpoint is evaluated with BF16 inference, and both NVFP4 checkpoints with NVFP4 inference.
| Configuration | AIME24 | AIME25 | MATH-500 | GSM8K | IFEval | Five-task mean |
|---|---|---|---|---|---|---|
| BF16 + TIS | 41.11% | 31.11% | 90.05% | 93.57% | 38.36% | 58.84% |
| TE NVFP4 + TIS | 26.67% | 20.56% | 86.90% | 94.71% | 43.99% | 54.57% |
| miniTE + TIS | 36.67% | 24.44% | 87.45% | 94.79% | 38.40% | 56.35% |
| miniTE minus TE NVFP4 | +10.00 | +3.88 | +0.55 | +0.08 | −5.59 | +1.78 |
表 6-8。补充运行在第 999 步时的任务得分。最后一行报告百分点差异。五项任务的权重相等,不受评估次数影响。重复评估同一个检查点不会产生独立的训练随机种子。Table 6-8. Task scores at step 999 of the supplementary run. The last row reports percentage-point differences. The five tasks receive equal weight, independent of evaluation counts. Repeated evaluation of a checkpoint does not create independent training seeds.
miniTE 在四项数学评分上均优于原生 NVFP4。其五项任务平均分提高了 1.78 个百分点,但仍比 BF16 低 2.49 个百分点。IFEval 的排序则有所不同:miniTE 接近 BF16,但低于原生 NVFP4。这些结果表明,在所测的数学训练任务上有所提升,而下游收益因任务而异。miniTE improves all four mathematics scores over native NVFP4. Its five-task average increases by 1.78 percentage points and remains 2.49 points below BF16. IFEval has a different ordering: miniTE is close to BF16 but below native NVFP4. These results support improvements on the measured mathematics training tasks, with downstream gains varying by task.
这补充了框架的长期训练评估。其任务集、训练时长和评估协议与第 3 节中的 TRIAGE 不同;两者分别描述各自配置下的学习过程。This supplements the framework’s long-run training evaluation. Its task set, training duration, and evaluation protocol differ from TRIAGE in Section 3; each describes learning under its own configuration.
6.3 完整学习者更新:本地更改是否会降低更新成本?6.3 Complete Learner Updates: Do Local Changes Reduce Update Cost?
表 6-9 汇总了主测试的十次运行结果,对比 BF16、原生 TE NVFP4 和 miniTE。两种 miniTE 路径的结果还展示了反向传播精度对完整学习器更新吞吐量的影响。Table 6-9 summarizes the ten-run main test, comparing BF16, native TE NVFP4, and miniTE. Results for both miniTE paths also show how backward precision affects complete learner-update throughput.
| Configuration | Tokens/s, ten-run trimmed mean | Paired speedup over BF16 |
|---|---|---|
| TE BF16 | 24,192 | 1.000× |
| TE NVFP4 | 23,294 | 0.959× |
| miniTE CUTLASS, MXFP8 backward | 27,607 | 1.148× |
| miniTE CUTLASS, BF16 backward | 33,140 | 1.369× |
| miniTE per-token, BF16 backward | 32,517 | 1.334× |
表 6-9. 完整学习器吞吐量。加速比通过在裁剪前配对运行结果计算得出。计时包括前向传播、反向传播、通信、优化器和数据加载;不包括 rollout 和权重同步。Table 6-9. Complete learner throughput. Speedups are computed by pairing runs before trimming. Timing includes forward, backward, communication, the optimizer, and data loading; it excludes rollout and weight synchronization.
该图展示了十次运行实验,以及单独的单进程优化实验。主测试显示所有独立运行的数值和截尾均值。可切换到配对加速比视图或单进程优化运行视图。各协议仍然分开呈现;未添加置信区间。静态版本显示主测试的吞吐量。The figure shows the ten-run experiment and the separate single-process optimization experiment. The main test shows all independent run values and trimmed means. Switch to paired speedups or the single-process optimization run. Protocols remain separate; no confidence intervals are added. The static version shows main-test throughput.
打开交互式图表:查看数值、切换配置、下载 SVG / CSVOpen interactive figure: inspect values, switch configurations, download SVG / CSV
两种采用 BF16 反向传播的 miniTE 路径,其速度约为 BF16 的 1.33–1.37 倍,而 TE NVFP4 的速度接近 BF16。将 miniTE CUTLASS 的反向传播从 MXFP8 改为 BF16,可进一步提升吞吐量,这表明低比特 GEMM 带来的收益可能被反向传播中的量化和准备开销抵消。miniTE per-token 与 TE NVFP4 相比的聚合吞吐量均值之比约为 1.396 倍。1.344 倍的 miniTE per-token/TE BF16 数值同样是均值之比,与此处的 1.334 倍配对估计值不同。Both miniTE paths with BF16 backward achieve approximately 1.33–1.37× BF16 speed, while TE NVFP4 is near BF16. Moving miniTE CUTLASS backward from MXFP8 to BF16 further improves throughput, showing that lower-bit GEMM gains can be offset by backward quantization and preparation. miniTE per-token’s ratio of aggregate throughput means against TE NVFP4 is approximately 1.396×. The 1.344× miniTE per-token/TE BF16 value is also a ratio of means, distinct from the 1.334× paired estimator here.
D8 · Ten Independent Runs, Trimmed Statistics, and Run Differences| Run | TE BF16 | TE NVFP4 | miniTE CUTLASS MXFP8 backward | miniTE CUTLASS BF16 backward | miniTE per-token BF16 backward |
|---|---|---|---|---|---|
| 0 | 25545.3 | 25863.2 | 30070.0 | 31196.6 | 33463.5 |
| 1 | 24530.5 | 23653.1 | 27773.2 | 34662.4 | 31416.6 |
| 2 | 23384.9 | 23291.4 | 27501.7 | 33288.5 | 34428.9 |
| 3 | 23802.7 | 20997.8 | 24865.7 | 29218.7 | 28959.3 |
| 4 | 23437.2 | 23473.3 | 26551.5 | 34777.1 | 32164.2 |
| 5 | 25292.7 | 21553.5 | 27759.3 | 31109.0 | 32828.9 |
| 6 | 24352.1 | 22381.7 | 26508.3 | 34214.7 | 30948.3 |
| 7 | 22730.2 | 23138.2 | 25925.8 | 32078.5 | 33315.1 |
| 8 | 23191.5 | 26672.6 | 28769.0 | 33794.5 | 32159.6 |
| 9 | 26277.9 | 22993.5 | 34352.4 | 36279.4 | 33835.6 |
| Trimmed mean | 24192.1 | 23293.5 | 27607.4 | 33140.2 | 32516.5 |
表 6-10。机器可读结果中每次运行的吞吐量,保留一位小数。正文摘要使用整数。Table 6-10. Throughput for every run in the machine-readable results, shown to one decimal place. Main-text summaries use integers.
一个空闲的服务进程在运行 3 期间占用了资源。根据预定义的截尾规则,量化变体中的最低观测值被剔除。早期和后期的 TE 修订版对零 token 专家的处理方式不同;相应的检查覆盖非空组。配置按运行 ID 配对,而非通过同时执行来配对。配对加速比的截尾均值与汇总均值之比是不同的估计量。An idle serving process occupied resources during run 3. The minimum observations for its quantized variants are removed by the predefined trimming rule. Early and later TE revisions handle zero-token experts differently; corresponding checks cover nonempty groups. Configurations are paired by run ID rather than simultaneous execution. A trimmed mean of paired speedups and a ratio of aggregate means are distinct estimators.
数据:十次运行记录;运行和修订版本。Data: ten-run records; runs and revisions.
D9 · Early Three-Run Results and Reserved Memory| Configuration | Early-run tokens/s | Peak reserved memory (original MB) |
|---|---|---|
| TE BF16 | 25,545 / 24,531 / 23,385 | 119,914 |
| TE NVFP4 | 25,863 / 23,653 / 23,291 | 122,672 |
| miniTE CUTLASS MXFP8 backward | 30,070 / 27,773 / 27,502 | 144,598 |
| miniTE CUTLASS BF16 backward | 31,197 / 34,662 / 33,289 | 137,778 |
| miniTE per-token MXFP8 backward | 27,493 (run 0 only) | 138,458 |
| miniTE per-token BF16 backward | 33,464 / 31,417 / 34,429 | 133,398 |
表 6-11。早期运行和峰值预留内存,保留原始 MB 单位。这些数据与其他协议下以 GiB 为单位的后续测量分开。miniTE 使用 MXFP8 反向传播的逐 token 测量只有一次参考运行。Table 6-11. Early runs and peak reserved memory, retaining the original MB units. These are separate from later measurements in GiB under other protocols. miniTE per-token with MXFP8 backward has one reference run.
与某些 miniTE 变体相比,miniTE 的每 token 保留内存更少,但在此次比较中仍高于 BF16。保存的高精度操作数、量化权重缓存、工作区和填充都会影响总内存占用;FP4 载荷宽度本身并不能决定模型的内存消耗。miniTE per-token reduces reserved memory relative to some miniTE variants but remains above BF16 in this comparison. Saved high-precision operands, quantized weight caches, workspaces, and padding all contribute to total usage; FP4 payload width alone does not determine model memory consumption.
后续的完整优化链结合了稠密路径、GEMM 类型、排列融合和 amax 复用。miniTE 按 token 处理并采用 BF16 反向传播时,达到 33,540 tokens/s,分别是同轮 BF16 基线的 1.39× 和 TE NVFP4 的 1.47×。这项组合测试使用了不同的修订版本和协议:The subsequent complete optimization chain combines the dense path, GEMM-kind, permutation fusion, and amax reuse. miniTE per-token with BF16 backward reaches 33,540 tokens/s, or 1.39× the same-round BF16 baseline and 1.47× TE NVFP4. This combined test uses a different revision and protocol:
D10 · Complete Fusion Run: Configurations and Timing Protocol| Configuration | Fusion-run tokens/s | Speedup over same-round BF16 |
|---|---|---|
| TE BF16 | 24,134 | 1.000× |
| TE NVFP4 | 22,801 | 0.945× |
| miniTE CUTLASS, MXFP8 backward | 25,505 | 1.057× |
| miniTE CUTLASS, BF16 backward | 33,065 | 1.370× |
| miniTE per-token, MXFP8 backward | 26,516 | 1.099× |
| miniTE per-token, BF16 backward | 33,540 | 1.390× |
表 6-12。单进程优化运行:每种配置运行一个进程,吞吐量根据 15 次测量更新耗时的截尾均值计算。保留所有配置。miniTE CUTLASS MXFP8 反向传播达到 25,505 tokens/s,低于独立核心测试中的 27,607。由于测试协议不同,因此不将融合视为始终带来正向增量。Table 6-12. Single-process optimization run: one process per configuration, with throughput calculated from the trimmed mean of 15 measured update times. All configurations are retained. miniTE CUTLASS MXFP8 backward reaches 25,505 tokens/s, below 27,607 in the separate core test. The protocols differ, so fusion is not treated as a consistently positive increment.
33,540 这一数值比 core miniTE 的每 token 结果 32,517 tokens/s 高约 3.1%,但 revision、dense/GEMM 设置和 fusion 都同时发生了变化。这个差异反映的是一次组合运行的结果,不能单独归因于 amax 或 GEMM-kind。此前关于“gemm_kind 会拖慢速度”的归因,在检查 revision 后已得到修正。The 33,540 value is approximately 3.1% above the core miniTE per-token result of 32,517 tokens/s, but revision, dense/GEMM settings, and fusion change together. The difference describes a combined run and cannot be attributed separately to amax or GEMM-kind. The earlier attribution that “gemm_kind slows down” was corrected after revision checks.
关键结果 · §6.3Key result · §6.3
采用 BF16 反向传播的两种 miniTE 路径,在完整学习器更新中的速度约为 BF16 的 1.33–1.37 倍。Both miniTE paths with BF16 backward reach about 1.33–1.37× the BF16 speed on complete learner updates.
6.4 模块:前向更快不一定意味着前向和反向都更快6.4 Modules: Faster Forward Does Not Necessarily Mean Faster F+B
在完整学习器中测量性能提升后,模块测试揭示了这些提升的来源。图 6 在 FC1/FC2 之间切换,并展示前向、直接计时的 F+B,或两者兼有。F+B 使用直接测得的耗时:After measuring gains in the complete learner, module tests explain their sources. Figure 6 switches between FC1/FC2 and shows forward, directly timed F+B, or both. F+B uses directly measured timings:
前向过程和完整的前向加反向(F+B)过程均直接计时。Forward and complete forward-plus-backward (F+B) are timed directly.
打开交互式图表:查看数值、切换配置、下载 SVG / CSVOpen interactive figure: inspect values, switch configurations, download SVG / CSV
图 6. B300 上的 Qwen3-30B-A3B GroupedLinear,使用预热后的静态权重,运行五次。实线表示前向,虚线表示直接测得的 F+B。此图中,两条 miniTE 路径的反向传播均使用量化。横轴为分发前 token 的规模;此均衡工作负载不同于全模型路由。Figure 6. Qwen3-30B-A3B GroupedLinear on B300, warm static weights, five runs. Solid lines show forward, dashed lines directly measured F+B. Both miniTE paths use quantized backward in this figure. The horizontal axis is pre-dispatch token scale; this balanced workload is distinct from full-model routing.
miniTE 的逐 token 前向速度约比 BF16 快 1.09–1.43 倍,而图中的 F+B 速度更慢。采用 BF16 反向传播时,miniTE 的逐 token F+B 速度约比其自身采用 MXFP8 反向传播的路径快 1.2–1.3 倍。这直接说明,在选择反向传播精度前,应先测量算子的完整开销。miniTE per-token forward is approximately 1.09–1.43× faster than BF16, while its F+B in the figure is slower. BF16 backward makes miniTE per-token F+B approximately 1.2–1.3× faster than its own MXFP8-backward path. This directly motivates measuring complete operator cost before selecting backward precision.
选择 FC1/FC2、forward/direct F+B、miniTE backward precision 和上游参考。数据点为五次运行的中位数;误差线表示最小值和最大值,而非置信区间。连线表示四种实测的预分发 token 尺度。默认视图显示 FC1 direct F+B,且两条 miniTE 路径均采用 MXFP8 backward;也可选择 FC2。图 6 概述了 forward/F+B。Select FC1/FC2, forward/direct F+B, miniTE backward precision, and the upstream reference. Points are medians of five runs; whiskers show minima and maxima, not confidence intervals. Lines connect the four measured pre-dispatch token scales. The default view shows FC1 direct F+B with MXFP8 backward for both miniTE paths; FC2 is selectable. Figure 6 provides the forward/F+B overview.
打开交互式图表:查看数值、切换配置、下载 SVG / CSVOpen interactive figure: inspect values, switch configurations, download SVG / CSV
D11 · FC1/FC2 at Four Sizes: Complete Forward and Direct F+B Latencies前言Forward
| Module | Configuration | Measurement | 4k ms | 16k ms | 64k ms | 128k ms |
|---|---|---|---|---|---|---|
| FC1 | TE BF16 | Forward | 0.504 | 0.515 | 0.801 | 1.329 |
| FC1 | TE NVFP4 | Forward | 1.295 | 1.349 | 1.250 | 1.327 |
| FC1 | miniTE CUTLASS | Forward | 0.336 | 0.396 | 0.895 | 1.508 |
| FC1 | miniTE per-token | Forward | 0.372 | 0.424 | 0.582 | 0.932 |
| FC2 | TE BF16 | Forward | 0.542 | 0.508 | 0.546 | 0.820 |
| FC2 | TE NVFP4 | Forward | 1.428 | 1.190 | 1.281 | 1.244 |
| FC2 | miniTE CUTLASS | Forward | 0.339 | 0.355 | 0.677 | 1.111 |
| FC2 | miniTE per-token | Forward | 0.389 | 0.415 | 0.565 | 0.753 |
使用 MXFP8 反向传播的直接 F+BDirect F+B with MXFP8 Backward
| Module | Configuration | Measurement | 4k ms | 16k ms | 64k ms | 128k ms |
|---|---|---|---|---|---|---|
| FC1 | TE BF16 | fwb | 2.461 | 2.543 | 2.572 | 4.309 |
| FC1 | TE NVFP4 | fwb | 4.174 | 3.986 | 4.011 | 4.583 |
| FC1 | miniTE CUTLASS | fwb | 4.006 | 3.987 | 3.923 | 5.631 |
| FC1 | miniTE per-token | fwb | 3.712 | 3.830 | 3.771 | 4.989 |
| FC2 | TE BF16 | fwb | 2.959 | 2.994 | 2.933 | 4.592 |
| FC2 | TE NVFP4 | fwb | 4.604 | 4.790 | 4.802 | 5.414 |
| FC2 | miniTE CUTLASS | fwb | 4.147 | 3.916 | 3.881 | 5.417 |
| FC2 | miniTE per-token | fwb | 3.875 | 3.915 | 3.907 | 5.056 |
直接 F+B,采用 BF16 反向传播Direct F+B with BF16 Backward
| Module | Configuration | Measurement | 4k ms | 16k ms | 64k ms | 128k ms |
|---|---|---|---|---|---|---|
| FC1 | miniTE CUTLASS | fwb | 2.975 | 2.966 | 3.253 | 5.473 |
| FC1 | miniTE per-token | fwb | 2.964 | 2.992 | 3.018 | 4.869 |
| FC2 | miniTE CUTLASS | fwb | 2.908 | 2.913 | 2.958 | 4.936 |
| FC2 | miniTE per-token | fwb | 3.158 | 2.943 | 3.088 | 4.636 |
表 6-13。来自 miniTE 机器可读记录的五次运行中位数,保留三位小数。反向配置单独列出。TE BF16/TE NVFP4 仍保留在其原始配置表中,因为此 BF16 反向补充表没有对应的行。Table 6-13. Five-run medians from the miniTE machine-readable records, shown to three decimal places. Backward configurations are kept separate. TE BF16/TE NVFP4 remain in their original configuration table because this BF16-backward supplement has no corresponding rows for them.
| Configuration | TE BF16 | TE NVFP4 | miniTE CUTLASS | miniTE per-token |
|---|---|---|---|---|
| 128k FC1 peak reserved GiB | 7.39 | 6.91 | 8.65 | 8.76 |
这些内存值是在模块测试中,按照所述的计时和权重缓存设置测得的。学习器的峰值内存则单独测量。These memory values were measured in module tests under their stated timing and weight-cache settings. Learner peak memory is measured separately.
原始数据:主模块记录、BF16 反向传播记录。Raw data: main module records, BF16-backward records.
D12 · miniTE per-token Module Speedups over TE NVFP4| Module | Mode | 4k | 16k | 64k | 128k |
|---|---|---|---|---|---|
| FC1 | Forward | 3.48x | 3.18x | 2.15x | 1.42x |
| FC1 | F+B | 1.12x | 1.04x | 1.06x | 0.92x |
| FC2 | Forward | 3.67x | 2.87x | 2.27x | 1.65x |
| FC2 | F+B | 1.19x | 1.22x | 1.23x | 1.07x |
表 6-14。对应配置下 miniTE per-token 相对于 TE NVFP4 的加速比;>1 表示 miniTE per-token 更快。F+B 使用各自记录的反向传播路径。在 128k FC1 下,miniTE per-token 并非在每项比较中都领先。Table 6-14. miniTE per-token/TE NVFP4 speedups for the corresponding configurations; >1 means miniTE per-token is faster. F+B uses each recorded backward path. miniTE per-token does not lead in every comparison at 128k FC1.
在固定前向方案后,miniTE per-token 相较于上游 TE per-token,实现了 2.46× 的专家前向几何平均加速;相较于直接 F+B,则实现了 1.10× 的加速。这一差异表明,前向调用与准备是实现性能提升的主要来源。输入已预先完成置换,FC2 激活在计时范围外准备,dispatch 也不计入计时。With the forward recipe fixed, miniTE per-token achieves a 2.46× geometric-mean expert-forward speedup over upstream TE per-token and 1.10× for direct F+B. The difference points to forward invocation and preparation as the main sources of implementation gains. Inputs are pre-permuted, FC2 activations are prepared outside the timer, and dispatch is excluded.
D13 · miniTE per-token/TE per-token by Workload Size and the amax Ablation| Module | Mode | Workload size | TE per-token | miniTE per-token | miniTE per-token speedup |
|---|---|---|---|---|---|
| FC1 | Forward | 4k / 16k / 64k / 128k | 1.128 / 1.094 / 1.275 / 1.479 | 0.372 / 0.424 / 0.582 / 0.932 | 3.03x / 2.58x / 2.19x / 1.59x |
| FC1 | F+B | 4k / 16k / 64k / 128k | 3.873 / 3.916 / 3.846 / 5.066 | 3.712 / 3.830 / 3.771 / 4.989 | 1.04x / 1.02x / 1.02x / 1.02x |
| FC2 | Forward | 4k / 16k / 64k / 128k | 1.193 / 1.043 / 1.555 / 1.747 | 0.389 / 0.415 / 0.565 / 0.753 | 3.06x / 2.52x / 2.75x / 2.32x |
| FC2 | F+B | 4k / 16k / 64k / 128k | 4.603 / 4.507 / 4.488 / 6.234 | 3.875 / 3.915 / 3.907 / 5.056 | 1.19x / 1.15x / 1.15x / 1.23x |
表 6-15。五次运行得出的模块延迟和加速比。数值等价性检查固定前向方案;相应记录注明环境和反向路径。Table 6-15. Module latencies and speedups from five runs. Numerical-equivalence checks hold the forward recipe fixed; the corresponding records specify environment and backward paths.
amax skip-K1 模拟在大多数尺寸下表现持平或略慢,性能范围约为 0.81–1.11×。该模拟未计入生产者端的收益,却保留了准备开销,因此无法单独确定完整生产者–消费者融合的效果。密集布局是与其他优化一同测量的,其单独贡献尚未测量。The amax skip-K1 simulation is neutral or slightly slower at most sizes, spanning approximately 0.81–1.11×. It excludes producer gains and retains preparation overhead, so it cannot independently establish the effect of full producer–consumer fusion. The dense layout is measured together with other optimizations; its individual contribution remains unmeasured.
| module | mode | Workload size | miniTE per-token amax off | miniTE per-token amax on | on vs off |
|---|---|---|---|---|---|
| fc1 | Forward | 4k | 0.372 | 0.459 | 0.81x |
| fc1 | Forward | 16k | 0.4241 | 0.4586 | 0.925x |
| fc1 | Forward | 64k | 0.5823 | 0.6166 | 0.944x |
| fc1 | Forward | 128k | 0.9319 | 0.8365 | 1.114x |
| fc1 | fwb | 4k | 3.7122 | 3.8659 | 0.96x |
| fc1 | fwb | 16k | 3.8303 | 3.8542 | 0.994x |
| fc1 | fwb | 64k | 3.7713 | 3.8175 | 0.988x |
| fc1 | fwb | 128k | 4.9888 | 4.9196 | 1.014x |
| fc2 | Forward | 4k | 0.3894 | 0.4017 | 0.969x |
| fc2 | Forward | 16k | 0.4145 | 0.4407 | 0.941x |
| fc2 | Forward | 64k | 0.5655 | 0.5927 | 0.954x |
| fc2 | Forward | 128k | 0.7534 | 0.7842 | 0.961x |
| fc2 | fwb | 4k | 3.8746 | 3.9556 | 0.98x |
| fc2 | fwb | 16k | 3.9151 | 3.995 | 0.98x |
| fc2 | fwb | 64k | 3.9069 | 3.8958 | 1.003x |
| fc2 | fwb | 128k | 5.0562 | 5.1263 | 0.986x |
表 6-15b。miniTE 逐 token 模块级 skip-K1 仿真。统计数据沿用模块测试;不计入生产端收益。Table 6-15b. miniTE per-token module-level skip-K1 simulation. Statistics follow the module test; producer gains are excluded.
数据与运行:模块消融记录。Data and runs: module ablation records.
D14 · Upstream TE per-token Full-Model Timing and Configuration Scope| Configuration | tokens/s(3 trials) | paired speedup vs TE per-token | Max reserved (MB) |
|---|---|---|---|
| TE per-token | 23125 / 23150 / 22346 | — | 122572 |
| TE BF16 | 25545 / 24531 / 23385 | 1.06x | 119914 |
| TE NVFP4 | 25863 / 23653 / 23291 | 1.04x | 122672 |
| miniTE per-token (mxfp8-bwd) | 27493 (run 0 reference) | 1.19x (run 0 paired) | 138458 |
| miniTE per-token (bf16-bwd) | 33464 / 31417 / 34429 | 1.45x | 133398 |
表 6-16。完整模型三次运行对比。约 1.45× 是这些配置之间的耗时比,而不是采用相同方案时单靠实现优化带来的提升。Table 6-16. Three-run full-model comparison. Approximately 1.45× is the timing ratio between these configurations, not an implementation-only gain at the same recipe.
TE 的逐 token 量化也会作用于非专家层,并使用其原生的逐 token NVFP4 反向传播路径。miniTE 的逐 token 量化仅用于专家层,并采用 MXFP8/BF16 反向传播进行测试。TE 的逐 token 运行还记录到约 1e8–1e11 的梯度范数,裁剪后实际更新幅度非常小。计时结果和学习行为都予以保留;速度比并不代表学习路径等效。TE per-token quantizes non-expert layers as well and uses its native per-token NVFP4 backward path. miniTE per-token is expert-only and is tested with MXFP8/BF16 backward. The TE per-token runs also record gradient norms around 1e8–1e11, leaving very small actual updates after clipping. Timing and learning behavior are both retained; the speed ratio does not describe equivalent learning paths.
查看 TE 的逐 token 完整模型记录。See the TE per-token full-model records.
性能分析解释了从局部性能到完整模型性能的变化:主机端元数据准备、分组调用之间的间隔、专家通信以及非 GEMM 操作都会影响更新时间。连续布局可降低组织开销,而模型测试则包含真实的路由过程及其周边开销。Profiling explains the transition from local to full-model performance: host metadata preparation, gaps between grouped calls, expert communication, and non-GEMM operations all affect update time. Contiguous layouts reduce organization overhead, while model tests include real routing and surrounding costs.
D15 · Representative Profiles: Multi-Tensor Calls and Grouped GEMM调度和路由如何影响下游 GEMM 调度。在补充记录的 Step 8 首个微批次中,基于真实权重和输入的路由分布更均匀,而基于随机权重和输入的模拟路由则更集中。两者均在每个 rank 上使用 4,096 个输入 token、top-k=8,并在 EP 组内路由 131,072 个 token。我们先在这一相同 token 预算下比较专家分布:How dispatch and routing affect downstream GEMM scheduling. In the supplementary record’s first microbatch of Step 8, routing from real weights and inputs is more uniform, while mock routing from random weights and inputs is concentrated. Both use 4,096 input tokens per rank, top-k=8, and 131,072 routed tokens within the EP group. We first compare expert distributions at this common token budget:
| Load metric | Real | Mock | Interpretation |
|---|---|---|---|
| Experts with tokens | 126/128 | 24/128 | Mock concentrates tokens on fewer experts |
| Zero-token experts | 2 | 104 | The number of participating experts differs |
| CV of GroupedLinear M | 0.19 | 0.66 | The recorded Real GEMM row counts are more uniform |
M 是专家 GEMM 的 token 行数。CV 按相同的统计定义计算,即标准差除以均值;我们保留记录的 GroupedLinear M 统计值,而不是根据全局专家数量重新推算。参与的专家越多,需要准备和调度的矩阵乘法任务就越多。Host API 和 kernel 的性能分析有助于解释这部分开销:M is the token-row count of an expert GEMM. CV is the standard deviation divided by the mean under the same statistical definition; we retain the recorded GroupedLinear M statistic instead of reconstructing it from global expert counts. More participating experts create more matrix-multiplication problems to prepare and schedule. Host API and kernel profiles help explain that cost:
| Call metric | Real | Mock | Interpretation |
|---|---|---|---|
| cuBLASLt heuristic calls / cumulative time | 148,000 / 6.26 s | 32,000 / 1.02 s | Real has approximately 4.6× as many calls |
| Median time per heuristic call | 2.9 µs | 2.9 µs | Similar medians, different call counts |
| nvte_multi_tensor_gemm calls / median time | 4,608 / 2.29 ms | 4,590 / 0.44 ms | Similar counts; Real’s median is approximately 5.2× |
| nvjet kernel calls | 114,000 | 4,600 | Real has approximately 25× as many calls |
第一个表格标明了这个微批次的路由负载;第二个表格保留了配套性能分析中的调用次数、累计耗时和每次调用的中位数。累计耗时不视为这个微批次的墙钟时间,也不会直接加到 GPU 内核耗时上。The first table identifies this microbatch’s routing load; the second preserves call counts, cumulative times, and per-call medians from the accompanying profile. Cumulative times are not treated as this one microbatch’s wall time or added directly to GPU kernel times.
相同的 token 总量被拆分成了更多 GEMM 问题。对于形状匹配的专家矩阵,GEMM 的主要算术运算量随各专家 token 行数之和而变化。Real 和 Mock 的 token 总量相同,但 Real 将其分布到 126 个活跃专家上,而 Mock 分布到 24 个。因此,Real 中每个专家的平均 M 更小,非空问题项也更多。其较低的 CV 表明分布更加均衡,而准备和调度也取决于问题数量和粒度。较小的 GEMM 可用于摊销固定准备成本和启动成本的计算量更少。The same token budget is split into more GEMM problems. For matching expert matrix shapes, the main GEMM arithmetic scales with the sum of expert token-row counts. Real and Mock have the same token total, but Real distributes it across 126 active experts and Mock across 24. Real therefore has a smaller average M per expert and more nonempty problem entries. Its lower CV indicates a more balanced distribution, while preparation and scheduling also depend on problem count and granularity. Many smaller GEMMs have less computation over which to amortize fixed preparation and launch costs.
cuBLASLt 算法选择会在主机端反复执行。原始性能分析显示,AlgoGetHeuristic 是 BF16 的主要瓶颈。多流、多张量路径仍会反复进行算法选择,并为专家计算问题准备形状、布局和调用参数。两者的启发式选择中位耗时均为 2.9 µs,但 Real 的调用次数约为 4.6 倍,表明额外开销主要来自重复执行。外层 nvte_multi_tensor_gemm 的调用次数相近,但每次调用内部的专家计算问题和准备工作有所不同。因此,Real 的调用时间中位数为 2.29 ms,约为 Mock 的 5.2 倍。cuBLASLt algorithm selection repeatedly runs on the host. The original profile identifies AlgoGetHeuristic as a major BF16 bottleneck. The multi-stream, multi-tensor path still performs repeated algorithm selection and prepares shapes, layouts, and call parameters for expert problems. Both heuristic medians are 2.9 µs, but Real has approximately 4.6× as many calls, indicating that repeated work drives the extra cost. Outer nvte_multi_tensor_gemm counts are similar, while the expert problems and preparation inside each call differ. Real’s median call time is consequently 2.29 ms, approximately 5.2× Mock’s.
粒度更细的内核会拉长提交链。对于相同的 token 预算,Real 的 nvjet 内核数量约为 Mock 的 25 倍,表明两者的 GPU 调用组织方式不同。如果 CPU 端的算法选择、参数准备和启动提交成为瓶颈,那么增加流数量也未必能掩盖 GPU 等待下一批任务的时间。这就是该路径中需要检查的 CPU 空泡。计数直接佐证了准备和调度工作有所增加;而 GPU 间隙的持续时间仍需通过相应的时间线来确认。More fine-grained kernels lengthen the submission chain. Real has approximately 25× as many nvjet kernels as Mock, showing different GPU call organization for the same token budget. If CPU algorithm selection, argument preparation, and launch submission become the bottleneck, additional streams may not hide the GPU’s wait for its next tasks. This is the CPU bubble to examine in that path. The counts directly support increased preparation and scheduling work; the duration of GPU gaps still requires the corresponding timeline.
稠密分组 GEMM 针对的是这条准备与调度链。第 5 节中的连续缓冲区、设备端偏移量和元数据,以及可复用的分配机制,将专家计算纳入统一的分组调度路径,从而减少主机端切片、列表组装、参数构造和重复整理。这些改动影响 GEMM 周边的工作以及完整调用耗时,因此应结合实现路径来解读观察到的差异。实际速度比仍基于可比的模块或学习器耗时,并且 BF16 和低精度评估均使用真实权重和路由。Dense grouped GEMM targets this preparation and scheduling chain. Section 5’s contiguous buffers, device-side offsets and metadata, and reusable allocations put expert problems on one grouped scheduling path, reducing host-side slicing, list assembly, argument construction, and repeated organization. These changes affect the work surrounding GEMM and the complete call time, so the observed difference should be interpreted together with the implementation path. Actual speed ratios remain based on comparable module or learner timings, with real weights and routing used for both BF16 and low-precision evaluation.

已记录的个人资料Recorded profile

录制的个人资料Recorded profile
图 7. 展示调用结构的代表性剖面图。截图未提供形状和计时器相匹配的成对计时数据,因此不会用 3.594 ms 除以 156µs 来报告加速比。性能数据来自上文的模块/学习器测量结果。Figure 7. Representative profiles illustrating invocation structure. The screenshots do not supply paired timings with matching shapes and timers, so 3.594 ms and 156µs are not divided to report a speedup. Performance comes from the module/learner measurements above.
6.5 Rollout 与在线强化学习:系统收益与剩余成本6.5 Rollout and Online RL: System Gains and Remaining Costs
首先在固定输出工作负载下测试采样器。八个引擎使用真实的 DAPO 提示词,在忽略 EOS 的情况下各生成恰好 1024 个 token,并在针对每种配置进行扫描后,分别选择并发数 64。The sampler is first tested at fixed output workload. Eight engines use real DAPO prompts, generate exactly 1024 tokens with EOS ignored, and independently select concurrency 64 after a sweep for each configuration:
| Configuration | Aggregate output tokens/s | Mean TPOT | Throughput ratio |
|---|---|---|---|
| BF16 | 49,119.1 | 10.21 ms | 1.000× |
| NVFP4 | 80,675.8 | 6.05 ms | 1.642× |
表 6-17。固定输出服务。BF16 使用 Triton MoE;NVFP4 使用 FlashInfer TRT-LLM/ModelOpt FP4 和逐 token 缩放。此项测试衡量的是采样栈,而非单独评估 miniTE 训练算子。Table 6-17. Fixed-output serving. BF16 uses Triton MoE; NVFP4 uses FlashInfer TRT-LLM/ModelOpt FP4 and per-token scaling. This measures the sampling stack rather than isolating miniTE training operators.
八引擎固定输出测试使用与表 6-17 相同的测量数据。在吞吐量和 TPOT 之间切换。由于没有可用的重复运行区间,因此未绘制误差线。静态版本显示输出吞吐量。The eight-engine fixed-output test uses the same measurements as Table 6-17. Switch between throughput and TPOT. No repeated-run interval is available, so no error bars are drawn. The static version shows output throughput.
打开交互式图表:查看数值、切换配置、下载 SVG / CSVOpen interactive figure: inspect values, switch configurations, download SVG / CSV
D16 · Eight-Engine Request Rates, Per-Engine Throughput, and Serving Protocol| variant | BEST concurrency | final sum out tok/s | Mean output / engine | sum req/s | mean TPOT | vs peer |
|---|---|---|---|---|---|---|
| NVFP4 | 64 | 80675.8 | 10084.5 | 78.78 | 6.05 ms | 1.64× vs BF16 |
| BF16 | 64 | 49119.1 | 6139.9 | 47.97 | 10.21 ms | baseline |
表 6-18。完整的服务结果。在输出长度固定时,请求速率和输出令牌吞吐量描述的是同一工作负载。Table 6-18. Complete serving results. At fixed output length, request rate and output-token throughput describe the same workload.
静态内存占比为 0.6,且禁用了分段 CUDA 图。请求使用聊天模板、未填充的输入、不设速率限制、刷新缓存,上下文限制为 8192。单引擎扫描使用 64 个提示词,并将并发数设为 1–96;随后使用选定的并发数 64,在八个引擎上对 512 个提示词进行测试。单引擎峰值吞吐量约为 NVFP4 的 10206.8 tokens/s 和 BF16 的 6063.5 tokens/s;这与八引擎聚合的主要结果分开统计。The static memory fraction is 0.6 and piecewise CUDA graphs are disabled. Requests use a chat template, unpadded inputs, no rate limit, cache flushing, and context limit 8192. A single-engine sweep uses 64 prompts and concurrency 1–96; the selected concurrency 64 is then tested with 512 prompts across eight engines. Single-engine peak throughput is approximately 10206.8 tokens/s for NVFP4 and 6063.5 for BF16, separate from the eight-engine aggregate main result.
完整的 RL 还将学习器更新和权重同步与生成过程连接起来。对于没有重叠的顺序工作流,Complete RL also connects learner updates and weight synchronization to generation. For a sequential workflow without overlap,
Titer = Trollout + Tlearner + Tconvert+sync + Torchestration . T_{\mathrm{iter}}= T_{\mathrm{rollout}}+T_{\mathrm{learner}}+ T_{\mathrm{convert+sync}}+T_{\mathrm{orchestration}}.当各阶段存在重叠时,应以测得的墙钟时间为准。表 6-19 报告了 BF16、原生 TE NVFP4 和 miniTE 的每 token 记录阶段:When stages overlap, measured wall time is the reference. Table 6-19 reports the recorded stages for BF16, native TE NVFP4, and miniTE per-token:
| Configuration | Steady-state steps | Train s | Conversion/sync s | Two-stage total s |
|---|---|---|---|---|
| BF16 | 11 | 47.04 | 9.94 | 56.98 |
| TE NVFP4 | 10 | 44.70 | 50.88 | 95.58 |
| miniTE per-token, BF16 backward | 10 | 42.56 | 55.26 | 97.82 |
表 6-19. 在线强化学习各阶段的平均耗时。Train 包括对数概率重新计算和 actor 训练。两个阶段的耗时之和并非完整的一次迭代。TE NVFP4 使用其原生反向配置;miniTE per-token 则明确禁用了反向量化。Table 6-19. Mean online RL stage times. Train includes log-probability recomputation and actor training. The two-stage sum is not a full iteration. TE NVFP4 uses its native backward configuration; miniTE per-token explicitly disables backward quantization.
堆叠柱状图使用表 6-19 中测得的各阶段平均值:BF16 为 11 个稳态步骤,TE NVFP4/miniTE 为每个 token 10 个稳态步骤。此图不包含 rollout 时间。该滑块计算在假设没有重叠且其他成本保持不变的情况下,需要节省多少 rollout 时间才能抵消记录的两阶段开销。这是有条件的算术计算,并非完整的 RL 速度预测。打印输出仅显示测得的阶段。Stacked bars use measured stage means from Table 6-19: 11 steady-state steps for BF16, 10 for TE NVFP4/miniTE per-token. Rollout time is excluded from this plot. The slider calculates how much rollout time must be saved to cover the recorded two-stage overhead, assuming no overlap and unchanged other costs. It is conditional arithmetic, not a full-RL speed prediction. Printing shows measured stages only.
打开交互式图表:查看数值、切换配置、下载 SVG / CSVOpen interactive figure: inspect values, switch configurations, download SVG / CSV
miniTE 每个 token 的训练速度约为 BF16 的 1.11 倍,TE NVFP4 的训练速度约为 1.05 倍。转换/同步分别慢约 5.56 倍和 5.12 倍。miniTE 在这两个阶段总计额外耗时 40.84 秒。在本次运行中,rollout 阶段的收益不足以抵消同步成本,因此转换和传输是后续优化的重要目标。miniTE per-token Train is approximately 1.11× faster than BF16 and TE NVFP4 approximately 1.05×. Conversion/synchronization is approximately 5.56× and 5.12× slower, respectively. miniTE per-token adds 40.84 seconds across these two stages. In this run, rollout gains did not offset synchronization cost, making conversion and transfer important targets for further optimization.
这个负面结果很有参考价值:低精度算子运行得更快,并不意味着系统集成成本更低。独立的服务比例无法替代在同一运行窗口内测得的部署时间,而且将这两个阶段的耗时相加也无法得出完整的 RL 加速比。This negative result is useful: faster low-precision operators do not ensure lower system integration costs. Independent serving ratios cannot replace rollout time measured over the same run window, and summing these two stages does not yield a complete RL speedup.
D17 · Three RL Configurations, Measurement Windows, and Relative Speeds所有配置均采用在一台 8×B300 节点上的同机部署,每个采样引擎使用一块 GPU。性能 ID 0–1 的数据不纳入统计。BF16 取第 2–12 步的平均值(11 步);miniTE per-token 和 TE NVFP4 各取第 2–11 步的平均值(10 步)。所有数值均为算术平均值。All configurations use colocated deployment on one 8×B300 node, with one GPU per sampler engine. Performance IDs 0–1 are discarded. BF16 averages steps 2–12 (11 steps); miniTE per-token/TE NVFP4 each average steps 2–11 (10 steps). Values are arithmetic means.
| Configuration | Train speedup over BF16 | Sync time / BF16 sync time | Forward / sampling | Backward |
|---|---|---|---|---|
| BF16 | 1.000× | 1.000× | BF16, Triton MoE | BF16 |
| TE NVFP4 | 1.052× | 5.119× | Native TE expert NVFP4; ModelOpt/FlashInfer sampler | Native recipe, DBQ unset |
| miniTE per-token | 1.105× | 5.559× | miniTE expert per-token; same NVFP4 sampler | DBQ=1, BF16 |
表 6-20。比率有明确的方向。前文的 0.90× 数值是 miniTE 逐 token 相对于 BF16 的训练时间比率;速度是其倒数,并非完整 RL 的结果。TE NVFP4 和 miniTE 逐 token 使用同类型的 NVFP4 rollout 配置;服务表中的数据并未针对两者分别重新测量。Table 6-20. Ratios have explicit directions. The earlier 0.90× value is the miniTE per-token/BF16 Train-time ratio; speed is its reciprocal, not a full-RL result. TE NVFP4 and miniTE per-token use the same type of NVFP4 rollout configuration; the serving table is not independently remeasured for each.
关键结果 · §6.5Key result · §6.5
在八引擎固定输出测试中,miniTE 的每 token 服务吞吐量约为 BF16 的 1.64 倍。In the eight-engine fixed-output test, miniTE per-token serving throughput is about 1.64× BF16.
6.6 实验得出的结论6.6 What the Experiments Establish
这些实验共同解释了 miniTE 的实现选择。算子和梯度检查验证了接口、布局和反向传播精度。模块前向传播和直接测得的前向与反向传播(F+B)耗时用于定位局部开销。真实文本学习器测试用于确认这些选择是否能降低完整更新的成本。服务部署和在线强化学习(RL)测试则揭示了权重转换与同步带来的额外约束。Together, these experiments explain miniTE’s implementation choices. Operator and gradient checks support interfaces, layouts, and backward precision. Module forward and direct F+B timings locate local costs. Real-text learner tests establish whether these choices reduce complete update cost. Serving and online RL tests reveal the additional constraints of weight conversion and synchronization.
因此,低比特训练的收益必须从多个层面进行验证:数值正确性、持续学习能力、更快的本地计算速度,以及可控的集成成本。我们保留每个层面的核心测量数据和完整的配置对比,并使用 miniTE 测试记录呈现性能结果。Low-bit training benefits must therefore be validated at multiple levels: numerical correctness, sustained learning, faster local computation, and manageable integration cost. We retain core measurements and complete configuration comparisons at each level, using miniTE test records for performance results.
7. 使用和扩展 miniTE7. Using and Extending miniTE
7.1 通过线性接口集成现有模型7.1 Integrating Existing Models through Linear Interfaces
实现包是 miniTransformer,而线性层是 miniTE 的基本集成单元。Linear、LayerNormLinear 和 GroupedLinear 分别提供常规投影、归一化与线性计算的组合,以及 MoE 专家计算。现有的 Megatron 封装可以连接到这些模块,用户也可以直接传入根据命名配方构造的参数:The implementation package is miniTransformer, and the linear layer is miniTE’s basic integration unit. Linear, LayerNormLinear, and GroupedLinear provide ordinary projections, combined normalization and linear computation, and MoE expert computation. Existing Megatron wrappers can connect to these modules, or users can pass parameters constructed from a named recipe directly:
import torch
from miniTransformer.module.config import get_qlinear_params
from miniTransformer.module.linear import Linear
params = get_qlinear_params("nvfp4_per_token")
layer = Linear(
1024, 1024,
bias=False,
params_dtype=torch.bfloat16,
device="cuda",
qlinear_params=params,
)
配方选择决定数值路径;模块集成决定哪些模型层使用 miniTE。MoE 启动器会为其 miniTransformer 后端同时设置这两项。GroupedLinear 对输出维度和分组布局有限制,且不支持序列并行。集成时应检查具体模型和并行配置。Recipe selection determines the numerical path; module integration determines which model layers use miniTE. The MoE launcher sets both for its miniTransformer backends. GroupedLinear imposes output-dimension and grouped-layout constraints and does not support sequence parallelism. Integration should check the specific model and parallel configuration.
miniTE 保留了 TE/Megatron 检查点参数命名和兼容性接口。当前的额外状态接口不会恢复所有 TE 内部量化状态。参数加载兼容性和完整内部状态兼容性分别进行验证。miniTE retains TE/Megatron checkpoint parameter naming and compatibility interfaces. The current extra-state interface does not restore all TE internal quantization state. Parameter-loading compatibility and full internal-state compatibility are validated separately.
7.2 明确的配方与精度边界7.2 Explicit Recipes and Precision Boundaries
1.0.0 版本使用描述数值行为的名称。用户可通过 MINITE_RECIPE 选择训练方案,或使用 get_qlinear_params 构建独立的参数和算子:Version 1.0.0 uses names describing numerical behavior. Users select a training recipe with MINITE_RECIPE or construct independent parameters and operators with get_qlinear_params:
| Named recipe | Forward and scaling | Backward and use |
|---|---|---|
nvfp4_per_token |
Per-token NVFP4; TE weight scaling | MXFP8 backward; first-use example |
nvfp4_per_token_bf16_bwd |
Per-token NVFP4 | Dedicated TE-style BF16 backward operator |
nvfp4_cursor2_cutlass_v2 |
Per-token activations, per-expert tensor weight amax; CUTLASS V2 | MXFP8 backward; custom grouped path |
nvfp4_block |
NVFP4 block scaling | NVFP4 backward; block-scaling recipe |
nvfp4_per_token_w_per_tensor |
Per-token activations, per-expert tensor weight amax | Weight-scaling ablation |
unquantized |
Dtype controlled by layer parameters | Quantization disabled for high-precision comparison |
表 9. 1.0.0 版本中的部分命名条目。性能实验保留各自的源代码修订版本、前向/反向精度和量化覆盖范围;名称用于选择当前的软件配置。Table 9. Selected named entries in version 1.0.0. Performance experiments retain their own source revisions, forward/backward precision, and quantization coverage; names select the current software configuration.
对于一体化培训项目:For an integrated training program:
MINITE_RECIPE=nvfp4_per_token python train.py
此处 train.py 表示用户的训练入口。通过当前的命名接口表达报告中 miniTE 按 token 选择 BF16 层旁路的方案,可得:Here train.py denotes the user’s training entry point. Expressing the report’s miniTE per-token BF16 layer-bypass choice through the current named interface gives:
MINITE_RECIPE=nvfp4_per_token DISABLE_BACKWARD_QUANT=1 python train.py
这一层绕过实现与专用的 nvfp4_per_token_bf16_bwd 算子分别实现并记录。第 6 节中两条 miniTE 路径的速度数据属于原始实验路径。该专用算子需要单独进行性能测量。历史复现还采用原始修订版的启动配置,并修复了采样器量化、检查点转换、仅专家层覆盖范围以及 TE 修订版。This layer bypass and the dedicated nvfp4_per_token_bf16_bwd operator are implemented and recorded separately. Speeds of both miniTE paths in Section 6 belong to the original experimental paths. The dedicated operator requires its own performance measurements. Historical reproduction also uses the original revision’s launch configuration and fixes sampler quantization, checkpoint conversion, expert-only coverage, and TE revision.
7.3 将诊断纳入扩展开发流程7.3 Diagnostics as Part of Extension Development
配置检查应在构建模型之前开始。请在 miniTransformer 仓库根目录运行以下命令:Configuration checks begin before constructing a model. Run these commands from the miniTransformer repository root:
python -m miniTransformer recipes
python -m miniTransformer describe nvfp4_per_token
python -m miniTransformer doctor --recipe nvfp4_per_token
bash develop/script/moe_training_e2e.sh \
--backend mini_nvfp4_per_token --profile off --dry-run
recipes 和 describe 用于展示名称、依赖项和向后兼容的覆盖项,无需 Torch 或 TE。doctor 会检查可见的 CUDA GPU、TE 量化器参数、选定的 dense/list 分组接口以及算子导入情况。--dry-run 会打印 recipe、相关环境和完整命令,但不会启动训练或创建日志/缓存目录。实际运行会在 run_meta.json 中记录 recipe 名称、前向/反向设置、布局请求和配置来源。recipes and describe expose names, dependencies, and backward overrides without Torch or TE. doctor inspects visible CUDA GPUs, TE quantizer arguments, selected dense/list grouped interfaces, and operator imports. --dry-run prints the recipe, relevant environment, and complete command without starting training or creating log/cache directories. Actual runs record the recipe name, forward/backward settings, layout request, and configuration source in run_meta.json.
此接口更新的全部 21 项 CPU 兼容性检查均已通过,涵盖解析、冲突选择器、无 GPU 依赖的检查、后端别名、试运行和元数据。新增的 GPU 等价性测试涵盖独立配置、受支持的 Dense/GroupedLinear 路径上的前向与反向行为,以及两种 BF16 反向选项。本次更新未在本地运行这些测试。第 6 节中的数值与性能结果保留了其原有的实验标识。All 21 CPU compatibility checks for this interface update passed, covering resolution, conflicting selectors, inspection without GPU dependencies, backend aliases, dry-run, and metadata. Added GPU equivalence tests cover independent configurations, forward/backward behavior on supported Dense/GroupedLinear paths, and the two BF16 backward choices. They have not been run locally in this update. Numerical and performance results in Section 6 retain their original experiment identities.
扩展低精度路径时,我们会先检查算子,再检查模块和跨框架行为,最后完成完整训练。张量钩子会收集激活值、权重、输出和梯度的统计信息。性能分析会定位内核开销、调用间隙和内存分配情况。转储/比较脚本会检查 MoE 中间结果和 token 对数概率。新配方会在注册表中声明其用途和依赖项,通过现有参数工厂接入算子,并遵循这些数值和运行时检查。When extending a low-precision path, we check operators, then modules and cross-framework behavior, and finally complete training. Tensor hooks collect activation, weight, output, and gradient statistics. Profiling locates kernel costs, call gaps, and allocation. Dump/compare scripts examine MoE intermediates and token log probabilities. A new recipe declares its purpose and dependencies in the registry, connects its operator through the existing parameter factory, and follows these numerical and runtime checks.
仓库的 README 涵盖了设置、层集成和启动示例;双语配方指南介绍了选择和覆盖规则。模型转换、采样和评估需要各自指定锁定版本和设置。当前的软件接口与历史实验配置分别记录。The repository README covers setup, layer integration, and launch examples; the bilingual recipe guides document selection and override rules. Model conversion, sampling, and evaluation require their own pinned versions and settings. Current software interfaces and historical experiment configurations are recorded separately.
8. 讨论:从数值对齐到端到端学习8. Discussion: From Numerical Alignment to End-to-End Learning
这些实验通过两条路径应对低精度强化学习:TRIAGE 在存在不匹配时调整更新方式,而 miniTE 则减少执行差异和计算成本。两者都无法解决所有问题。接下来的问题是:计算加速能否带来端到端的节省?数值一致性提高能否改善学习效果?The experiments address low-precision RL through two tracks: TRIAGE changes updates in the presence of mismatch, while miniTE reduces execution differences and compute cost. Neither resolves every issue. The next questions are whether faster computation yields end-to-end savings, and whether closer numerical agreement produces better learning.
8.1 权重更新与同步仍然是瓶颈8.1 Weight Updates and Synchronization Remain a Bottleneck
这里的权重更新是指将训练后的权重转换、传输并加载到采样器中。在我们测量的配置中,这仍然是一个主要瓶颈。学习器更新和 rollout 速度加快,并不意味着完整 RL 迭代时间会按比例缩短。在第 6.5 节报告的运行中,转换和同步开销抵消了采样加速带来的收益。Here, update weight means converting, transferring, and loading the trained weights into the sampler. This remains a major bottleneck in the configurations we measured. Faster learner updates and rollouts do not imply a proportional reduction in complete RL iteration time. In the run reported in Section 6.5, conversion and synchronization costs offset the gains from faster sampling.
进一步优化应综合考虑参数表示、量化与打包、传输、加载以及同步频率。可探索的方向包括:在同一权重版本中复用低精度表示、将转换与传输合并,以及在明确的版本控制下,让同步与采样重叠进行。降低同步频率可以节省传输时间,但会加剧策略滞后。应在训练预算相同的条件下,根据完整迭代时间和任务表现评估这些选择。还需要在这一端到端范围内评估在线 amax 和更深层次的算子融合。Further optimization should consider parameter representations, quantization and packing, transfer, loading, and synchronization frequency together. Possible directions include reusing low-precision representations within the same weight version, combining conversion with transfer, and overlapping synchronization with sampling under explicit version control. Less frequent synchronization can save transfer time but increases policy staleness. These choices should be evaluated using complete iteration time and task performance under matched training budgets. Online amax and deeper operator fusion also need evaluation within this end-to-end scope.
8.2 为什么算子对齐后低精度仍然敏感?8.2 Why Does Low Precision Remain Sensitive After Operator Alignment?
匹配算子和量化方案可以消除部分执行差异。然而,仅仅匹配名称,并不能保证在不同输入形状、批次和并行配置下执行相同的浮点计算。浮点加法不满足结合律:归约顺序、融合边界或分块方式的变化都可能改变计算结果。固定的执行路径可以是确定性的。剩下的问题是:执行条件变化时,扰动会从何处产生,又会如何影响后续更新。Matching operators and quantization recipes removes some execution differences. Matching their names alone, however, does not guarantee identical floating-point computation across input shapes, batches, and parallel configurations. Floating-point addition is not associative: changes in reduction order, fusion boundaries, or tiling can change the result. A fixed execution path can be deterministic. The remaining question is where perturbations arise when execution conditions change and how they affect subsequent updates.
我们的对齐实验和长程评估揭示了这个问题的两个方面。严格的对齐配置将差距缩小到约 10⁻⁸,而 miniTE 的长程学习和检查点评估并非在每项比较中都达到与 BF16 相当的结果。这些结果采用了不同的配置和测量范围,但综合来看,它们表明,为什么必须分别评估数值一致性和最终学习质量。在我们测试的低精度配置中,看似微小的扰动为何会造成更严重的影响?Our alignment experiment and long-run evaluations expose two sides of this problem. The strict alignment configuration reduces gap to approximately 10⁻⁸, while miniTE’s long-run learning and checkpoint evaluations do not match BF16 in every comparison. These results use different configurations and measurement scopes, but together they show why numerical agreement and final learning quality must be evaluated separately. Why can seemingly small perturbations be more damaging in the low-precision configurations we tested?
可能的机制包括持续存在的误差偏差、粗粒度量化边界附近的舍入转换、MoE 路由变化,以及梯度裁剪与优化器状态的累积响应。这些仍只是一些假设。更有信息量的实验应固定模型和数据,控制扰动的位置、方向和相关性,并比较 BF16 与低精度下后续的更新和长期奖励,而不是依赖单步平均差距。Candidate mechanisms include persistent error bias, rounding transitions near coarse quantization boundaries, MoE routing changes, and the accumulated response of gradient clipping and optimizer state. These remain hypotheses. More informative experiments would hold the model and data fixed, control the location, direction, and correlation of perturbations, and compare subsequent updates and long-run reward in BF16 and low precision, rather than relying on a single-step average gap.
8.3 优化更新与最终学习成果8.3 Optimize Updates and Final Learning Outcomes
平均对数概率差无法线性换算为奖励。相似的平均差值可能出现在不同的 token、优势符号和响应片段上,并对更新产生不同影响。较小的差值也不能保证带来有效探索或梯度信号。TRIAGE 的方向性分析提供了一个切入点。后续工作可以直接考察错误如何改变更新,并在数据量、更新次数和墙钟时间预算相同的条件下,通过奖励和评估分数测试纠正方法。Mean log-probability difference cannot be converted linearly into reward. Similar average gaps can occur on different tokens, advantage signs, and response segments, with different effects on updates. A small gap also does not guarantee useful exploration or gradient signal. TRIAGE’s directional analysis offers one starting point. Further work can directly examine how errors alter updates, testing corrections through reward and evaluation scores under matched data, update, and wall-clock budgets.
社区采用的方法也在不断拓展。Together AI 的 Score Centering(SC)加入了一项校正,用于消除不匹配导致的策略梯度漂移,并且可以与重要性采样结合使用 [17]。Qwen 团队的 TRACE 利用 rollout 端的量化结果来指导训练端的 FP4 舍入,并压缩指导信息 [18]。SC 改变了梯度估计器;TRACE 则协调量化决策。TRACE 的目标仍是实现对齐,但这两项工作都将可用的干预手段拓展到了匹配算子实现之外。The community’s approaches are broadening too. Together AI’s Score Centering (SC) adds a correction that removes mismatch-induced drift from the policy gradient and can be combined with importance sampling [17]. The Qwen team’s TRACE uses rollout-side quantization outcomes to guide training-side FP4 rounding and compresses the guidance information [18]. SC changes the gradient estimator; TRACE coordinates quantization decisions. TRACE still targets alignment, but both works expand the available interventions beyond matching operator implementations.
对于 miniTE,这意味着既要支持围绕更新规则、精度分配和采样策略开展联合实验,也要确保数值执行受控且具有可比性。我们希望社区能够探究如何保留与任务相关的学习信号、抑制在多轮更新中不断累积的偏差,并将这些改进转化为端到端的性能提升。目标是在给定资源预算内实现更好的学习,而不只是降低一致性指标。For miniTE, this means supporting joint experiments on update rules, precision allocation, and sampling policy alongside controlled, comparable numerical execution. We hope the community will investigate how to preserve task-relevant learning signal, suppress bias that compounds across updates, and translate these changes into end-to-end gains. The goal is better learning within a given resource budget, not simply a smaller consistency metric.
附录 A:实验设置与统计数据Appendix A. Experimental Setup and Statistics
A.1 补充算法与训练材料A.1 Supplementary Algorithm and Training Materials
TRIAGE 的方法和结果遵循发布稿及其诊断附录。检查点采用表 3 中的设置,五项数学基准测试的权重相同。更新后的 4B 平均分为:BF16 为 58.26%,TRIAGE 为 58.49%;在双方共用的第 300 步检查点上,TRIAGE 得分为 53.03%。TRIAGE’s method and results follow the release manuscript and its diagnostic appendix. Checkpoints are those in Table 3, with equal weight across five mathematics benchmarks. Updated 4B means are 58.26% for BF16 and 58.49% for TRIAGE; TRIAGE scores 53.03% at the shared step-300 checkpoint.
表征采用独立的诊断运行:4B 使用更新步数 1–324,30B 使用更新步数 1–724,最大完成长度分别为 16,384 和 20,480。4B 分析使用学习器与采样器之间的直接差值;30B 则使用路由重放后的残差差值。健康阶段有效 token 上的固定尾部阈值分别为 −0.24208 和 −0.03949。Characterization uses separate diagnostic runs: updates 1–324 for 4B and 1–724 for 30B, with maximum completion lengths 16,384 and 20,480. The 4B analysis uses direct learner–sampler gaps; 30B uses residual gaps after routing replay. Fixed tail thresholds over valid tokens in the healthy stage are −0.24208 and −0.03949, respectively.
这些诊断运行使用 DAPO-Math-17K、学习器种子 1234、rollout/数据种子 42、每次迭代 16 个提示、每个提示 16 个响应,以及 GBS 256。它们使用 RHT 和梯度随机舍入;这些数值设置与 miniTE 的实际流程不同,后者会禁用这些选项。详细窗口、长度敏感性、单步更新审计和随机化控制见诊断附录。These diagnostic runs use DAPO-Math-17K, learner seed 1234, rollout/data seed 42, 16 prompts per iteration, 16 responses per prompt, and GBS 256. They use RHT and gradient stochastic rounding; these numerical settings differ from miniTE’s practical path, where the options are disabled. Detailed windows, length sensitivity, one-step update audits, and randomization controls are in the diagnostic appendix.
TRIAGE 材料用于算法结果评估。其镜像未调优到与 miniTE 性能环境相同的水平,因此其吞吐量不作为 miniTE 的上界或算法开销基线。TRIAGE materials are used for algorithmic outcomes. Its image was not tuned to the same level as the miniTE performance environment, so its throughput is not used as a miniTE upper bound or an algorithm-overhead baseline.
A.2 补充长期运行强化学习与检查点评估A.2 Supplementary Long-Run RL and Checkpoint Evaluation
图 5 和表 6–8 使用以下训练配置和评估协议:Figure 5 and Table 6-8 use the following training configuration and evaluation protocol:
| Item | Setting |
|---|---|
| Model and data | Qwen3-30B-A3B-Base; DAPO-Math-17K, math reward |
| Objective | GRPO; token-wise TIS in non-strict configurations |
| Seeds | Training seed 1234; rollout shuffle seed 42 |
| Batch | 32 prompts per iteration, 16 responses each; GBS 512 |
| Generation | Temperature 1.0, top-p 1.0, top-k disabled, maximum response 20,480 |
| Parallelism and allocation | 8 nodes, 8 actor GPUs each; TP/PP/CP/EP/ETP = 1/1/1/4/1; colocated actor/sampler |
| Optimizer | Adam, learning rate 10−610^{-6} , no warmup; weight decay 0.1, β1=0.9,β2=0.98,ϵ=10−8 \beta_1=0.9,\beta_2=0.98,\epsilon=10^{-8} , gradient clipping 1.0 |
| Memory policy | Full activation recomputation, dynamic microbatches; distributed precision-aware optimizer, CPU offload and overlapping transfer |
| TIS and clipping | Token-wise TIS clipped to [0,2]; policy update ratio [0.80,1.28]; routing replay disabled |
| Evaluation | Step 999; temperature 0.7, top-p 1.0, maximum generation length 20,480 |
| Repetitions and metrics | Six evaluations per AIME; four each for MATH-500, GSM8K, IFEval; IFEval Prompt-level Strict |
表 A1. miniTE 补充长时间运行协议。该协议与在一台配备 8×B300 的节点上进行的固定文本学习器测试不同。重复进行检查点评估不会增加训练随机种子的数量。Table A1. Supplementary miniTE long-run protocol. This differs from the fixed-text learner test on one 8×B300 node. Repeated checkpoint evaluations do not increase the number of training seeds.
三个主要配置涵盖步骤 0–999,各包含一条轨迹,并采用居中的 21 步均值。图 4 保留了四面板图,并使用 15 步平滑;配套论文还包含一个相关对齐实验的双面板展示,使用 21 步平滑。每个图注都保留各自的约定。严格对齐会同时更改多个执行组件,并移除 TIS;其计时与学习器性能测试分开进行。The three main configurations cover steps 0–999, with one trajectory each and centered 21-step means. Figure 4 retains the four-panel plot with 15-step smoothing; the accompanying paper also contains a two-panel presentation of a related alignment experiment with 21-step smoothing. Each caption retains its own convention. Strict alignment changes several execution components together and removes TIS; its timing is separate from learner performance tests.
A.3 固定文本 miniTE 学习者测试A.3 Fixed-Text miniTE Learner Tests
| Item | Setting |
|---|---|
| Model and hardware | Qwen3-30B-A3B, one 8×B300 node |
| Parallelism and shape | TP/PP/CP/EP = 1/1/1/4; sequence 4096; micro-batch 1; GBS 128 |
| Workload | 524,288 tokens per update; 16 accumulated microbatches |
| Data and initialization | 657 frozen 4097-token DAPO sequences; same BF16 checkpoint; seed 20260913 |
| Software | PyTorch 2.11.0+cu130, CUDA 13.0.88, NCCL 2.28.9, Megatron-Core 0.16.0rc0 |
| Megatron | Revision 52153937, integration patches for the experiment |
| Core revision | miniTE 953f17f9; ten independent processes, no permutation fusion |
| Optimized revision | miniTE b641179; dense, GEMM-kind, permutation fusion and amax reuse |
| TE | Early eaca54e9, later 8ea5a92d handles zero-token experts; nonempty-group paths checked |
| TE per-token | 690ffea4 with CUDA 13 build fixes, separate environment |
表 A2. 固定文本性能测试协议。数据构建包含约 4.3 倍的重复。禁用激活重计算、卸载和 CUDA 图。计时包含量化路径的专家填充开销。Table A2. Fixed-text performance protocol. Data construction includes approximately 4.3-fold repetition. Activation recomputation, offload, and CUDA graphs are disabled. Expert-padding costs of quantized paths are included in timing.
核心协议每个进程运行 20 次更新,其中 5 次为预热更新,并测量第 6–15 次更新。每次运行的吞吐量为 524,288 除以更新耗时的中位数。对十次运行,去掉最大值和最小值后再计算平均值。加速比先按运行 ID 配对,再以相同方式去除极值。The core protocol runs 20 updates per process, uses five warmup updates, and measures updates 6–15. Each run’s throughput is 524,288 divided by median update time. Across ten runs, the maximum and minimum are removed before averaging. Speedups are first paired by run ID and then trimmed in the same way.
优化后的协议针对每种配置使用一个进程,并进行 17 次更新。经过两次预热后,剔除剩余 15 次更新时间中的最大值和最小值。吞吐量为 524,288 个 token 除以保留时间的平均值;加速比使用同轮基线计算。各估计量分别报告。核心运行 3 受到一个空闲服务进程的干扰,按照预先设定的截尾规则,剔除受影响的最小值观测。所有十条记录和修订差异均保留在 miniTE 摘要中。The optimized protocol uses one process per configuration and 17 updates. After two warmups, the maximum and minimum of the remaining 15 update times are removed. Throughput is 524,288 tokens divided by the mean of the retained times; speedups use the same-round baseline. The estimators are reported separately. Core run 3 experienced interference from an idle serving process, and affected minimum observations are removed under the predefined trimming rule. All ten records and revision differences remain in the miniTE summary.
表 6-9 使用了十次独立运行所得的成对加速比。1.334× 是各次运行比值的截尾均值;1.344× 是总吞吐量均值之比。后续的融合实验采用了不同的版本和配置,因此单独报告。Table 6-9 uses paired speedups from ten independent runs. The 1.334× value is the trimmed mean of per-run ratios; 1.344× is the ratio of aggregate throughput means. The later fusion experiment uses a different revision and configuration and is reported separately.
A.4 模块、服务与 RL 阶段计时A.4 Module, Serving, and RL Stage Timing
模块测试使用一块 GPU、32 个本地专家、四种预分发 token 大小,并在静态权重预热后独立运行五次进程。测试不包含分发,且 FC2 激活已提前准备。模块前向的性能提升与学习器的加速效果不同。上游 TE 的每 token 实现与 miniTE 在全模型量化覆盖范围和反向传播精度上有所不同;其全模型对比不用于单独衡量实现带来的性能提升。Module tests use one GPU, 32 local experts, four pre-dispatch token sizes, and five independent process runs with warm static weights. Dispatch is excluded and FC2 activations are prepared beforehand. Module-forward gains are distinct from learner speedups. Upstream TE per-token has different full-model quantization coverage and backward precision from miniTE; its full-model comparison is not used to isolate implementation gains.
推理服务使用固定的输出长度 1024、ignore_eos=true、8,192 个 token 的上下文限制、0.6 的静态内存占比,并禁用分段 CUDA 图。单个引擎使用 64 个提示词,对并发数 1、2、4、8、16、32、48、64 和 96 进行测试。两种配置都先选择 64 个提示词,再由八个引擎处理 512 个提示词。Serving uses fixed output length 1024, ignore_eos=true, context limit 8,192 tokens, static memory fraction 0.6, and disabled piecewise CUDA graphs. A single engine uses 64 prompts to sweep concurrency 1, 2, 4, 8, 16, 32, 48, 64, and 96. Both configurations select 64 before processing 512 prompts across eight engines.
同节点 RL 测试使用一个配备 8 张 B300 GPU 的节点,每个引擎使用一张 GPU。BF16 统计数据涵盖性能步骤 2–12;miniTE 涵盖步骤 2–11。学习器计时包括对数概率计算和 Actor 训练。权重更新包括 Megatron→SGLang 同步以及 miniTE 的 BF16→NVFP4 转换。两阶段耗时总和不包括完整 rollout 和其他编排工作。Colocated RL tests use one 8×B300 node and one GPU per engine. BF16 statistics cover performance steps 2–12; miniTE covers 2–11. Learner timing includes log-probability computation and actor training. Weight updates include Megatron→SGLang synchronization and miniTE’s BF16→NVFP4 conversion. The two-stage sum excludes full rollout and other orchestration work.
API 和融合布局检查会在固定形状和配置下比较编码、缩放因子及输出。在这些边界上逐位一致,并不能证明完整模型具有批次不变性。此前的 swizzle 失败和生产环境中的 miniTE 逐 token 检查采用了不同的形状约束,因此会分别解读。API and fused-layout checks compare encodings, scales, and outputs at fixed shapes and configurations. Bitwise agreement at these boundaries does not establish full-model batch invariance. Earlier swizzle failures and the production miniTE per-token checks use different shape constraints and are interpreted separately.
附录 B. TRIAGE 方法约定Appendix B. TRIAGE Method Conventions
我们采用发布稿中的响应级归一化:先在每个响应内计算加权 token 损失均值,再对所有响应取平均。给定有效 token 掩码 mi,t m_{i,t} 和已停止梯度的门控权重 wi,t w_{i,t},We use response-level normalization from the release manuscript: compute a weighted token-loss mean within each response, then average across responses. With valid-token mask mi,t m_{i,t} and detached gate weight wi,t w_{i,t} ,
L PG,i = ∑t mi,t wi,t ℓi,tbase ∑t mi,t wi,t , αi,t = wi,t wˉi , wˉi = ∑t mi,t wi,t ∑t mi,t . \mathcal L_{\mathrm{PG},i} =\frac{\sum_t m_{i,t}w_{i,t}\ell^{\mathrm{base}}_{i,t}} {\sum_t m_{i,t}w_{i,t}},\qquad \alpha_{i,t}=\frac{w_{i,t}}{\bar w_i},\quad \bar w_i=\frac{\sum_t m_{i,t}w_{i,t}}{\sum_t m_{i,t}}.固定门控使用 64 个 token 为一段。对于负优势分段,当平均差距低于 −1.5 时,均值档位权重为 0.1;在 [−1.5, −0.5) 范围内时为 0.3;其他情况下为 1.0。如果该分段中有 k 个有效 token 满足 δ < −6,则尾部权重为 1 − 0.9 min(k/2, 1)。两个分段权重中较小的那个仅应用于负差距 token。其他 token 的权重保持为 1。The fixed gate uses 64-token segments. For negative-advantage segments, the mean-tier weight is 0.1 when mean gap is below −1.5, 0.3 for [−1.5, −0.5), and 1.0 otherwise. If kk valid tokens in the segment satisfy δ<−6\delta<-6 , the tail weight is 1−0.9min(k/2,1)1-0.9\min(k/2,1) . The smaller of the two segment weights is applied only to negative-gap tokens. Other tokens retain weight 1.
Repair 在正优势响应中使用 128 个 token 的片段,并在负边界之外应用单侧伪 Huber 惩罚。掩码、片段归一化和导数的说明见 TRIAGE 方法附录和主要方法章节。Repair uses 128-token segments within positive-advantage responses and applies a one-sided pseudo-Huber penalty beyond the negative boundary. Masks, segment normalization, and derivatives are described in the TRIAGE method appendix and main method section.
组件消融从完整 TRIAGE 的 step-300 检查点分支,并比较后续训练结果。完整图示见 TRIAGE 消融实验。这些是继续训练的对比,而非从头开始训练的消融实验。Component ablations branch from the full-TRIAGE step-300 checkpoint and compare continued training. The complete figure is in the TRIAGE ablation. These are continuation comparisons rather than ablations trained from scratch.
图表和交互式演示参考了《The 4-bitter Lesson》和 LMSYS 关于 Blackwell 低精度 RL 的文章 [15,16]。构造示例和条件计算均单独标明。The diagrams and interactive presentation draw on The 4-bitter Lesson and the LMSYS Blackwell low-precision RL article [15,16]. Constructed examples and conditional calculations are identified separately.
参考资料References
[1] NVIDIA。使用 NVFP4 对大型语言模型进行预训练。2025;更新于 2026 年。arXiv:2509.25149。[1] NVIDIA. Pretraining Large Language Models with NVFP4. 2025; updated 2026. arXiv:2509.25149.
[2] Cursor Research。《Composer 2 技术报告》。2026 年。arXiv:2603.24477。[2] Cursor Research. Composer 2 Technical Report. 2026. arXiv:2603.24477.
[3] Guangming Sheng 等人。《HybridFlow:一个灵活高效的 RLHF 框架》。EuroSys 2025。arXiv:2409.19256。[3] Guangming Sheng et al. HybridFlow: A Flexible and Efficient RLHF Framework. EuroSys 2025. arXiv:2409.19256.
[4] 邵志宏等。《DeepSeekMath:推动开放语言模型数学推理能力的极限》。2024。arXiv:2402.03300。[4] Zhihong Shao et al. DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models. 2024. arXiv:2402.03300.
[5] An Yang 等。《Qwen3 技术报告》。2025 年。arXiv:2505.09388。[5] An Yang et al. Qwen3 Technical Report. 2025. arXiv:2505.09388.
[6] Qiying Yu 等。《DAPO:大规模开源 LLM 强化学习系统》。2025 年。arXiv:2503.14476;DAPO-Math-17K 数据集。[6] Qiying Yu et al. DAPO: An Open-Source LLM Reinforcement Learning System at Scale. 2025. arXiv:2503.14476; DAPO-Math-17K dataset.
[7] Lianmin Zheng 等人。《SGLang:结构化语言模型程序的高效执行》。NeurIPS 2024。arXiv:2312.07104。[7] Lianmin Zheng et al. SGLang: Efficient Execution of Structured Language Model Programs. NeurIPS 2024. arXiv:2312.07104.
[8] Mohammad Shoeybi 等。Megatron-LM:使用模型并行训练数十亿参数语言模型。2019。arXiv:1909.08053。[8] Mohammad Shoeybi et al. Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism. 2019. arXiv:1909.08053.
[9] NVIDIA Transformer Engine。新增 NVFP4 逐 token 量化方案,PR #3045。2026 年。实现与讨论。[9] NVIDIA Transformer Engine. Add NVFP4 per-token quantization recipe, PR #3045. 2026. Implementation and discussion.
[10] Zhaopeng Qiu 等。《FP8-RL:用于大语言模型强化学习的实用且稳定的低精度技术栈》。2026。arXiv:2601.18150。[10] Zhaopeng Qiu et al. FP8-RL: A Practical and Stable Low-Precision Stack for LLM Reinforcement Learning. 2026. arXiv:2601.18150.
[11] Karl Cobbe 等人。《训练验证器以解决数学应用题》。2021 年。arXiv:2110.14168;GSM8K 官方代码仓库。[11] Karl Cobbe et al. Training Verifiers to Solve Math Word Problems. 2021. arXiv:2110.14168; official GSM8K repository.
[12] Dan Hendrycks 等,《使用 MATH 数据集衡量数学问题求解能力》,2021 年。arXiv:2103.03874。关于 MATH-500 划分,参见 Hunter Lightman 等人的《让我们逐步验证》,2023 年,arXiv:2305.20050,以及官方划分说明。[12] Dan Hendrycks et al. Measuring Mathematical Problem Solving With the MATH Dataset. 2021. arXiv:2103.03874. For the MATH-500 split, see Hunter Lightman et al., Let’s Verify Step by Step, 2023, arXiv:2305.20050, and the official split description.
[13] 美国数学协会。AMC 官方页面和 AIME 介绍。结果采用实验中记录的 AIME 2024、AIME 2025 和 AMC23 评估版本。[13] Mathematical Association of America. Official AMC page and AIME introduction. Results use the AIME 2024, AIME 2025, and AMC23 evaluation versions recorded in the experiments.
[14] Jeffrey Zhou 等。《大型语言模型的指令遵循评估》。2023 年。arXiv:2311.07911。[14] Jeffrey Zhou et al. Instruction-Following Evaluation for Large Language Models. 2023. arXiv:2311.07911.
[15] Ziang Li 等。《4-bitter 教训》。humans&,2026-07-10。文章及交互式示例。[15] Ziang Li et al. The 4-bitter Lesson. humans&, 2026-07-10. Article and interactive examples.
[16] Ziang Li、humans& 和 Miles 团队。《迈向原生适配 Blackwell 的 8 位和 4 位强化学习:Miles 中端到端的 MXFP8 和 NVFP4 强化学习》。LMSYS,2026-07-29。文章及格式说明。[16] Ziang Li, humans& and Miles Team. Towards Blackwell-Native 8-bit and 4-bit RL: End-to-End MXFP8 and NVFP4 RL in Miles. LMSYS, 2026-07-29. Article and format explanation.
[17] Martin Marek 和 Max Ryabinin。《分数中心化稳定离策略强化学习》。2026 年。论文。[17] Martin Marek and Max Ryabinin. Score Centering Stabilizes Off-policy Reinforcement Learning. 2026. Paper.
[18] Xin Wang 等:《TRACE:面向 MoE 语言模型 FP4 强化学习的 rollout 引导量化感知训练》。2026 年。论文。[18] Xin Wang et al. TRACE: Rollout-Guided Quantization-Aware Training for FP4 Reinforcement Learning of MoE Language Models. 2026. Paper.