{"abstract":"Replica gradients ignore local sample counts.","category":"Distributed training aggregation","checks":7,"contract":"Given [gradient_mean, example_count] rows, return the elementwise global example mean; zero-count rows contribute nothing and total zero returns [].","contract_signature":"rows","evaluation_group":"w3-dta-sample-weighted-gradient","failed_approach":"Weighting the numerator but dividing by replica count still scales the update incorrectly.","family":"w3-distributed-training-aggregation-sample-weighted-gradient","id":"FA-99241","implementations":{"attempt":{"sha256":"dfaa1df7b6d35b3c8477a2939b3e92ad05b44160289c64f5e8d67568c1dc26dd","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows):\n    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 []\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\na=[([N,2*N],1),([3*N,4*N],3)]\ncheck('unequal batch sizes',solve(a),[2.5*N,3.5*N])\ncheck('equal sizes',solve([([N],2),([3*N],2)]),[2*N])\ncheck('zero-weight row',solve([([9*N],0),([2*N],2)]),[2*N])\ncheck('all zero weights',solve([([N],0)]),[])\ncheck('empty collective',solve([]),[])\ncheck('single contribution',solve([([N,2*N],N)]),[N,2*N])\ncheck('unequal sizes vary',solve([([N],N),([5*N],N+1)]),[N*(6*N+5)/(2*N+1)])\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":"463bff61bdbcda2ed497d0751d4fe96af1b16a1cb9f27b91ae95eb0312cdd088","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows):\n    return [sum(row[0][j] for row in rows)/len(rows) for j in range(len(rows[0][0]))] if rows else []\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\na=[([N,2*N],1),([3*N,4*N],3)]\ncheck('unequal batch sizes',solve(a),[2.5*N,3.5*N])\ncheck('equal sizes',solve([([N],2),([3*N],2)]),[2*N])\ncheck('zero-weight row',solve([([9*N],0),([2*N],2)]),[2*N])\ncheck('all zero weights',solve([([N],0)]),[])\ncheck('empty collective',solve([]),[])\ncheck('single contribution',solve([([N,2*N],N)]),[N,2*N])\ncheck('unequal sizes vary',solve([([N],N),([5*N],N+1)]),[N*(6*N+5)/(2*N+1)])\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 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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w3-distributed-training-aggregation-sample-weighted-gradient","generated_at":"2026-09-30T16:48:22.178262+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A toy distributed-training contract makes replica and shard contribution rules explicit without claiming framework compatibility or performance.","root_cause":"Replica means have different denominators, so averaging them equally biases the global batch gradient.","sha256":"339c99735b1fc72bf32057595b64e19e370d7120f1425d5fbcbc1a09e59c2f6b","title":"Replica gradients ignore local sample counts · 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":31.372,"exit_code":1,"observations":[{"actual":[5.0,7.0],"check":"unequal batch sizes","expected":[2.5,3.5],"passed":false},{"actual":[4.0],"check":"equal sizes","expected":[2],"passed":false},{"actual":[2.0],"check":"zero-weight row","expected":[2],"passed":true},{"actual":[],"check":"all zero weights","expected":[],"passed":true},{"actual":[],"check":"empty collective","expected":[],"passed":true},{"actual":[1.0,2.0],"check":"single contribution","expected":[1,2],"passed":true},{"actual":[5.5],"check":"unequal sizes vary","expected":[3.6666666666666665],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unequal batch sizes\", \"actual\": [5.0, 7.0], \"expected\": [2.5, 3.5], \"passed\": false}, {\"check\": \"equal sizes\", \"actual\": [4.0], \"expected\": [2], \"passed\": false}, {\"check\": \"zero-weight row\", \"actual\": [2.0], \"expected\": [2], \"passed\": true}, {\"check\": \"all zero weights\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"empty collective\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"single contribution\", \"actual\": [1.0, 2.0], \"expected\": [1, 2], \"passed\": true}, {\"check\": \"unequal sizes vary\", \"actual\": [5.5], \"expected\": [3.6666666666666665], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":30.482,"exit_code":1,"observations":[{"actual":[2.0,3.0],"check":"unequal batch sizes","expected":[2.5,3.5],"passed":false},{"actual":[2.0],"check":"equal sizes","expected":[2],"passed":true},{"actual":[5.5],"check":"zero-weight row","expected":[2],"passed":false},{"actual":[1.0],"check":"all zero weights","expected":[],"passed":false},{"actual":[],"check":"empty collective","expected":[],"passed":true},{"actual":[1.0,2.0],"check":"single contribution","expected":[1,2],"passed":true},{"actual":[3.0],"check":"unequal sizes vary","expected":[3.6666666666666665],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unequal batch sizes\", \"actual\": [2.0, 3.0], \"expected\": [2.5, 3.5], \"passed\": false}, {\"check\": \"equal sizes\", \"actual\": [2.0], \"expected\": [2], \"passed\": true}, {\"check\": \"zero-weight row\", \"actual\": [5.5], \"expected\": [2], \"passed\": false}, {\"check\": \"all zero weights\", \"actual\": [1.0], \"expected\": [], \"passed\": false}, {\"check\": \"empty collective\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"single contribution\", \"actual\": [1.0, 2.0], \"expected\": [1, 2], \"passed\": true}, {\"check\": \"unequal sizes vary\", \"actual\": [3.0], \"expected\": [3.6666666666666665], \"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."}}