{"abstract":"Affine quantized codes are too large when scale exceeds one.","category":"Model quantization arithmetic","checks":6,"contract":"Affine scalar values are divided by positive scale, shifted by zero point, then clipped inclusively to [lo,hi]; round-to-even is used. Inputs follow this explicit integer toy contract; ties use Python round-to-even where rounding is required.","contract_signature":"values, scale, zero, lo, hi","evaluation_group":"quant-affine","failed_approach":"The attempted code divides by scale but omits the nonzero zero point, so interior codes are shifted and saturation can occur at the wrong side.","family":"w3-model-quantization-arithmetic-affine-scale-divide","id":"FA-98641","implementations":{"attempt":{"sha256":"bb5b843d8c86063f88bfb35ffe0374d2f9940007a9ba103584fb706b7df7efbb","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(values, scale, zero, lo, hi):\n    return [max(lo,min(hi,round(x/scale))) for x in values]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('interior',solve([2*N,-N],2,3,-8,7),[max(-8,min(7,N+3)),max(-8,min(7,round(-N/2)+3))])\ncheck('positive fractional',solve([3],2,0,-8,7),[2])\ncheck('negative fractional',solve([-3],2,0,-8,7),[-2])\ncheck('empty',solve([],2,3,-8,7),[])\ncheck('upper saturation',solve([100*N],2,1,-8,7),[7])\ncheck('lower saturation',solve([-100*N],2,-1,-8,7),[-8])\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":"9a4f5e7b40b20c37855d947b0056764d2d1e33ff177aa19153a942c3bb677a9a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(values, scale, zero, lo, hi):\n    return [max(lo,min(hi,round(x*scale)+zero)) for x in values]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('interior',solve([2*N,-N],2,3,-8,7),[max(-8,min(7,N+3)),max(-8,min(7,round(-N/2)+3))])\ncheck('positive fractional',solve([3],2,0,-8,7),[2])\ncheck('negative fractional',solve([-3],2,0,-8,7),[-2])\ncheck('empty',solve([],2,3,-8,7),[])\ncheck('upper saturation',solve([100*N],2,1,-8,7),[7])\ncheck('lower saturation',solve([-100*N],2,-1,-8,7),[-8])\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":"Toy scalar/list arithmetic only; it does not model a production quantizer, hardware instruction, or accuracy/performance gain. 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-model-quantization-arithmetic-affine-scale-divide","generated_at":"2026-09-30T16:48:15.403679+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"This deterministic model isolates one quantization arithmetic contract from tensor storage and runtime kernels.","root_cause":"The broken quantizer multiplies by scale, while this toy affine mapping requires dividing by scale before adding the zero point.","sha256":"9409bd6248bd352ef8afa3d42763ff3e0c1f45ce500952aba8711ff37eb80d38","title":"Quantization: Affine codes multiply by scale before rounding · 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.871,"exit_code":1,"observations":[{"actual":[1,0],"check":"interior","expected":[4,3],"passed":false},{"actual":[2],"check":"positive fractional","expected":[2],"passed":true},{"actual":[-2],"check":"negative fractional","expected":[-2],"passed":true},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":[7],"check":"upper saturation","expected":[7],"passed":true},{"actual":[-8],"check":"lower saturation","expected":[-8],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"interior\", \"actual\": [1, 0], \"expected\": [4, 3], \"passed\": false}, {\"check\": \"positive fractional\", \"actual\": [2], \"expected\": [2], \"passed\": true}, {\"check\": \"negative fractional\", \"actual\": [-2], \"expected\": [-2], \"passed\": true}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"upper saturation\", \"actual\": [7], \"expected\": [7], \"passed\": true}, {\"check\": \"lower saturation\", \"actual\": [-8], \"expected\": [-8], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":28.479,"exit_code":1,"observations":[{"actual":[7,1],"check":"interior","expected":[4,3],"passed":false},{"actual":[6],"check":"positive fractional","expected":[2],"passed":false},{"actual":[-6],"check":"negative fractional","expected":[-2],"passed":false},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":[7],"check":"upper saturation","expected":[7],"passed":true},{"actual":[-8],"check":"lower saturation","expected":[-8],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"interior\", \"actual\": [7, 1], \"expected\": [4, 3], \"passed\": false}, {\"check\": \"positive fractional\", \"actual\": [6], \"expected\": [2], \"passed\": false}, {\"check\": \"negative fractional\", \"actual\": [-6], \"expected\": [-2], \"passed\": false}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"upper saturation\", \"actual\": [7], \"expected\": [7], \"passed\": true}, {\"check\": \"lower saturation\", \"actual\": [-8], \"expected\": [-8], \"passed\": true}], \"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."}}