FAILURE MAP
← Case archive

FA-98901 / Gradient accumulation weighting / Open access

Streaming accumulation overwrites its prior numerator · case 01

Streaming accumulation overwrites its prior numerator.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The broken update overwrites prior gradient and count state with the newest microbatch.

THE FAILURE

The broken update overwrites prior gradient and count state with the newest microbatch.

Unsuccessful approach: Keeping the larger count loses examples when a later microbatch is smaller.

Case contract

State is [gradient_sum, example_count]. Appending adds both fields independently and returns the updated state.

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, new_sum, new_count):
    return [new_sum,new_count]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('append unequal batch',solve([2*N,N],12*N,3*N),[14*N,4*N])
check('append singleton',solve([5*N,N],7*N,N),[12*N,2*N])
check('empty append',solve([4*N,2*N],0,0),[4*N,2*N])
check('zero state',solve([0,0],6*N,2*N),[6*N,2*N])
check('multiple prior count',solve([3*N,4*N],9*N,3*N),[12*N,7*N])
check('zero sum append',solve([8*N,4*N],0,N),[8*N,5*N])
check('large append',solve([N,2],8*N,4*N),[9*N,4*N+2])
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 fixtureActualExpectedOutcome
append unequal batch[12, 3][14, 4]Failed
append singleton[7, 1][12, 2]Failed
empty append[0, 0][4, 2]Failed
zero state[6, 2][6, 2]Passed
multiple prior count[9, 3][12, 7]Failed
zero sum append[0, 1][8, 5]Failed
large append[8, 4][9, 6]Failed

SHA-256 / bad65a664486baaf1c09c5fe79f4371cae89e60100487b2b22783f9aa3f8b22c

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(state, new_sum, new_count):
    return [state[0]+new_sum, max(state[1],new_count)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('append unequal batch',solve([2*N,N],12*N,3*N),[14*N,4*N])
check('append singleton',solve([5*N,N],7*N,N),[12*N,2*N])
check('empty append',solve([4*N,2*N],0,0),[4*N,2*N])
check('zero state',solve([0,0],6*N,2*N),[6*N,2*N])
check('multiple prior count',solve([3*N,4*N],9*N,3*N),[12*N,7*N])
check('zero sum append',solve([8*N,4*N],0,N),[8*N,5*N])
check('large append',solve([N,2],8*N,4*N),[9*N,4*N+2])
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 fixtureActualExpectedOutcome
append unequal batch[14, 3][14, 4]Failed
append singleton[12, 1][12, 2]Failed
empty append[4, 2][4, 2]Passed
zero state[6, 2][6, 2]Passed
multiple prior count[12, 4][12, 7]Failed
zero sum append[8, 4][8, 5]Failed
large append[9, 4][9, 6]Failed

SHA-256 / 360155f01c0ce4fc48ab2f535ec0734f6934d1fef4ac1d0d8efbe97febbcf169

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.065711+00:00.

Case digest / e07a064ababf21bcc837caf70529e0f32f67766d6db77e95ea1c851f2e256081