L2/036: GRN backward in `reference.py` is missing a channel-dim sum, so mathematically correct implementations fail grading
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 74/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
调研方向
阅读 L2/036_convnextv2_layer_with_nhwc_persistence_backward/reference.py,重点查看第155–161行的反向计算和第47行的前向归约。检查经过 gf_mean 的梯度如何处理通道维度,然后针对 issue 中描述的情况,将参考实现与 float64 autograd 进行比较。所有已报告的工作负载上,参考实现都与 ground truth 一致,即为完成。
由索引模型根据 Issue 内容生成。
描述
Summary
In L2/036_convnextv2_layer_with_nhwc_persistence_backward, the reference backward pass computes the gradient w.r.t. gf_mean without summing over the channel dimension. Because the reference is the ground truth for grading, a submission that implements the backward pass correctly is scored as wrong, while a submission that reproduces this error scores full marks.
Dataset revision: nvidia/SOL-ExecBench @ 63699402f003496acc3af4eb534a5304a8ac1ea9
Evaluator: NVIDIA/SOL-ExecBench @ a9fa080
The bug
L2/036_convnextv2_layer_with_nhwc_persistence_backward/reference.py, lines 155–161:
grad_global_features = grad_norm_features / (gf_mean + eps)
grad_gf_mean = -grad_norm_features * global_features / ((gf_mean + eps) ** 2) # line 157
# Gradient through gf_mean = global_features.mean(dim=-1, keepdim=True)
C_expanded = global_features.shape[-1]
grad_global_features = grad_global_features + grad_gf_mean / C_expanded # line 161
In the forward pass (line 47), gf_mean = global_features.mean(dim=-1, keepdim=True), so gf_mean has shape (B, 1, 1, 1) while global_features has shape (B, 1, 1, C).
The chain rule therefore requires the gradient w.r.t. gf_mean to be the sum over the channel dimension, i.e. shape (B, 1, 1, 1), which is then divided by C and broadcast back to every channel. Line 157 instead keeps the per-channel terms at shape (B, 1, 1, C), so line 161 gives each channel its own term / C rather than the sum of all channel terms / C.
This is a shape/chain-rule argument that can be checked by inspection: the gradient of a reduction over dim=-1 cannot itself retain that dimension.
Suggested fix
grad_gf_mean = (-grad_norm_features * global_features / ((gf_mean + eps) ** 2)).sum(dim=-1, keepdim=True)
Evidence
Measured on CPU with torch 2.11.0+cu130, using float64 autograd on the reference forward as ground truth and applying the evaluator's own comparison rule (compute_error_stats at a9fa080, required matched ratio 0.99):
-
All 14 workloads from
workload.jsonl× 2 seeds = 28 cases. -
The float64-autograd ground truth fails against the current reference in 4 of 28 cases, every failure in the
grad_dwconv_biasoutput (the GRN error propagates intograd_xand from there into the depthwise-conv bias gradient). Worst matched ratio 0.9297 against the 0.99 threshold:B H W seed failing output matched ratio 1 14 14 0 grad_dwconv_bias0.9297 2 28 28 1 grad_dwconv_bias0.9375 32 28 28 0 grad_dwconv_bias0.9609 1 56 56 0 grad_dwconv_bias0.9844 -
With the one-line fix applied, the reference agrees with the float64 ground truth across all 28 cases, maximum absolute deviation 0.00516 (largest at
B=32, H=56, W=56).
The two checks are independent — a symbolic chain-rule argument and a numerical float64 comparison — and they agree.
Impact
Grading draws random seeds per evaluation, so a correct implementation is very likely to hit at least one failing case and be scored incorrect, while an implementation that reproduces the missing sum passes. The task itself remains solvable against the current reference (we observe submissions passing all workloads), so this does not make the problem unusable — but it inverts the correctness signal for anyone who derives the backward pass from first principles.
Environment
- Dataset:
nvidia/SOL-ExecBench, revision63699402f003496acc3af4eb534a5304a8ac1ea9(also currentmainat the time of writing) - Evaluator:
NVIDIA/SOL-ExecBench@a9fa0804c793(also currentmainat the time of writing) - PyTorch 2.11.0+cu130, CPU, float64 autograd as ground truth
- Comparison: evaluator's
compute_error_stats,required_matched_ratio = 0.99
Happy to share the audit script if that is useful.
- 主要语言
- Python
- 星标
- 340
- 派生
- 37
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NVIDIA/SOL-ExecBench 的其他 Issue
-
难度 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 条评论 ·
-
难度 3/5 1-2 天 新手友好度 74/100
NVIDIA/SOL-ExecBench#21 ·
查看 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 天内回复