← Lab
kvextremum
mixedupstream bugC++ · CPUInference & servingJuly 13, 2026
the question
Are llama.cpp's KV-cache seq_pos_min/max accessors exact, and does the documented contiguity guarantee hold under arbitrary sequence-op interleavings?
what came out
Mixed. A clean certificate was predicted; instead two defects surfaced over 48,024 exhaustive trials. seq_cp lacks a seq_has guard, so a repeated copy double-counts seq_pos and leaves seq_pos_max stale (returns 2 for an empty sequence). The documented [min,max] contiguity also fails after any interior seq_rm or partial seq_add/seq_div.
method & receipts
- Result: mixed
- Pre-registered — the prediction was written down and committed before the run.
- Reproducible — one script re-runs the whole thing from scratch.
- Tested — a correctness/benchmark suite ships alongside the code.
→ read the code and re-run it
github.com/v-code01/kvextremum