FAILURE MAP
← Case archive

FA-98681 / Model quantization arithmetic / Open access

Quantization: Fixed-point rescale truncates instead of rounding · case 01

Fixed-point rescale truncates instead of rounding.

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

ROOT CAUSE

Compute round-to-even of x*multiplier/2**shift for nonnegative shift; return integer outputs.

THE FAILURE

Compute round-to-even of x*multiplier/2**shift for nonnegative shift; return integer outputs.

Unsuccessful approach: The attempted code restores multiplication and shifting but truncates discarded fractional bits instead of rounding them.

Case contract

Compute round-to-even of x*multiplier/2**shift for nonnegative shift; return integer outputs. 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, multiplier, shift):
    return [((x*multiplier)+(1<<shift)-1)>>shift for x in values]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('exact',solve([4*N],3,2),[3*N])
check('positive fraction',solve([2],1,1),[1])
check('negative fraction',solve([-2],1,1),[-1])
check('empty',solve([],3,2),[])
check('half even',solve([1],1,1),[0])
check('quarter',solve([1],1,2),[0])
check('odd half tie',solve([3],1,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 fixtureActualExpectedOutcome
exact[3][3]Passed
positive fraction[1][1]Passed
negative fraction[-1][-1]Passed
empty[][]Passed
half even[1][0]Failed
quarter[1][0]Failed
odd half tie[2][2]Passed

SHA-256 / ac2e5f56d53f91d3aaa71af3e1e318e92b617d1aaa379d13bf89fbdd0716f00c

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(values, multiplier, shift):
    return [(x*multiplier)>>shift for x in values]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('exact',solve([4*N],3,2),[3*N])
check('positive fraction',solve([2],1,1),[1])
check('negative fraction',solve([-2],1,1),[-1])
check('empty',solve([],3,2),[])
check('half even',solve([1],1,1),[0])
check('quarter',solve([1],1,2),[0])
check('odd half tie',solve([3],1,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 fixtureActualExpectedOutcome
exact[3][3]Passed
positive fraction[1][1]Passed
negative fraction[-1][-1]Passed
empty[][]Passed
half even[0][0]Passed
quarter[0][0]Passed
odd half tie[1][2]Failed

SHA-256 / f4792cdc0856e8b3fce2167a9c16aee981dcfb6735296aadc77e08ab7e808b53

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

Case digest / f09582c862bd973cda952047009864ef95cf40f2f9de9606ef06eea80b6dd20d