FA-98891 / Gradient accumulation weighting / Open access
Scaled gradients are averaged before unscaling · case 01
Scaled gradients are averaged before unscaling.
ROOT CAUSE
The broken path sums scaled values without undoing the common loss scale.
THE FAILURE
The broken path sums scaled values without undoing the common loss scale.
Unsuccessful approach: Averaging unscaled microbatch means fails when microbatch counts differ.
Case contract
Scaled gradient sums share one positive scale and one example count. Sum, unscale, and normalize; zero count or zero scale returns zero.
Why this case matters
A deterministic toy model isolates one local accumulation contract.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(scaled_sums, scale, count):
return sum(scaled_sums) / count if count else 0
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('scale eight',solve([16*N,32*N],8,2),3*N)
check('scale one',solve([2*N,4*N],1,2),3*N)
check('single',solve([20*N],4,1),5*N)
check('empty',solve([],8,0),0)
check('zero gradient',solve([0,16*N],8,2),N)
check('negative sum',solve([8*N,-4*N],4,2),N/2)
check('scale two',solve([6*N,10*N],2,4),2*N)
check('unequal counts',solve([8*N,48*N],8,4),1.75*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| scale eight | 24.0 | 3 | Failed |
| scale one | 3.0 | 3 | Passed |
| single | 20.0 | 5 | Failed |
| empty | 0 | 0 | Passed |
| zero gradient | 8.0 | 1 | Failed |
| negative sum | 2.0 | 0.5 | Failed |
| scale two | 4.0 | 2 | Failed |
| unequal counts | 14.0 | 1.75 | Failed |
SHA-256 / 6827dea195aeefe4d93b63af73fc058d24e7319a71f202d8f1ced57abf8ab60a
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(scaled_sums, scale, count):
return sum(s / scale for s in scaled_sums) / max(1,len(scaled_sums)) if scaled_sums else 0
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('scale eight',solve([16*N,32*N],8,2),3*N)
check('scale one',solve([2*N,4*N],1,2),3*N)
check('single',solve([20*N],4,1),5*N)
check('empty',solve([],8,0),0)
check('zero gradient',solve([0,16*N],8,2),N)
check('negative sum',solve([8*N,-4*N],4,2),N/2)
check('scale two',solve([6*N,10*N],2,4),2*N)
check('unequal counts',solve([8*N,48*N],8,4),1.75*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| scale eight | 3.0 | 3 | Passed |
| scale one | 3.0 | 3 | Passed |
| single | 5.0 | 5 | Passed |
| empty | 0 | 0 | Passed |
| zero gradient | 1.0 | 1 | Passed |
| negative sum | 0.5 | 0.5 | Passed |
| scale two | 4.0 | 2 | Failed |
| unequal counts | 3.5 | 1.75 | Failed |
SHA-256 / 02dc9e238391c1edb3c67fdc92cd4def6244c6a5a6601152e25968f8491500ff
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
Inputs are scalar or short-list summaries and do not model autodiff, devices, or an optimizer. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-30T16:48:18.065531+00:00.
Case digest / 9f986ba0415027059b5d1503bcaf626da6d31da8b3e5c84b1f8d537d9dea01c3