Efficient sorting of small fixed-size inputs

How efficiently can a fixed small number of inputs be sorted correctly? This problem concerns instruction counts and measured running time of concrete routines, compared on specified processors and inputs.

Why it matters and what counts as progress

Why it matters: Small sorting routines are used inside larger library algorithms, so a measured constant-factor improvement can affect widely deployed software.

What counts as progress: Find a correct routine with fewer instructions or faster matched benchmarks. Reproducing a speedup on one processor does not establish universal optimality.

How the problem developed

  1. 7 Jun 2023 · AI contribution [1]

    Daniel J. Mankowitz and colleagues; AlphaDev Reported reinforcement-learning discoveries of small sorting routines translated into C++ and incorporated into LLVM libc++. Reported speedups reach 70% for length-five sequences and about 1.7% for sequences exceeding 250,000 elements under the paper’s tested configurations.

  2. 23 Jul 2023 · Human follow-up [2]

    Cassio Neri Presented two shorter counterexamples to the claimed 17-instruction minimality of Sort3AlphaDev and a C/CC/C++ implementation reported faster than that particular routine.

Follow new AI contributions to this problem.

Get email updates

Download problem history

AI contribution

AlphaDev: faster small sorting routines in LLVM libc++

Daniel J. Mankowitz, Andrea Michi, Anton Zhernov, Marco Gelmi, Marco Selvi, Cosmin Paduraru, Edouard Leurent, Shariq Iqbal, Jean-Baptiste Lespiau, Alex Ahern, Thomas Köppe, Kevin Millikin, Stephen Gaffney, Sophie Elster, Jackson Broshear, Chris Gamble, Kieran Milan, Robert Tung, Minjae Hwang, Taylan Cemgil, Mohammadamin Barekatain, Yujia Li, Amol Mandhane, Thomas Hubert, Julian Schrittwieser, Demis Hassabis, Pushmeet Kohli, Martin Riedmiller, Oriol Vinyals, David Silver

DeepMind reports AI-discovered assembly sorting routines translated to C++ and incorporated in LLVM libc++. Its tests report up to 70% improvement for length-five inputs and about 1.7% for inputs exceeding 250,000 elements.

AI involvementAI-centered
ImportanceNotable
Technical verificationPartial
Human understandingExplained
Paper date:

Sources

  1. Original source
  2. Subsequent shorter and faster Sort3 research
  3. Released sorting routines
Publication history