FAILURE MAP
← Case archive

FA-99241 / Distributed training aggregation / Open access

Replica gradients ignore local sample counts · case 01

Replica gradients ignore local sample counts.

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

ROOT CAUSE

Replica means have different denominators, so averaging them equally biases the global batch gradient.

THE FAILURE

Replica means have different denominators, so averaging them equally biases the global batch gradient.

Unsuccessful approach: Weighting the numerator but dividing by replica count still scales the update incorrectly.

Case contract

Given [gradient_mean, example_count] rows, return the elementwise global example mean; zero-count rows contribute nothing and total zero returns [].

Why this case matters

A toy distributed-training contract makes replica and shard contribution rules explicit without claiming framework compatibility or performance.

1 / The failure

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

N = 1
observations = []
def solve(rows):
    return [sum(row[0][j] for row in rows)/len(rows) for j in range(len(rows[0][0]))] if rows else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a=[([N,2*N],1),([3*N,4*N],3)]
check('unequal batch sizes',solve(a),[2.5*N,3.5*N])
check('equal sizes',solve([([N],2),([3*N],2)]),[2*N])
check('zero-weight row',solve([([9*N],0),([2*N],2)]),[2*N])
check('all zero weights',solve([([N],0)]),[])
check('empty collective',solve([]),[])
check('single contribution',solve([([N,2*N],N)]),[N,2*N])
check('unequal sizes vary',solve([([N],N),([5*N],N+1)]),[N*(6*N+5)/(2*N+1)])
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
unequal batch sizes[2.0, 3.0][2.5, 3.5]Failed
equal sizes[2.0][2]Passed
zero-weight row[5.5][2]Failed
all zero weights[1.0][]Failed
empty collective[][]Passed
single contribution[1.0, 2.0][1, 2]Passed
unequal sizes vary[3.0][3.6666666666666665]Failed

SHA-256 / 463bff61bdbcda2ed497d0751d4fe96af1b16a1cb9f27b91ae95eb0312cdd088

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(rows):
    total=sum(r[1] for r in rows); return [sum(r[0][j]*r[1] for r in rows)/len(rows) for j in range(len(rows[0][0]))] if rows and total else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a=[([N,2*N],1),([3*N,4*N],3)]
check('unequal batch sizes',solve(a),[2.5*N,3.5*N])
check('equal sizes',solve([([N],2),([3*N],2)]),[2*N])
check('zero-weight row',solve([([9*N],0),([2*N],2)]),[2*N])
check('all zero weights',solve([([N],0)]),[])
check('empty collective',solve([]),[])
check('single contribution',solve([([N,2*N],N)]),[N,2*N])
check('unequal sizes vary',solve([([N],N),([5*N],N+1)]),[N*(6*N+5)/(2*N+1)])
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
unequal batch sizes[5.0, 7.0][2.5, 3.5]Failed
equal sizes[4.0][2]Failed
zero-weight row[2.0][2]Passed
all zero weights[][]Passed
empty collective[][]Passed
single contribution[1.0, 2.0][1, 2]Passed
unequal sizes vary[5.5][3.6666666666666665]Failed

SHA-256 / dfaa1df7b6d35b3c8477a2939b3e92ad05b44160289c64f5e8d67568c1dc26dd

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 already materialized Python values from a fixed toy collective; no transport, failure recovery, optimizer state, or real model behavior is represented. 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:22.178262+00:00.

Case digest / 339c99735b1fc72bf32057595b64e19e370d7120f1425d5fbcbc1a09e59c2f6b