New AI System Discovers Faster Algorithms for Sorting
New algorithms developed by AlphaDev, an artificial intelligence (AI) system, have the potential to transform the foundations of computing. In a recent paper published in Nature, researchers Daniel J. Mankowitz and Andrea Michi introduce AlphaDev, which uses reinforcement learning to uncover enhanced computer science algorithms. These new algorithms are faster and more efficient than the ones that have been developed by scientists and engineers over the past few decades.
Sorting, the method of organizing data in a specific order, is an essential component of many everyday tasks, from online search results to data processing on computers and phones. AlphaDev’s discovery of a faster algorithm for sorting is significant because it can revolutionize how we program computers and impact all aspects of our increasingly digital society.
To make these improved sorting algorithms widely available, AlphaDev has open-sourced them in the main C++ library. This means that millions of developers and companies can now use them in AI applications across various industries. It is the first time in over a decade that changes have been made to this part of the sorting library, and the first time an algorithm designed through reinforcement learning has been added.
Understanding Sorting and Its Evolution
Sorting is the process of organizing items in a particular order, whether it’s alphabetizing three letters, arranging numbers from biggest to smallest, or ordering a large database. This method has evolved over time, from scholars manually sorting books in ancient libraries to the development of sorting algorithms for commercial computers in the 1950s. Today, there are numerous sorting techniques and algorithms used worldwide to handle vast amounts of data.
AlphaDev’s Approach to Finding New Algorithms
AlphaDev takes a unique approach to finding faster algorithms by starting from scratch instead of refining existing ones. It explores the computer’s assembly instructions, which are used to create binary code for computers to execute. Many improvements can be found at this lower level, where computer storage and operations are more flexible.
To train AlphaDev, researchers turned sorting into a single-player “assembly game.” AlphaDev observes the algorithm it generates and the information in the central processing unit (CPU) at each turn and chooses an assembly instruction to add to the algorithm. This game is incredibly challenging because AlphaDev must search through a vast number of possible combinations of instructions to find a faster sorting algorithm. A single wrong move can render the entire algorithm invalid.
The Success of AlphaDev
AlphaDev’s efforts have led to the discovery of new sorting algorithms that have made significant improvements in the LLVM libc++ sorting library. These algorithms are up to 70% faster for shorter sequences and about 1.7% faster for longer sequences exceeding 250,000 elements. The focus was on improving sorting algorithms for sequences of three to five elements, which are commonly used multiple times within larger sorting functions.
In addition to being faster, AlphaDev’s sorting algorithms also feature novel approaches. They contain new sequences of instructions that save a single instruction each time they are applied. These “AlphaDev swap and copy moves” challenge conventional thinking and have the potential to make a substantial impact on the efficiency of sorting algorithms.
Overall, AlphaDev’s achievements demonstrate how AI can revolutionize the world of computer programming by uncovering faster and more efficient algorithms. By making these algorithms open-source, millions of developers and companies around the world can benefit from their improved performance.