FA-98671 / Model quantization arithmetic / Open access
Quantization: Clipping occurs before zero-point shift · case 01
Clipping occurs before zero-point shift.
ROOT CAUSE
Quantize, add zero point, then clamp the resulting integer code to inclusive [lo,hi].
THE FAILURE
Quantize, add zero point, then clamp the resulting integer code to inclusive [lo,hi].
Unsuccessful 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.
Case 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.
Why this case matters
This deterministic model isolates one quantization arithmetic contract from tensor storage and runtime kernels.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(values, scale, zero, lo, hi):
return [max(lo,min(hi,round(x/scale)))+zero for x in values]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shift reaches top',solve([3*N],1,2,-4,5),[5])
check('shift reaches bottom',solve([-3*N],1,-2,-4,5),[-4])
check('inside',solve([1],1,1,-4,5),[2])
check('empty',solve([],1,0,-4,5),[])
check('zero point outside code range',solve([0],1,8,-4,5),[5])
check('negative scale-space',solve([-1],1,0,-4,5),[-1])
check('preclip low with positive offset',solve([-100],1,3,-4,5),[-4])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| shift reaches top | [5] | [5] | Passed |
| shift reaches bottom | [-5] | [-4] | Failed |
| inside | [2] | [2] | Passed |
| empty | [] | [] | Passed |
| zero point outside code range | [8] | [5] | Failed |
| negative scale-space | [-1] | [-1] | Passed |
| preclip low with positive offset | [-1] | [-4] | Failed |
SHA-256 / 09cea373cffa066aebf523e8b44b5974c65452c6d5cc689ad5b594c13925b30d
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(values, scale, zero, lo, hi):
return [max(lo,min(hi,round(max(lo,min(hi,x/scale)))+zero)) for x in values]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shift reaches top',solve([3*N],1,2,-4,5),[5])
check('shift reaches bottom',solve([-3*N],1,-2,-4,5),[-4])
check('inside',solve([1],1,1,-4,5),[2])
check('empty',solve([],1,0,-4,5),[])
check('zero point outside code range',solve([0],1,8,-4,5),[5])
check('negative scale-space',solve([-1],1,0,-4,5),[-1])
check('preclip low with positive offset',solve([-100],1,3,-4,5),[-4])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| shift reaches top | [5] | [5] | Passed |
| shift reaches bottom | [-4] | [-4] | Passed |
| inside | [2] | [2] | Passed |
| empty | [] | [] | Passed |
| zero point outside code range | [5] | [5] | Passed |
| negative scale-space | [-1] | [-1] | Passed |
| preclip low with positive offset | [-1] | [-4] | Failed |
SHA-256 / b6f3d466809bbf378741e3b2e4843530d010a692297461809b5d4c5e5257d006
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-30T16:48:15.404708+00:00.
Case digest / 49a9ece43c52180b28d071526f4d651e3d294a2e488c82a2490ad26796ac6690