FA-98636 / KV cache position mapping / Open access
Prefix reuse rounds down to complete cache blocks · case 01
A partial cache block is claimed as reusable.
ROOT CAUSE
The shared token count is returned without respecting cache block granularity.
THE FAILURE
The shared token count is returned without respecting cache block granularity.
Unsuccessful approach: Rounding up preserves more prefix tokens but references an incomplete block.
Case contract
Return the longest common token prefix length rounded down to a multiple of positive block_size.
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(cached_tokens, requested_tokens, block_size):
return min(len(cached_tokens),len(requested_tokens))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('partial block',solve(['a']*N+['x'],['a']*N+['y'],4),(N//4)*4)
check('exact boundary',solve(['a']*8,['a']*8,4),8)
check('prefix shorter than block',solve(['a','b'],['a','b','c'],4),0)
check('mismatch before boundary',solve(['a','b','x'],['a','b','y'],2),2)
check('no match',solve(['x'],['y'],3),0)
check('empty',solve([],['a'],2),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 |
|---|---|---|---|
| partial block | 2 | 0 | Failed |
| exact boundary | 8 | 8 | Passed |
| prefix shorter than block | 2 | 0 | Failed |
| mismatch before boundary | 3 | 2 | Failed |
| no match | 1 | 0 | Failed |
| empty | 0 | 0 | Passed |
SHA-256 / cb038460121d94c6a44b9de3f8ba03ad2a1cc9cbac9d7dc883712a4350b1f5c0
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(cached_tokens, requested_tokens, block_size):
common=0
while common<min(len(cached_tokens),len(requested_tokens)) and cached_tokens[common]==requested_tokens[common]: common+=1
return ((common+block_size-1)//block_size)*block_size
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('partial block',solve(['a']*N+['x'],['a']*N+['y'],4),(N//4)*4)
check('exact boundary',solve(['a']*8,['a']*8,4),8)
check('prefix shorter than block',solve(['a','b'],['a','b','c'],4),0)
check('mismatch before boundary',solve(['a','b','x'],['a','b','y'],2),2)
check('no match',solve(['x'],['y'],3),0)
check('empty',solve([],['a'],2),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 |
|---|---|---|---|
| partial block | 4 | 0 | Failed |
| exact boundary | 8 | 8 | Passed |
| prefix shorter than block | 4 | 0 | Failed |
| mismatch before boundary | 2 | 2 | Passed |
| no match | 0 | 0 | Passed |
| empty | 0 | 0 | Passed |
SHA-256 / 8212d8303336f183f303fa9c386a46a34629bae859ca02911ca4aba48462da3b
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.972213+00:00.
Case digest / a0b36f309b0ca75dbdb1f1852275a4daf546b6999064f6d979af9e5d3c31c19d