Skip to main content
← Lab

ctxprefill

confirmedPython · llama.cppInference & servingJuly 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) -- 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.
  • Independently reviewed an adversarial review pass, 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