{"abstract":"Running mean state treats a batch mean as a batch sum.","category":"Gradient accumulation weighting","checks":7,"contract":"State is [mean_so_far, count_so_far]. Combine its implied sum with the incoming batch mean times batch_count, then return the new mean and count.","contract_signature":"state, batch_mean, batch_count","evaluation_group":"gradient-accumulation-cumulative_mean_state","failed_approach":"Multiplying the incoming mean by the old count confuses the new batch's size with prior state.","family":"w3-gradient-accumulation-weighting-cumulative-mean-state","id":"FA-98926","implementations":{"attempt":{"sha256":"68743f58bd481c11bb0c8c102807c85904ceebed4aae588f1a0a5feca7b76057","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(state, batch_mean, batch_count):\n    total=state[0]+batch_mean*batch_count; count=state[1]+batch_count\n    return [total/max(1,count),count]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('two equal batches',solve([2*N,1],4*N,1),[3*N,2])\ncheck('unequal counts',solve([2*N,1],12*N,3),[9.5*N,4])\ncheck('zero new count',solve([5*N,1],7*N,0),[5*N,1])\ncheck('empty state',solve([0,0],6*N,2),[6*N,2])\ncheck('empty update',solve([8*N,2],0,0),[8*N,2])\ncheck('single update',solve([0,0],9*N,3),[9*N,3])\ncheck('append mean',solve([6*N,2],2*N,2),[4*N,4])\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":"7d7a6fba1d0c6f6031f5fef658c561bceaf1721f8c1bd4c2873fa46e89900b15","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(state, batch_mean, batch_count):\n    return [(state[0]+batch_mean)/(state[1]+batch_count),state[1]+batch_count] if state[1]+batch_count else [0,0]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('two equal batches',solve([2*N,1],4*N,1),[3*N,2])\ncheck('unequal counts',solve([2*N,1],12*N,3),[9.5*N,4])\ncheck('zero new count',solve([5*N,1],7*N,0),[5*N,1])\ncheck('empty state',solve([0,0],6*N,2),[6*N,2])\ncheck('empty update',solve([8*N,2],0,0),[8*N,2])\ncheck('single update',solve([0,0],9*N,3),[9*N,3])\ncheck('append mean',solve([6*N,2],2*N,2),[4*N,4])\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-cumulative-mean-state","generated_at":"2026-09-30T16:48:18.534973+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 update adds a batch mean directly to the stored mean numerator.","sha256":"d9d330abfb3d8c1e96117cb40932fe49798de5769e1b64c0f5cc5d9905cdc115","title":"Running mean state treats a batch mean as a batch sum · 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.724,"exit_code":1,"observations":[{"actual":[3.0,2],"check":"two equal batches","expected":[3,2],"passed":true},{"actual":[9.5,4],"check":"unequal counts","expected":[9.5,4],"passed":true},{"actual":[5.0,1],"check":"zero new count","expected":[5,1],"passed":true},{"actual":[6.0,2],"check":"empty state","expected":[6,2],"passed":true},{"actual":[4.0,2],"check":"empty update","expected":[8,2],"passed":false},{"actual":[9.0,3],"check":"single update","expected":[9,3],"passed":true},{"actual":[2.5,4],"check":"append mean","expected":[4,4],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two equal batches\", \"actual\": [3.0, 2], \"expected\": [3, 2], \"passed\": true}, {\"check\": \"unequal counts\", \"actual\": [9.5, 4], \"expected\": [9.5, 4], \"passed\": true}, {\"check\": \"zero new count\", \"actual\": [5.0, 1], \"expected\": [5, 1], \"passed\": true}, {\"check\": \"empty state\", \"actual\": [6.0, 2], \"expected\": [6, 2], \"passed\": true}, {\"check\": \"empty update\", \"actual\": [4.0, 2], \"expected\": [8, 2], \"passed\": false}, {\"check\": \"single update\", \"actual\": [9.0, 3], \"expected\": [9, 3], \"passed\": true}, {\"check\": \"append mean\", \"actual\": [2.5, 4], \"expected\": [4, 4], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":28.06,"exit_code":1,"observations":[{"actual":[3.0,2],"check":"two equal batches","expected":[3,2],"passed":true},{"actual":[3.5,4],"check":"unequal counts","expected":[9.5,4],"passed":false},{"actual":[12.0,1],"check":"zero new count","expected":[5,1],"passed":false},{"actual":[3.0,2],"check":"empty state","expected":[6,2],"passed":false},{"actual":[4.0,2],"check":"empty update","expected":[8,2],"passed":false},{"actual":[3.0,3],"check":"single update","expected":[9,3],"passed":false},{"actual":[2.0,4],"check":"append mean","expected":[4,4],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two equal batches\", \"actual\": [3.0, 2], \"expected\": [3, 2], \"passed\": true}, {\"check\": \"unequal counts\", \"actual\": [3.5, 4], \"expected\": [9.5, 4], \"passed\": false}, {\"check\": \"zero new count\", \"actual\": [12.0, 1], \"expected\": [5, 1], \"passed\": false}, {\"check\": \"empty state\", \"actual\": [3.0, 2], \"expected\": [6, 2], \"passed\": false}, {\"check\": \"empty update\", \"actual\": [4.0, 2], \"expected\": [8, 2], \"passed\": false}, {\"check\": \"single update\", \"actual\": [3.0, 3], \"expected\": [9, 3], \"passed\": false}, {\"check\": \"append mean\", \"actual\": [2.0, 4], \"expected\": [4, 4], \"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."}}