{"abstract":"Clipping occurs before zero-point shift.","category":"Model quantization arithmetic","checks":7,"contract":"Quantize, add zero point, then clamp the resulting integer code to inclusive [lo,hi]. 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-saturation","failed_approach":"The attempted code clamps the unshifted scaled value before adding zero point; a positive offset can pull a low saturated value back into range.","family":"w3-model-quantization-arithmetic-clip-before-zero","id":"FA-98671","implementations":{"attempt":{"sha256":"b6f3d466809bbf378741e3b2e4843530d010a692297461809b5d4c5e5257d006","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(max(lo,min(hi,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('shift reaches top',solve([3*N],1,2,-4,5),[5])\ncheck('shift reaches bottom',solve([-3*N],1,-2,-4,5),[-4])\ncheck('inside',solve([1],1,1,-4,5),[2])\ncheck('empty',solve([],1,0,-4,5),[])\ncheck('zero point outside code range',solve([0],1,8,-4,5),[5])\ncheck('negative scale-space',solve([-1],1,0,-4,5),[-1])\ncheck('preclip low with positive offset',solve([-100],1,3,-4,5),[-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":"09cea373cffa066aebf523e8b44b5974c65452c6d5cc689ad5b594c13925b30d","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('shift reaches top',solve([3*N],1,2,-4,5),[5])\ncheck('shift reaches bottom',solve([-3*N],1,-2,-4,5),[-4])\ncheck('inside',solve([1],1,1,-4,5),[2])\ncheck('empty',solve([],1,0,-4,5),[])\ncheck('zero point outside code range',solve([0],1,8,-4,5),[5])\ncheck('negative scale-space',solve([-1],1,0,-4,5),[-1])\ncheck('preclip low with positive offset',solve([-100],1,3,-4,5),[-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":"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-clip-before-zero","generated_at":"2026-09-30T16:48:15.404708+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":"Quantize, add zero point, then clamp the resulting integer code to inclusive [lo,hi].","sha256":"49a9ece43c52180b28d071526f4d651e3d294a2e488c82a2490ad26796ac6690","title":"Quantization: Clipping occurs before zero-point shift · 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.556,"exit_code":1,"observations":[{"actual":[5],"check":"shift reaches top","expected":[5],"passed":true},{"actual":[-4],"check":"shift reaches bottom","expected":[-4],"passed":true},{"actual":[2],"check":"inside","expected":[2],"passed":true},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":[5],"check":"zero point outside code range","expected":[5],"passed":true},{"actual":[-1],"check":"negative scale-space","expected":[-1],"passed":true},{"actual":[-1],"check":"preclip low with positive offset","expected":[-4],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"shift reaches top\", \"actual\": [5], \"expected\": [5], \"passed\": true}, {\"check\": \"shift reaches bottom\", \"actual\": [-4], \"expected\": [-4], \"passed\": true}, {\"check\": \"inside\", \"actual\": [2], \"expected\": [2], \"passed\": true}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"zero point outside code range\", \"actual\": [5], \"expected\": [5], \"passed\": true}, {\"check\": \"negative scale-space\", \"actual\": [-1], \"expected\": [-1], \"passed\": true}, {\"check\": \"preclip low with positive offset\", \"actual\": [-1], \"expected\": [-4], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":26.975,"exit_code":1,"observations":[{"actual":[5],"check":"shift reaches top","expected":[5],"passed":true},{"actual":[-5],"check":"shift reaches bottom","expected":[-4],"passed":false},{"actual":[2],"check":"inside","expected":[2],"passed":true},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":[8],"check":"zero point outside code range","expected":[5],"passed":false},{"actual":[-1],"check":"negative scale-space","expected":[-1],"passed":true},{"actual":[-1],"check":"preclip low with positive offset","expected":[-4],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"shift reaches top\", \"actual\": [5], \"expected\": [5], \"passed\": true}, {\"check\": \"shift reaches bottom\", \"actual\": [-5], \"expected\": [-4], \"passed\": false}, {\"check\": \"inside\", \"actual\": [2], \"expected\": [2], \"passed\": true}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"zero point outside code range\", \"actual\": [8], \"expected\": [5], \"passed\": false}, {\"check\": \"negative scale-space\", \"actual\": [-1], \"expected\": [-1], \"passed\": true}, {\"check\": \"preclip low with positive offset\", \"actual\": [-1], \"expected\": [-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."}}