Fix Issue #97: Use Heavy-Tailed Distribution for MSELoss to Prevent Partial Computation from Passing Verification #98
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix Issue #97: Use Heavy-Tailed Distribution for MSELoss to Prevent Partial Computation from Passing Verification
Summary
Replace uniform distribution with Pareto distribution in
level1/94_MSELoss.pyinput generation to detect incorrect kernel implementations that only compute partial data.Problem
The original implementation uses uniform distribution for test data generation:
Due to the bounded moments of uniform distribution, by the Law of Large Numbers, MSE converges to the same expected value$(2s^2 - 3s + 2)/6$ regardless of sample size. This allows faulty kernel implementations (e.g., computing only part of the data) to pass accuracy verification.
Solution
Adopt Pareto distribution
Pareto(scale=0.01, alpha=1.5)(or other heavy-tailed distributions with divergent second moments):This ensures implementations with different computation volumes produce significantly different outputs, correctly detecting faulty kernel implementations.
Changed Files
KernelBench/level1/94_MSELoss.py