FA-97946 / Training label alignment / Open access
Class IDs shift when the vocabulary is sorted differently · case 01
Class IDs shift when the vocabulary is sorted differently.
ROOT CAUSE
The encoder derives class IDs from observed row order while the decoder uses a declared order.
THE FAILURE
The encoder derives class IDs from observed row order while the decoder uses a declared order.
Unsuccessful approach: Sorting the vocabulary before indexing still disagrees with its declared order.
Case contract
Encode each label by its index in the given ordered vocabulary; unknown labels produce -1.
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, vocabulary):
return [i for i,_ in enumerate(labels)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('declared order',solve(['cat','dog'],['dog','cat']),[1,0])
check('unknown class',solve(['bird'],['cat','dog']),[-1])
check('empty labels',solve([],['x']),[])
check('singleton class',solve(['x'],['x']),[0])
check('later class',solve(['c','a'],['b','c','a']),[1,2])
check('unknown among known',solve(['a','q','b'],['b','a']),[1,-1,0])
check('zero index remains zero',solve(['z'],['z','a']),[0])
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 |
|---|---|---|---|
| declared order | [0, 1] | [1, 0] | Failed |
| unknown class | [0] | [-1] | Failed |
| empty labels | [] | [] | Passed |
| singleton class | [0] | [0] | Passed |
| later class | [0, 1] | [1, 2] | Failed |
| unknown among known | [0, 1, 2] | [1, -1, 0] | Failed |
| zero index remains zero | [0] | [0] | Passed |
SHA-256 / 0b6249829bdabc1d9c3d29743daa8a2b825cf98daa6678988c48f6c282753006
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(labels, vocabulary):
return [sorted(set(vocabulary)).index(x) if x in vocabulary else -1 for x in labels]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('declared order',solve(['cat','dog'],['dog','cat']),[1,0])
check('unknown class',solve(['bird'],['cat','dog']),[-1])
check('empty labels',solve([],['x']),[])
check('singleton class',solve(['x'],['x']),[0])
check('later class',solve(['c','a'],['b','c','a']),[1,2])
check('unknown among known',solve(['a','q','b'],['b','a']),[1,-1,0])
check('zero index remains zero',solve(['z'],['z','a']),[0])
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 |
|---|---|---|---|
| declared order | [0, 1] | [1, 0] | Failed |
| unknown class | [-1] | [-1] | Passed |
| empty labels | [] | [] | Passed |
| singleton class | [0] | [0] | Passed |
| later class | [2, 0] | [1, 2] | Failed |
| unknown among known | [0, -1, 1] | [1, -1, 0] | Failed |
| zero index remains zero | [1] | [0] | Failed |
SHA-256 / be084bfc254061dc690a729df362c10a3daa3c8eba490b74a5059ecbb83f25a0
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
The vocabulary is expected to contain unique hashable labels. 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.548404+00:00.
Case digest / 373f1ef3d5acc5107287f2a49852de096fb9fd48d3af0d6fc580ebfd83eaae36