FAILURE MAP
← Case archive

FA-98651 / Model quantization arithmetic / Open access

Quantization: Per-channel scales follow the wrong axis · case 01

Per-channel scales follow the wrong axis.

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

ROOT CAUSE

Each row represents one output channel and each column an input value; divide column j by scales[j], round-to-even.

THE FAILURE

Each row represents one output channel and each column an input value; divide column j by scales[j], round-to-even.

Unsuccessful approach: The attempted code uses the row index for scale selection instead of the column index; it fails for multi-column rows and does not select a scale per value.

Case contract

Each row represents one output channel and each column an input value; divide column j by scales[j], round-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(rows, scales):
    return [[round(v/scales[0]) for v in row] for row in rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two channels',solve([[2*N,6*N],[4*N,8*N]], [2,4]),[[N,round(3*N/2)],[2*N,2*N]])
check('one row',solve([[6*N,8*N]],[2,4]),[[3*N,2*N]])
check('empty rows',solve([], [2,4]),[])
check('one column',solve([[6*N],[8*N]],[2]),[[3*N],[4*N]])
check('varying scales',solve([[4,12],[8,16]],[4,2]),[[1,6],[2,8]])
check('unit scales',solve([[N,N+1]],[1,1]),[[N,N+1]])
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
two channels[[1, 3], [2, 4]][[1, 2], [2, 2]]Failed
one row[[3, 4]][[3, 2]]Failed
empty rows[][]Passed
one column[[3], [4]][[3], [4]]Passed
varying scales[[1, 3], [2, 4]][[1, 6], [2, 8]]Failed
unit scales[[1, 2]][[1, 2]]Passed

SHA-256 / 9f335ec30efdc01f56f34abbb87543cca54656f424b49d0e9377a0c86b1e22ed

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(rows, scales):
    return [[round(v/scales[min(i,len(scales)-1)]) for v in row] for i,row in enumerate(rows)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two channels',solve([[2*N,6*N],[4*N,8*N]], [2,4]),[[N,round(3*N/2)],[2*N,2*N]])
check('one row',solve([[6*N,8*N]],[2,4]),[[3*N,2*N]])
check('empty rows',solve([], [2,4]),[])
check('one column',solve([[6*N],[8*N]],[2]),[[3*N],[4*N]])
check('varying scales',solve([[4,12],[8,16]],[4,2]),[[1,6],[2,8]])
check('unit scales',solve([[N,N+1]],[1,1]),[[N,N+1]])
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
two channels[[1, 3], [1, 2]][[1, 2], [2, 2]]Failed
one row[[3, 4]][[3, 2]]Failed
empty rows[][]Passed
one column[[3], [4]][[3], [4]]Passed
varying scales[[1, 3], [4, 8]][[1, 6], [2, 8]]Failed
unit scales[[1, 2]][[1, 2]]Passed

SHA-256 / 284b1c367ea5848abbd4764000bde4fabb4e7cb18f2e01d5439183f8938a0173

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

Case digest / 865492820648892d180b1532c4aa8a9976862e474841284ac76ea4529bc33a0e