FA-98641 / Model quantization arithmetic / Open access
Quantization: Affine codes multiply by scale before rounding · case 01
Affine quantized codes are too large when scale exceeds one.
ROOT CAUSE
The broken quantizer multiplies by scale, while this toy affine mapping requires dividing by scale before adding the zero point.
THE FAILURE
The broken quantizer multiplies by scale, while this toy affine mapping requires dividing by scale before adding the zero point.
Unsuccessful 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.
Case 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.
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('interior',solve([2*N,-N],2,3,-8,7),[max(-8,min(7,N+3)),max(-8,min(7,round(-N/2)+3))])
check('positive fractional',solve([3],2,0,-8,7),[2])
check('negative fractional',solve([-3],2,0,-8,7),[-2])
check('empty',solve([],2,3,-8,7),[])
check('upper saturation',solve([100*N],2,1,-8,7),[7])
check('lower saturation',solve([-100*N],2,-1,-8,7),[-8])
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 |
|---|---|---|---|
| interior | [7, 1] | [4, 3] | Failed |
| positive fractional | [6] | [2] | Failed |
| negative fractional | [-6] | [-2] | Failed |
| empty | [] | [] | Passed |
| upper saturation | [7] | [7] | Passed |
| lower saturation | [-8] | [-8] | Passed |
SHA-256 / 9a4f5e7b40b20c37855d947b0056764d2d1e33ff177aa19153a942c3bb677a9a
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(x/scale))) for x in values]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('interior',solve([2*N,-N],2,3,-8,7),[max(-8,min(7,N+3)),max(-8,min(7,round(-N/2)+3))])
check('positive fractional',solve([3],2,0,-8,7),[2])
check('negative fractional',solve([-3],2,0,-8,7),[-2])
check('empty',solve([],2,3,-8,7),[])
check('upper saturation',solve([100*N],2,1,-8,7),[7])
check('lower saturation',solve([-100*N],2,-1,-8,7),[-8])
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 |
|---|---|---|---|
| interior | [1, 0] | [4, 3] | Failed |
| positive fractional | [2] | [2] | Passed |
| negative fractional | [-2] | [-2] | Passed |
| empty | [] | [] | Passed |
| upper saturation | [7] | [7] | Passed |
| lower saturation | [-8] | [-8] | Passed |
SHA-256 / bb5b843d8c86063f88bfb35ffe0374d2f9940007a9ba103584fb706b7df7efbb
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 6 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.403679+00:00.
Case digest / 9409bd6248bd352ef8afa3d42763ff3e0c1f45ce500952aba8711ff37eb80d38