{"abstract":"A changing loss scale is applied after gradient summation.","category":"Gradient accumulation weighting","checks":7,"contract":"Each microbatch sum uses its own positive loss scale. Unscale each sum before combining and divide by total examples; zero-scale contributions are omitted.","contract_signature":"scaled_sums, scales, counts","evaluation_group":"gradient-accumulation-per_step_loss_scale","failed_approach":"Replacing zero scales by one invents a contribution for an undefined scaled step.","family":"w3-gradient-accumulation-weighting-per-step-loss-scale","id":"FA-98896","implementations":{"attempt":{"sha256":"1c8013c233472f8d5e69e1164410ed78ea5a960df862c4e3092d4dce1ca0df88","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(scaled_sums, scales, counts):\n    return sum(s / max(1,scale) for s,scale in zip(scaled_sums,scales)) / max(1,sum(counts))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('different scales',solve([8*N,24*N],[4,12],[1,3]),N)\ncheck('same scale',solve([8*N,16*N],[4,4],[1,3]),1.5*N)\ncheck('one step',solve([15*N],[3],[1]),5*N)\ncheck('empty window',solve([],[],[]),0)\ncheck('zero numerator',solve([0,12*N],[2,6],[1,2]),2*N/3)\ncheck('zero scale step omitted',solve([6*N,12*N],[0,6],[1,2]),2*N/3)\ncheck('different counts',solve([12*N,24*N],[3,6],[2,2]),2*N)\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":"1b68c64a315cd5d0cb39766123209f639b6b4071dff1f60b962cf124977170dd","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(scaled_sums, scales, counts):\n    return sum(scaled_sums) / max(1,sum(counts)) / max(1,scales[-1] if scales else 0)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('different scales',solve([8*N,24*N],[4,12],[1,3]),N)\ncheck('same scale',solve([8*N,16*N],[4,4],[1,3]),1.5*N)\ncheck('one step',solve([15*N],[3],[1]),5*N)\ncheck('empty window',solve([],[],[]),0)\ncheck('zero numerator',solve([0,12*N],[2,6],[1,2]),2*N/3)\ncheck('zero scale step omitted',solve([6*N,12*N],[0,6],[1,2]),2*N/3)\ncheck('different counts',solve([12*N,24*N],[3,6],[2,2]),2*N)\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-per-step-loss-scale","generated_at":"2026-09-30T16:48:18.066306+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 applies only the last observed scale to all accumulated gradients.","sha256":"7da75d5a588fd8b75413942092636351225d7a5d47eabbdc5478b8b2ffda36c0","title":"A changing loss scale is applied after gradient summation · 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":32.888,"exit_code":1,"observations":[{"actual":1.0,"check":"different scales","expected":1,"passed":true},{"actual":1.5,"check":"same scale","expected":1.5,"passed":true},{"actual":5.0,"check":"one step","expected":5,"passed":true},{"actual":0.0,"check":"empty window","expected":0,"passed":true},{"actual":0.6666666666666666,"check":"zero numerator","expected":0.6666666666666666,"passed":true},{"actual":2.6666666666666665,"check":"zero scale step omitted","expected":0.6666666666666666,"passed":false},{"actual":2.0,"check":"different counts","expected":2,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"different scales\", \"actual\": 1.0, \"expected\": 1, \"passed\": true}, {\"check\": \"same scale\", \"actual\": 1.5, \"expected\": 1.5, \"passed\": true}, {\"check\": \"one step\", \"actual\": 5.0, \"expected\": 5, \"passed\": true}, {\"check\": \"empty window\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}, {\"check\": \"zero numerator\", \"actual\": 0.6666666666666666, \"expected\": 0.6666666666666666, \"passed\": true}, {\"check\": \"zero scale step omitted\", \"actual\": 2.6666666666666665, \"expected\": 0.6666666666666666, \"passed\": false}, {\"check\": \"different counts\", \"actual\": 2.0, \"expected\": 2, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":28.65,"exit_code":1,"observations":[{"actual":0.6666666666666666,"check":"different scales","expected":1,"passed":false},{"actual":1.5,"check":"same scale","expected":1.5,"passed":true},{"actual":5.0,"check":"one step","expected":5,"passed":true},{"actual":0.0,"check":"empty window","expected":0,"passed":true},{"actual":0.6666666666666666,"check":"zero numerator","expected":0.6666666666666666,"passed":true},{"actual":1.0,"check":"zero scale step omitted","expected":0.6666666666666666,"passed":false},{"actual":1.5,"check":"different counts","expected":2,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"different scales\", \"actual\": 0.6666666666666666, \"expected\": 1, \"passed\": false}, {\"check\": \"same scale\", \"actual\": 1.5, \"expected\": 1.5, \"passed\": true}, {\"check\": \"one step\", \"actual\": 5.0, \"expected\": 5, \"passed\": true}, {\"check\": \"empty window\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}, {\"check\": \"zero numerator\", \"actual\": 0.6666666666666666, \"expected\": 0.6666666666666666, \"passed\": true}, {\"check\": \"zero scale step omitted\", \"actual\": 1.0, \"expected\": 0.6666666666666666, \"passed\": false}, {\"check\": \"different counts\", \"actual\": 1.5, \"expected\": 2, \"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."}}