FA-98851 / Gradient accumulation weighting / Open access
Sample weights are normalized by raw item count · case 01
Sample weights are normalized by raw item count.
ROOT CAUSE
The broken path divides weighted contributions by the number of batches, dropping the weight mass denominator.
THE FAILURE
The broken path divides weighted contributions by the number of batches, dropping the weight mass denominator.
Unsuccessful approach: Unweighted batch count happens to work only when total weight mass equals that count.
Case contract
Weighted sums already include per-example weights. Divide by total weight mass; zero mass yields 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(weighted_sums, weight_sums):
return sum(weighted_sums) / max(1,len(weighted_sums))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal weight mass',solve([2*N,12*N],[N,3*N]),3.5)
check('unit weights',solve([2*N,4*N],[N,N]),3)
check('one batch',solve([9*N],[3*N]),3)
check('zero total weight',solve([0],[0]),0)
check('empty',solve([],[]),0)
check('zero loss',solve([0,8*N],[N,3*N]),2)
check('three batches',solve([N,6*N,8*N],[1,2,4]),15*N/7)
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 |
|---|---|---|---|
| unequal weight mass | 7.0 | 3.5 | Failed |
| unit weights | 3.0 | 3 | Passed |
| one batch | 9.0 | 3 | Failed |
| zero total weight | 0.0 | 0 | Passed |
| empty | 0.0 | 0 | Passed |
| zero loss | 4.0 | 2 | Failed |
| three batches | 5.0 | 2.142857142857143 | Failed |
SHA-256 / 5f2acf9a59aaa99483595e3cae6e0327ec0a55821785c3d2b6936c3ad2598a94
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(weighted_sums, weight_sums):
return sum(s / w for s,w in zip(weighted_sums,weight_sums) if w) / max(1,len(weighted_sums))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal weight mass',solve([2*N,12*N],[N,3*N]),3.5)
check('unit weights',solve([2*N,4*N],[N,N]),3)
check('one batch',solve([9*N],[3*N]),3)
check('zero total weight',solve([0],[0]),0)
check('empty',solve([],[]),0)
check('zero loss',solve([0,8*N],[N,3*N]),2)
check('three batches',solve([N,6*N,8*N],[1,2,4]),15*N/7)
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 |
|---|---|---|---|
| unequal weight mass | 3.0 | 3.5 | Failed |
| unit weights | 3.0 | 3 | Passed |
| one batch | 3.0 | 3 | Passed |
| zero total weight | 0.0 | 0 | Passed |
| empty | 0.0 | 0 | Passed |
| zero loss | 1.3333333333333333 | 2 | Failed |
| three batches | 2.0 | 2.142857142857143 | Failed |
SHA-256 / a135344a6ee6523f85a7ffa51aee2ea52bf326a724e351a9ea1a875a408299a0
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 7 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:17.605183+00:00.
Case digest / 89df7a20abd7200c8a92cdb8d9937f0bfe9a845f03088984a11c1f11bc4eb1b1