FAILURE MAP
← Case archive

FA-98936 / Gradient accumulation weighting / Open access

Microbatch gradients are summed when the objective expects their mean · case 01

Microbatch gradients are summed when the objective expects their mean.

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

ROOT CAUSE

The broken path returns the raw sum of already normalized microbatch gradients.

THE FAILURE

The broken path returns the raw sum of already normalized microbatch gradients.

Unsuccessful approach: Dividing by update count plus one assumes an extra empty contribution that is not in the window.

Case contract

Each input is one already-normalized microbatch gradient. Return the arithmetic mean over updates; no updates 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(gradient_sums):
    return sum(gradient_sums)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two sums',solve([2*N,4*N]),3*N)
check('uneven sums',solve([N,9*N,2*N]),4*N)
check('singleton',solve([8*N]),8*N)
check('empty',solve([]),0)
check('zero term',solve([0,6*N]),3*N)
check('cancellation',solve([4*N,-2*N]),N)
check('four sums',solve([N,2*N,3*N,10*N]),4*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 fixtureActualExpectedOutcome
two sums63Failed
uneven sums124Failed
singleton88Passed
empty00Passed
zero term63Failed
cancellation21Failed
four sums164Failed

SHA-256 / b1c1c9071d05aa5293c01f3b9d13ff597e163eb66a69c4e2f48c79e1ed6e9af2

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(gradient_sums):
    return sum(gradient_sums) / (len(gradient_sums)+1) if gradient_sums else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two sums',solve([2*N,4*N]),3*N)
check('uneven sums',solve([N,9*N,2*N]),4*N)
check('singleton',solve([8*N]),8*N)
check('empty',solve([]),0)
check('zero term',solve([0,6*N]),3*N)
check('cancellation',solve([4*N,-2*N]),N)
check('four sums',solve([N,2*N,3*N,10*N]),4*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 fixtureActualExpectedOutcome
two sums2.03Failed
uneven sums3.04Failed
singleton4.08Failed
empty00Passed
zero term2.03Failed
cancellation0.66666666666666661Failed
four sums3.24Failed

SHA-256 / d351604d6b22ab93e89734cb226bd27e0376466a737606a4d9014ceba7f73cf2

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

Case digest / cb9b9290e676f8d06d632868f7e8d6aa00e358e3bc8c86a6f4d5e4d773409832