FAILURE MAP
← Case archive

FA-98611 / KV cache position mapping / Open access

Slot allocation uses the lowest available physical slot · case 01

Allocation skips reusable holes and grows the cache unnecessarily.

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

ROOT CAUSE

The allocator only appends after the largest occupied slot.

THE FAILURE

The allocator only appends after the largest occupied slot.

Unsuccessful approach: Choosing the smallest slot from the occupied set can overwrite a live entry.

Case contract

Return the lowest nonnegative integer absent from occupied_slots.

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(occupied_slots):
    return max(occupied_slots,default=-1)+1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hole reused',solve({0,2,3}),1)
check('zero available',solve({1,2}),0)
check('empty allocator',solve(set()),0)
check('dense prefix',solve(set(range(N))),N)
check('high sparse',solve({4,9}),0)
check('nonzero hole',solve({0,1,3,4}),2)
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
hole reused41Failed
zero available30Failed
empty allocator00Passed
dense prefix11Passed
high sparse100Failed
nonzero hole52Failed

SHA-256 / 726f3b98fac156a17a5ba627e1f6cca7e9561a87f565191a1cd84a0bb1f82e4c

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(occupied_slots):
    return min(occupied_slots,default=0)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hole reused',solve({0,2,3}),1)
check('zero available',solve({1,2}),0)
check('empty allocator',solve(set()),0)
check('dense prefix',solve(set(range(N))),N)
check('high sparse',solve({4,9}),0)
check('nonzero hole',solve({0,1,3,4}),2)
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
hole reused01Failed
zero available10Failed
empty allocator00Passed
dense prefix01Failed
high sparse40Failed
nonzero hole02Failed

SHA-256 / dec9a3672dcc96db02a9e4e2fe4748262cabe0b1a63fb6880ee90854b8af1233

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.973490+00:00.

Case digest / 368c9ce83b0f43f2ad2678a819c4bd35588a29b15500616da09eb1cbd3613db5