FA-98926 / Gradient accumulation weighting / Open access
Running mean state treats a batch mean as a batch sum · case 01
Running mean state treats a batch mean as a batch sum.
ROOT CAUSE
The broken update adds a batch mean directly to the stored mean numerator.
THE FAILURE
The broken update adds a batch mean directly to the stored mean numerator.
Unsuccessful approach: Multiplying the incoming mean by the old count confuses the new batch's size with prior state.
Case contract
State is [mean_so_far, count_so_far]. Combine its implied sum with the incoming batch mean times batch_count, then return the new mean and count.
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(state, batch_mean, batch_count):
return [(state[0]+batch_mean)/(state[1]+batch_count),state[1]+batch_count] if state[1]+batch_count else [0,0]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two equal batches',solve([2*N,1],4*N,1),[3*N,2])
check('unequal counts',solve([2*N,1],12*N,3),[9.5*N,4])
check('zero new count',solve([5*N,1],7*N,0),[5*N,1])
check('empty state',solve([0,0],6*N,2),[6*N,2])
check('empty update',solve([8*N,2],0,0),[8*N,2])
check('single update',solve([0,0],9*N,3),[9*N,3])
check('append mean',solve([6*N,2],2*N,2),[4*N,4])
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 |
|---|---|---|---|
| two equal batches | [3.0, 2] | [3, 2] | Passed |
| unequal counts | [3.5, 4] | [9.5, 4] | Failed |
| zero new count | [12.0, 1] | [5, 1] | Failed |
| empty state | [3.0, 2] | [6, 2] | Failed |
| empty update | [4.0, 2] | [8, 2] | Failed |
| single update | [3.0, 3] | [9, 3] | Failed |
| append mean | [2.0, 4] | [4, 4] | Failed |
SHA-256 / 7d7a6fba1d0c6f6031f5fef658c561bceaf1721f8c1bd4c2873fa46e89900b15
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(state, batch_mean, batch_count):
total=state[0]+batch_mean*batch_count; count=state[1]+batch_count
return [total/max(1,count),count]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two equal batches',solve([2*N,1],4*N,1),[3*N,2])
check('unequal counts',solve([2*N,1],12*N,3),[9.5*N,4])
check('zero new count',solve([5*N,1],7*N,0),[5*N,1])
check('empty state',solve([0,0],6*N,2),[6*N,2])
check('empty update',solve([8*N,2],0,0),[8*N,2])
check('single update',solve([0,0],9*N,3),[9*N,3])
check('append mean',solve([6*N,2],2*N,2),[4*N,4])
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 |
|---|---|---|---|
| two equal batches | [3.0, 2] | [3, 2] | Passed |
| unequal counts | [9.5, 4] | [9.5, 4] | Passed |
| zero new count | [5.0, 1] | [5, 1] | Passed |
| empty state | [6.0, 2] | [6, 2] | Passed |
| empty update | [4.0, 2] | [8, 2] | Failed |
| single update | [9.0, 3] | [9, 3] | Passed |
| append mean | [2.5, 4] | [4, 4] | Failed |
SHA-256 / 68743f58bd481c11bb0c8c102807c85904ceebed4aae588f1a0a5feca7b76057
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:18.534973+00:00.
Case digest / d9d330abfb3d8c1e96117cb40932fe49798de5769e1b64c0f5cc5d9905cdc115