FA-97951 / Training label alignment / Open access
One-hot targets omit classes absent from the current batch · case 01
One-hot targets omit classes absent from the current batch.
ROOT CAUSE
Output width is inferred from observed labels rather than the declared class count.
THE FAILURE
Output width is inferred from observed labels rather than the declared class count.
Unsuccessful approach: Falling back to the observed maximum when an index is invalid still produces a non-contract width for invalid rows.
Case contract
Given zero-based class indices and declared class_count, emit one-hot rows of exactly that width; invalid indices yield all-zero rows.
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(indices, class_count):
return [[int(j==i) for j in range(max(indices,default=-1)+1)] for i in indices]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('absent trailing classes',solve([0,1],N+2),[[1]+[0]*(N+1),[0,1]+[0]*N])
check('last class',solve([N-1],N),[[0]*(N-1)+[1]])
check('empty batch keeps width implicit',solve([],N),[])
check('invalid negative',solve([-1],N),[[0]*N])
check('invalid too large',solve([N],N),[[0]*N])
check('single class',solve([0],1),[[1]])
check('mixed indices',solve([N-1,0],N),[[0]*(N-1)+[1],[1]+[0]*(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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| absent trailing classes | [[1, 0], [0, 1]] | [[1, 0, 0], [0, 1, 0]] | Failed |
| last class | [[1]] | [[1]] | Passed |
| empty batch keeps width implicit | [] | [] | Passed |
| invalid negative | [[]] | [[0]] | Failed |
| invalid too large | [[0, 1]] | [[0]] | Failed |
| single class | [[1]] | [[1]] | Passed |
| mixed indices | [[1], [1]] | [[1], [1]] | Passed |
SHA-256 / b44cccab3a8d83ebb5a2be2284d024bd009172ae81fd642c594f01115a56e586
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(indices, class_count):
width=class_count if all(0<=i<class_count for i in indices) else max(indices,default=-1)+1
return [[int(j==i) for j in range(width)] for i in indices]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('absent trailing classes',solve([0,1],N+2),[[1]+[0]*(N+1),[0,1]+[0]*N])
check('last class',solve([N-1],N),[[0]*(N-1)+[1]])
check('empty batch keeps width implicit',solve([],N),[])
check('invalid negative',solve([-1],N),[[0]*N])
check('invalid too large',solve([N],N),[[0]*N])
check('single class',solve([0],1),[[1]])
check('mixed indices',solve([N-1,0],N),[[0]*(N-1)+[1],[1]+[0]*(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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| absent trailing classes | [[1, 0, 0], [0, 1, 0]] | [[1, 0, 0], [0, 1, 0]] | Passed |
| last class | [[1]] | [[1]] | Passed |
| empty batch keeps width implicit | [] | [] | Passed |
| invalid negative | [[]] | [[0]] | Failed |
| invalid too large | [[0, 1]] | [[0]] | Failed |
| single class | [[1]] | [[1]] | Passed |
| mixed indices | [[1], [1]] | [[1], [1]] | Passed |
SHA-256 / 1f642e458178415694621aa3ddfd5d8327b268d62ea9a24ec730c46f87f617da
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
Indices are integers; malformed noninteger indices are outside the toy contract. 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.548571+00:00.
Case digest / 333369be5bd33ef79d5ae925a282c9feff9324239104de502dc944981c635987