FAILURE MAP
← Case archive

FA-98566 / KV cache position mapping / Open access

Left padding does not consume logical positions · case 01

Position IDs include the leading pad cells.

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

ROOT CAUSE

The physical column number is used directly as the model position.

THE FAILURE

The physical column number is used directly as the model position.

Unsuccessful approach: Subtracting padding from every physical column makes pad positions negative instead of marking them invalid.

Case contract

For a row of booleans where true means a real token, return position IDs beginning at zero for real tokens and -1 for pads.

Why this case matters

A small in-memory model makes the cache address contract explicit for a serving component.

1 / The failure

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

N = 1
observations = []
def solve(valid):
    return [i for i,_ in enumerate(valid)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('left pad',solve([False,False,True,True]),[-1,-1,0,1])
check('right pad',solve([True,True,False]),[0,1,-1])
check('no padding',solve([True]*N),list(range(N)))
check('all padding',solve([False]*N),[-1]*N)
check('single token',solve([True]),[0])
check('interior pad',solve([True,False,True]),[0,-1,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
left pad[0, 1, 2, 3][-1, -1, 0, 1]Failed
right pad[0, 1, 2][0, 1, -1]Failed
no padding[0][0]Passed
all padding[0][-1]Failed
single token[0][0]Passed
interior pad[0, 1, 2][0, -1, 1]Failed

SHA-256 / 7242f287094ad15050b22e8ebd51ed1b2e6c4fa09966c81ee0e3af3cbc3b2f14

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(valid):
    return [i-sum(not x for x in valid[:i+1]) for i in range(len(valid))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('left pad',solve([False,False,True,True]),[-1,-1,0,1])
check('right pad',solve([True,True,False]),[0,1,-1])
check('no padding',solve([True]*N),list(range(N)))
check('all padding',solve([False]*N),[-1]*N)
check('single token',solve([True]),[0])
check('interior pad',solve([True,False,True]),[0,-1,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
left pad[-1, -1, 0, 1][-1, -1, 0, 1]Passed
right pad[0, 1, 1][0, 1, -1]Failed
no padding[0][0]Passed
all padding[-1][-1]Passed
single token[0][0]Passed
interior pad[0, 0, 1][0, -1, 1]Failed

SHA-256 / 4cd69af9d7b5453487408c4f2ae4495fa80939e173c6a3dbc95f39da9b4010fa

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

These toy integer maps omit tensor layout, concurrency, device memory, and model-specific cache formats. 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:14.544621+00:00.

Case digest / 5472fe8f2d5995467a28e899847ee9bb4c33923092a6c03555d5f2d7eeae5438