FAILURE MAP
← Case archive

FA-98676 / Model quantization arithmetic / Open access

Quantization: Quantized upper code is excluded · case 01

Quantized upper code is excluded.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Map values to integer codes and clamp both ends inclusively to the declared representable range.

THE FAILURE

Map values to integer codes and clamp both ends inclusively to the declared representable range.

Unsuccessful approach: The attempted code restores the upper endpoint but truncates fractional scaled values instead of rounding to nearest-even.

Case contract

Map values to integer codes and clamp both ends inclusively to the declared representable range. 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-1,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('exact upper',solve([5],1,0,-3,5),[5])
check('over upper',solve([100],1,0,-3,5),[5])
check('exact lower',solve([-3],1,0,-3,5),[-3])
check('under lower',solve([-100],1,0,-3,5),[-3])
check('empty',solve([],1,0,-3,5),[])
check('interior',solve([0],1,0,-3,5),[0])
check('halfway rounding inside',solve([3.5],1,0,-3,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 fixtureActualExpectedOutcome
exact upper[4][5]Failed
over upper[4][5]Failed
exact lower[-3][-3]Passed
under lower[-3][-3]Passed
empty[][]Passed
interior[0][0]Passed
halfway rounding inside[4][4]Passed

SHA-256 / ed9b8db3354f0056c73add6bf6628081d6b48120ea87d396cc5fb784768ac66a

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,int(x/scale)+zero)) for x in values]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('exact upper',solve([5],1,0,-3,5),[5])
check('over upper',solve([100],1,0,-3,5),[5])
check('exact lower',solve([-3],1,0,-3,5),[-3])
check('under lower',solve([-100],1,0,-3,5),[-3])
check('empty',solve([],1,0,-3,5),[])
check('interior',solve([0],1,0,-3,5),[0])
check('halfway rounding inside',solve([3.5],1,0,-3,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 fixtureActualExpectedOutcome
exact upper[5][5]Passed
over upper[5][5]Passed
exact lower[-3][-3]Passed
under lower[-3][-3]Passed
empty[][]Passed
interior[0][0]Passed
halfway rounding inside[3][4]Failed

SHA-256 / 4236e1161ba167cc6fb769abb06d5990e76b53fdbdc0b8f990c1b4cd240b6d72

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.403749+00:00.

Case digest / 6aa2fb7187b00543e0b5d891bd3082e85fc8b0f9de9850be773450b8ddac4ee8