FA-97971 / Training label alignment / Open access
Class weights are emitted in class order instead of example order · case 01
Class weights are emitted in class order instead of example order.
ROOT CAUSE
The routine enumerates class weights rather than looking up one weight for each example in sequence.
THE FAILURE
The routine enumerates class weights rather than looking up one weight for each example in sequence.
Unsuccessful approach: Sorting examples before lookup returns valid weights in the wrong row order.
Case contract
Return one weight per label from the supplied class-to-weight mapping; unknown labels use the supplied default.
Why this case matters
A small deterministic training-data operation makes label ownership and ordering explicit.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(labels, weights, default):
return [weights[k] for k in sorted(weights) if k in labels]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('input order retained',solve(['z','a'],{'z':N,'a':N+1},7),[N,N+1])
check('unknown default',solve(['q'],{'a':1},N),[N])
check('empty labels',solve([],{ 'a':N},0),[])
check('zero weight',solve(['x'],{'x':0},9),[0])
check('repeated class',solve(['b','a','b'],{'a':N,'b':N+1},0),[N+1,N,N+1])
check('all unknown',solve(['u','v'],{},N),[N,N])
check('single known',solve(['a'],{'a':N},0),[N])
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 |
|---|---|---|---|
| input order retained | [2, 1] | [1, 2] | Failed |
| unknown default | [] | [1] | Failed |
| empty labels | [] | [] | Passed |
| zero weight | [0] | [0] | Passed |
| repeated class | [1, 2] | [2, 1, 2] | Failed |
| all unknown | [] | [1, 1] | Failed |
| single known | [1] | [1] | Passed |
SHA-256 / 2b346492692ab827f8e18b586aa3dd9d7d06a3b9c9262da4a398e3a0f87ffaac
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(labels, weights, default):
return [weights.get(k,default) for k in sorted(labels)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('input order retained',solve(['z','a'],{'z':N,'a':N+1},7),[N,N+1])
check('unknown default',solve(['q'],{'a':1},N),[N])
check('empty labels',solve([],{ 'a':N},0),[])
check('zero weight',solve(['x'],{'x':0},9),[0])
check('repeated class',solve(['b','a','b'],{'a':N,'b':N+1},0),[N+1,N,N+1])
check('all unknown',solve(['u','v'],{},N),[N,N])
check('single known',solve(['a'],{'a':N},0),[N])
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 |
|---|---|---|---|
| input order retained | [2, 1] | [1, 2] | Failed |
| unknown default | [1] | [1] | Passed |
| empty labels | [] | [] | Passed |
| zero weight | [0] | [0] | Passed |
| repeated class | [1, 2, 2] | [2, 1, 2] | Failed |
| all unknown | [1, 1] | [1, 1] | Passed |
| single known | [1] | [1] | Passed |
SHA-256 / 1899d3466d306d6a221a47a56dbdb75fdd16782a43abe6bb246b5431ed432fc3
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
Class keys are unique dictionary keys; weights are finite scalars. 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:07.975749+00:00.
Case digest / 027c015e20f238983f24f2b413c4634b1abd01dbf32a1a0313bf05aae5fea337