Skip to main content
← Lab

neonselect

confirmedC++ · NEON / Apple M4Systems & data structuresJuly 6, 2026

the question

What does the sampler's selection step -- argmax and top-k over the vocabulary -- cost, and how much does NEON help?

what came out

A branchless NEON argmax is ~8x the scalar scan (29->3.7us at 32k vocab), top-k by partial selection is 17-62x cheaper than a full sort, and the ratio grows with vocabulary size. This is the kernel behind why top-k is near-free. Standalone C++ ARM NEON; all three pre-registered 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/neonselect