Triton RMSNorm example uses epsilon 1e-6 but definition requires 1e-5
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 74/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- python
调研方向
从 examples/triton/rmsnorm/definition.json 开始,将其中固定的 epsilon 与 examples/triton/rmsnorm/kernel.py 中的 launch 进行比较。更新 examples/triton/rmsnorm/solution_triton.json 中的 launch 和嵌入式源代码,然后添加一个小量级 BF16 正确性用例;完成的标准是,对于有效的 BF16 输入,随附示例与参考结果一致。
由索引模型根据 Issue 内容生成。
描述
Summary
The Triton RMSNorm example does not implement its own problem definition.
Observed mismatch for x = BF16(1e-3) and weight = 1: expected 0.30078125 vs. candidate output 0.70703125.
definition.jsonfixesEPS = 1e-5in the reference and says “Epsilon is fixed at 1e-5.”kernel.pylaunches_rmsnorm_fwd_kernelwith1e-6.- The embedded
kernel.pycontent insolution_triton.jsonalso contains1e-6.
This is present on current main at commit a9fa0804c793d438e70850c33fe34426e66d53dd.
Minimal reproducer
Use a valid official-shape BF16 row with small finite values and unit weights:
import torch
x = torch.full((1, 4096), 1e-3, dtype=torch.bfloat16, device="cuda")
weight = torch.ones(4096, dtype=torch.bfloat16, device="cuda")
def rmsnorm(x, eps):
x32 = x.float()
return (
x32 * torch.rsqrt(x32.square().mean(-1, keepdim=True) + eps)
* weight.float()
).bfloat16()
print(x[0, 0].item())
print(rmsnorm(x, 1e-5)[0, 0].item())
print(rmsnorm(x, 1e-6)[0, 0].item())
Input: 0.00099945068359375
Expected (reference, epsilon = 1e-5): 0.30078125
Observed (Triton candidate, epsilon = 1e-6): 0.70703125
So the concise comparison is: expected 0.30078125 vs. observed 0.70703125.
A randomized (randn * 1e-3).bfloat16() input with batch size 7 produced 26,631 mismatching elements out of 28,672.
This is not reduction-order noise: for a constant row, the output is analytically x / sqrt(x² + eps), and the observed ratio agrees with changing epsilon from 1e-5 to 1e-6.
Expected behavior
The bundled example solution should use the epsilon required by rmsnorm_h4096 for all valid BF16 inputs.
Suggested fix
- Change the launch argument in
examples/triton/rmsnorm/kernel.pyfrom1e-6to1e-5. - Make the same change in the embedded source inside
examples/triton/rmsnorm/solution_triton.json. - Add a small-magnitude BF16 correctness case; unit-scale inputs make epsilon comparatively negligible and can hide this mismatch.
- 主要语言
- Python
- 星标
- 340
- 派生
- 37
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NVIDIA/SOL-ExecBench 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
NVIDIA/SOL-ExecBench#27 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 15/100
NVIDIA/SOL-ExecBench#31 ·
-
难度 4/5 3-5 天 新手友好度 35/100
NVIDIA/SOL-ExecBench#29 ·
-
难度 4/5 3-5 天 新手友好度 64/100
NVIDIA/SOL-ExecBench#25 · 1 条评论 ·
查看 NVIDIA/SOL-ExecBench 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
vllm-project/vllm#70030 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
TigreGotico/tugaphone#408 ·
维护者通常 1 天内回复
-
t: bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 3 天内回复
-
needs-triage
难度 1/5 1 小时以内 新手友好度 85/100
Azure/azure-sdk-for-python#50155 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复