Faster sorting algorithms discovered using deep reinforcement learning
- PMID: 37286649
- PMCID: PMC10247365
- DOI: 10.1038/s41586-023-06004-9
Faster sorting algorithms discovered using deep reinforcement learning
Abstract
Fundamental algorithms such as sorting or hashing are used trillions of times on any given day1. As demand for computation grows, it has become critical for these algorithms to be as performant as possible. Whereas remarkable progress has been achieved in the past2, making further improvements on the efficiency of these routines has proved challenging for both human scientists and computational approaches. Here we show how artificial intelligence can go beyond the current state of the art by discovering hitherto unknown routines. To realize this, we formulated the task of finding a better sorting routine as a single-player game. We then trained a new deep reinforcement learning agent, AlphaDev, to play this game. AlphaDev discovered small sorting algorithms from scratch that outperformed previously known human benchmarks. These algorithms have been integrated into the LLVM standard C++ sort library3. This change to this part of the sort library represents the replacement of a component with an algorithm that has been automatically discovered using reinforcement learning. We also present results in extra domains, showcasing the generality of the approach.
© 2023. The Author(s).
Conflict of interest statement
D.J.M., A.Michi, A.Z., M.G., M.S., C.P., E.L., S.I., A.Mandhane, P.K., M.R., D.S. and O.V. are planning to file a patent application relating to subject matter contained in this paper in the name of DeepMind Technologies Limited. The remaining authors declare no competing interests.
Figures
References
-
- Amazon. Amazon S3—two trillion objects, 1.1 million requests/second. AWShttps://aws.amazon.com/blogs/aws/amazon-s3-two-trillion-objects-11-milli... (2013).
-
- Cormen, T. H. et al. Introduction to Algorithms (MIT Press, 2022).
-
- Gelmi, M. Introduce branchless sorting functions for sort3, sort4 and sort5. LLVM.orghttps://reviews.llvm.org/D118029 (2022).
-
- Bansal, S. & Aiken, A. Automatic generation of peephole superoptimizers. ACM SIGARCH Comput. Arch. News34, 394–403 (2006).
-
- Alur, R. et al. Syntax-Guided Synthesis (IEEE, 2013).
LinkOut - more resources
Full Text Sources
Other Literature Sources
Miscellaneous
