# Sorting routines discovered by reinforcement learning, now in the C++ standard library

> AlphaDev treated the search for a faster sorting routine as a single-player game and found small sorting algorithms that beat the human benchmarks, which were then merged into the LLVM standard C++ sort library.

- AI system: AlphaDev, a deep reinforcement-learning agent working at assembly level
- Institution: Google DeepMind
- Field: Mathematics
- Announced / published: 7 June 2023 (2023-06-07)
- Published in: Nature
- DOI: [10.1038/s41586-023-06004-9](https://doi.org/10.1038/s41586-023-06004-9)
- Primary source: [Mankowitz, Michi, Zhernov, Gelmi et al., “Faster sorting algorithms discovered using deep reinforcement learning,” Nature (2023)](https://doi.org/10.1038/s41586-023-06004-9)
- Also: [AlphaDev code repository](https://github.com/google-deepmind/alphadev)
- Added to Buffio: 2026-12-04
- Last updated: 2026-12-04
- Buffio page: https://buffio.com/discoveries/alphadev-sorting

Sorting routines run trillions of times a day, and improving them had resisted both human effort and automated search. The authors recast the problem as a single-player game over assembly instructions and trained AlphaDev, a deep reinforcement-learning agent, to play it.

AlphaDev discovered small sorting algorithms from scratch that outperform the previously known human benchmarks. The routines were integrated into the LLVM standard C++ sort library, replacing a component with one found automatically by reinforcement learning. The paper also reports results in other domains to show the approach generalizes.

---
From Buffio (https://buffio.com). Buffio records scientific discoveries made by AI systems, where the AI acted as the researcher. Facts on this page come from the primary source linked above; please cite that source.
