FA-98661 / Model quantization arithmetic / Open access
Quantization: Midpoint rounding uses half-up · case 01
Midpoint rounding uses half-up.
ROOT CAUSE
Divide values by positive scale and round to nearest integer using ties-to-even.
THE FAILURE
Divide values by positive scale and round to nearest integer using ties-to-even.
Unsuccessful approach: The attempted code handles negative signs symmetrically but rounds every midpoint away from zero instead of to the even integer.
Case contract
Divide values by positive scale and round to nearest integer using ties-to-even. 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):
return [int(x/scale+0.5) for x in values]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive midpoint',solve([N+0.5],1),[round(N+0.5)])
check('negative midpoint',solve([-(N+0.5)],1),[round(-(N+0.5))])
check('integer',solve([N],1),[N])
check('empty',solve([],1),[])
check('quarter',solve([N+0.25],1),[N])
check('negative quarter',solve([-(N+0.25)],1),[-N])
check('fixed even midpoint',solve([2.5],1),[2])
check('fixed negative even midpoint',solve([-2.5],1),[-2])
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 |
|---|---|---|---|
| positive midpoint | [2] | [2] | Passed |
| negative midpoint | [-1] | [-2] | Failed |
| integer | [1] | [1] | Passed |
| empty | [] | [] | Passed |
| quarter | [1] | [1] | Passed |
| negative quarter | [0] | [-1] | Failed |
| fixed even midpoint | [3] | [2] | Failed |
| fixed negative even midpoint | [-2] | [-2] | Passed |
SHA-256 / fb5b0e40d6859aebbfee3be75a2456f9055908e82d12360b806d0d7df95e0499
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(values, scale):
return [int(abs(x/scale)+0.5)*(1 if x>=0 else -1) for x in values]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive midpoint',solve([N+0.5],1),[round(N+0.5)])
check('negative midpoint',solve([-(N+0.5)],1),[round(-(N+0.5))])
check('integer',solve([N],1),[N])
check('empty',solve([],1),[])
check('quarter',solve([N+0.25],1),[N])
check('negative quarter',solve([-(N+0.25)],1),[-N])
check('fixed even midpoint',solve([2.5],1),[2])
check('fixed negative even midpoint',solve([-2.5],1),[-2])
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 |
|---|---|---|---|
| positive midpoint | [2] | [2] | Passed |
| negative midpoint | [-2] | [-2] | Passed |
| integer | [1] | [1] | Passed |
| empty | [] | [] | Passed |
| quarter | [1] | [1] | Passed |
| negative quarter | [-1] | [-1] | Passed |
| fixed even midpoint | [3] | [2] | Failed |
| fixed negative even midpoint | [-3] | [-2] | Failed |
SHA-256 / ee545bf3dc277a980ab1719d1a5d99835f850ad1392dfc94495121f95af41d29
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 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.404386+00:00.
Case digest / f30442d5c579edd84fcdb0c6b1f02e9158efe5263912c5df9c03020f97574e42