FAILURE MAP
← Case archive

FA-98096 / Sequence batch packing / Open access

Length bucketing reverses equal-length input order · case 01

Length bucketing reverses equal-length input order.

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

ROOT CAUSE

The tie key reverses the source index or imposes token-value order.

THE FAILURE

The tie key reverses the source index or imposes token-value order.

Unsuccessful approach: Lexical token sorting is deterministic but violates stable input ownership.

Case contract

Sort sequences by ascending length while preserving original order among equal lengths.

Why this case matters

This deterministic toy packing rule models a common boundary in preparing bounded training sequences.

1 / The failure

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

N = 1
observations = []
def solve(sequences):
    return sorted(sequences,key=lambda s:(len(s),-sequences.index(s)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a=[N]; b=[-N]
check('equal length stability', solve([a,b,[1,2]]), [a,b,[1,2]])
check('length order', solve([[1,2],[3],[4,5,6]]), [[3],[1,2],[4,5,6]])
check('empty', solve([]), [])
check('singleton', solve([[N]]), [[N]])
check('duplicate values', solve([[1],[1],[2,3]]), [[1],[1],[2,3]])
check('ties after shorter', solve([[1,2],[3],[4,5]]), [[3],[1,2],[4,5]])
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
equal length stability[[-1], [1], [1, 2]][[1], [-1], [1, 2]]Failed
length order[[3], [1, 2], [4, 5, 6]][[3], [1, 2], [4, 5, 6]]Passed
empty[][]Passed
singleton[[1]][[1]]Passed
duplicate values[[1], [1], [2, 3]][[1], [1], [2, 3]]Passed
ties after shorter[[3], [4, 5], [1, 2]][[3], [1, 2], [4, 5]]Failed

SHA-256 / 3a124942e5ebaab99205cde4a7f2be6a024fdb5202347fa4d52df3031fc5f3f2

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(sequences):
    return sorted(sequences,key=lambda s:(len(s),str(s)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a=[N]; b=[-N]
check('equal length stability', solve([a,b,[1,2]]), [a,b,[1,2]])
check('length order', solve([[1,2],[3],[4,5,6]]), [[3],[1,2],[4,5,6]])
check('empty', solve([]), [])
check('singleton', solve([[N]]), [[N]])
check('duplicate values', solve([[1],[1],[2,3]]), [[1],[1],[2,3]])
check('ties after shorter', solve([[1,2],[3],[4,5]]), [[3],[1,2],[4,5]])
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
equal length stability[[-1], [1], [1, 2]][[1], [-1], [1, 2]]Failed
length order[[3], [1, 2], [4, 5, 6]][[3], [1, 2], [4, 5, 6]]Passed
empty[][]Passed
singleton[[1]][[1]]Passed
duplicate values[[1], [1], [2, 3]][[1], [1], [2, 3]]Passed
ties after shorter[[3], [1, 2], [4, 5]][[3], [1, 2], [4, 5]]Passed

SHA-256 / d56178c6007689f87364b887c6bb5f0f9a81178a73380c330fa51feea133ccb6

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

Inputs are short integer-token lists under the stated toy contract; results do not claim compatibility with a specific training framework. 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:09.321943+00:00.

Case digest / cd14822dbb40058a54809b32d39e9179ebcec126abd6bf3430b0f8471f2f2a2a