FA-98871 / Gradient accumulation weighting / Open access
Long sequences dominate a sequence-mean objective · case 01
Long sequences dominate a sequence-mean objective.
ROOT CAUSE
The broken path pools token sums and counts, weighting longer sequences more heavily.
THE FAILURE
The broken path pools token sums and counts, weighting longer sequences more heavily.
Unsuccessful approach: Dividing each sequence mean by the number of sequences loses the empty-sequence boundary.
Case contract
Compute each nonempty sequence mean and then average sequences equally; sequences with zero tokens are skipped.
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(sequence_sums, token_counts):
return sum(sequence_sums) / sum(token_counts) if sum(token_counts) else 0
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('different lengths',solve([2*N,12*N],[N,3*N]),3)
check('same lengths',solve([2*N,4*N],[N,N]),3)
check('single sequence',solve([6*N],[2*N]),3)
check('empty',solve([],[]),0)
check('empty sequence',solve([0,8*N],[0,2*N]),4)
check('zero objective',solve([0,9*N],[N,3*N]),1.5)
check('three means',solve([N,6*N,8*N],[1,2,4]),2*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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| different lengths | 3.5 | 3 | Failed |
| same lengths | 3.0 | 3 | Passed |
| single sequence | 3.0 | 3 | Passed |
| empty | 0 | 0 | Passed |
| empty sequence | 4.0 | 4 | Passed |
| zero objective | 2.25 | 1.5 | Failed |
| three means | 2.142857142857143 | 2 | Failed |
SHA-256 / 0f089282c3172b86666d196e63f059cc8144e4e772db903abecabdbfaaaa2d46
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(sequence_sums, token_counts):
return sum(s / c for s,c in zip(sequence_sums,token_counts) if c) / max(1,len(sequence_sums))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('different lengths',solve([2*N,12*N],[N,3*N]),3)
check('same lengths',solve([2*N,4*N],[N,N]),3)
check('single sequence',solve([6*N],[2*N]),3)
check('empty',solve([],[]),0)
check('empty sequence',solve([0,8*N],[0,2*N]),4)
check('zero objective',solve([0,9*N],[N,3*N]),1.5)
check('three means',solve([N,6*N,8*N],[1,2,4]),2*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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| different lengths | 3.0 | 3 | Passed |
| same lengths | 3.0 | 3 | Passed |
| single sequence | 3.0 | 3 | Passed |
| empty | 0.0 | 0 | Passed |
| empty sequence | 2.0 | 4 | Failed |
| zero objective | 1.5 | 1.5 | Passed |
| three means | 2.0 | 2 | Passed |
SHA-256 / 14813ad8c4b6e41f87861ea6bd5f3c7578bcf2d2c554acf4ba32214d51a9f1de
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.605394+00:00.
Case digest / 1be406497d2d6d692fc9750afba0831321675ec30540dc23fd8c89ae4d119339