Skip to main content
← Lab

ctxprefill

confirmedPython · llama.cppInference, serving & evaluationJuly 6, 2026

the question

Where's the O(n^2) attention wall in prompt prefill?

what came out

Real and measurable: per-token prefill cost rises quadratically (positive coefficient, tight CI excluding zero), and ms/token climbs 20-31% from ~10k to ~40k tokens. Prefill stops being linear well before your context window does. All three predictions held.

method & receipts

  • Result: confirmed
  • Pre-registered: the prediction was written down and committed before the run.
  • Reproducible: one script re-runs the whole thing from scratch.
  • Adversarial self-review: my own skeptic's pass over each claim, kept in the repo.
  • Machine-readable claims: every reported number, in a checkable file.
  • Tested: a correctness/benchmark suite ships alongside the code.

→ read the code and re-run it

github.com/v-code01/ctxprefill