{"abstract":"Sample weights are normalized by raw item count.","category":"Gradient accumulation weighting","checks":7,"contract":"Weighted sums already include per-example weights. Divide by total weight mass; zero mass yields zero.","contract_signature":"weighted_sums, weight_sums","evaluation_group":"gradient-accumulation-weighted_samples","failed_approach":"Unweighted batch count happens to work only when total weight mass equals that count.","family":"w3-gradient-accumulation-weighting-weighted-samples","id":"FA-98851","implementations":{"attempt":{"sha256":"a135344a6ee6523f85a7ffa51aee2ea52bf326a724e351a9ea1a875a408299a0","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(weighted_sums, weight_sums):\n    return sum(s / w for s,w in zip(weighted_sums,weight_sums) if w) / max(1,len(weighted_sums))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('unequal weight mass',solve([2*N,12*N],[N,3*N]),3.5)\ncheck('unit weights',solve([2*N,4*N],[N,N]),3)\ncheck('one batch',solve([9*N],[3*N]),3)\ncheck('zero total weight',solve([0],[0]),0)\ncheck('empty',solve([],[]),0)\ncheck('zero loss',solve([0,8*N],[N,3*N]),2)\ncheck('three batches',solve([N,6*N,8*N],[1,2,4]),15*N/7)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"5f2acf9a59aaa99483595e3cae6e0327ec0a55821785c3d2b6936c3ad2598a94","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(weighted_sums, weight_sums):\n    return sum(weighted_sums) / max(1,len(weighted_sums))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('unequal weight mass',solve([2*N,12*N],[N,3*N]),3.5)\ncheck('unit weights',solve([2*N,4*N],[N,N]),3)\ncheck('one batch',solve([9*N],[3*N]),3)\ncheck('zero total weight',solve([0],[0]),0)\ncheck('empty',solve([],[]),0)\ncheck('zero loss',solve([0,8*N],[N,3*N]),2)\ncheck('three batches',solve([N,6*N,8*N],[1,2,4]),15*N/7)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w3-gradient-accumulation-weighting-weighted-samples","generated_at":"2026-09-30T16:48:17.605183+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A deterministic toy model isolates one local accumulation contract.","root_cause":"The broken path divides weighted contributions by the number of batches, dropping the weight mass denominator.","sha256":"89df7a20abd7200c8a92cdb8d9937f0bfe9a845f03088984a11c1f11bc4eb1b1","title":"Sample weights are normalized by raw item count · case 01","variant":1,"variant_policy":"The fixture code references N, supplied as 1 through 5. Fixed boundary checks may repeat. These records share one mechanism and must remain together in evaluation splits.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":28.145,"exit_code":1,"observations":[{"actual":3.0,"check":"unequal weight mass","expected":3.5,"passed":false},{"actual":3.0,"check":"unit weights","expected":3,"passed":true},{"actual":3.0,"check":"one batch","expected":3,"passed":true},{"actual":0.0,"check":"zero total weight","expected":0,"passed":true},{"actual":0.0,"check":"empty","expected":0,"passed":true},{"actual":1.3333333333333333,"check":"zero loss","expected":2,"passed":false},{"actual":2.0,"check":"three batches","expected":2.142857142857143,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unequal weight mass\", \"actual\": 3.0, \"expected\": 3.5, \"passed\": false}, {\"check\": \"unit weights\", \"actual\": 3.0, \"expected\": 3, \"passed\": true}, {\"check\": \"one batch\", \"actual\": 3.0, \"expected\": 3, \"passed\": true}, {\"check\": \"zero total weight\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}, {\"check\": \"empty\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}, {\"check\": \"zero loss\", \"actual\": 1.3333333333333333, \"expected\": 2, \"passed\": false}, {\"check\": \"three batches\", \"actual\": 2.0, \"expected\": 2.142857142857143, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":28.244,"exit_code":1,"observations":[{"actual":7.0,"check":"unequal weight mass","expected":3.5,"passed":false},{"actual":3.0,"check":"unit weights","expected":3,"passed":true},{"actual":9.0,"check":"one batch","expected":3,"passed":false},{"actual":0.0,"check":"zero total weight","expected":0,"passed":true},{"actual":0.0,"check":"empty","expected":0,"passed":true},{"actual":4.0,"check":"zero loss","expected":2,"passed":false},{"actual":5.0,"check":"three batches","expected":2.142857142857143,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unequal weight mass\", \"actual\": 7.0, \"expected\": 3.5, \"passed\": false}, {\"check\": \"unit weights\", \"actual\": 3.0, \"expected\": 3, \"passed\": true}, {\"check\": \"one batch\", \"actual\": 9.0, \"expected\": 3, \"passed\": false}, {\"check\": \"zero total weight\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}, {\"check\": \"empty\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}, {\"check\": \"zero loss\", \"actual\": 4.0, \"expected\": 2, \"passed\": false}, {\"check\": \"three batches\", \"actual\": 5.0, \"expected\": 2.142857142857143, \"passed\": false}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}