
Illustration: Maura Losch/Axios
New AI-generated algorithms can find novel ways to perform fundamental computing tasks — like sorting data up to 70% faster than existing human-written code.
Why it matters: As computer chips approach their physical limits, computer scientists are searching for ways to optimize computer code to speed up computing.
- "We need to find new and innovative ways to optimize the computing stack on which all systems are run," says Daniel Mankowitz, a researcher with Google DeepMind and co-author of a paper published this week in Nature describing the work.
How it works: DeepMind's AlphaDev — a version of the AI system AlphaGo that plays Go, poker and other games — generated code for sorting three, four or five numbers by their size. Those algorithms are used for sorting longer lists, a fundamental operation in computing.
- AlphaDev writes code similar to how AlphaGo plays games — each move is the addition of an instruction to the algorithm.
- It then checks the output — sorted numbers — and is rewarded for correctly completing the task and how quickly it performs the function. The AI system learns from that reinforcement to build more efficient code.
Details: AlphaDev couldn't come up with a better code for sorting four elements — "it looks to be optimal," Mankowitz says — but it generated a code that knocked one instruction off the existing algorithm for sorting three numbers.
- Its codes for sorting five numbers required 42 and 43 instructions versus 46 for existing human-developed code, making it up to 70% faster than the fastest existing algorithm for the task.
- The algorithms were about 1.7% faster for lists of more 250,000 numbers.
But, but, but... "The programs that can be optimized by their system are still relatively small," Armando Solar-Lezama, a professor of computer science at MIT, wrote in an accompanying article.
- The system also uses only a subset of possible instructions and because it learns by considering at each turn all the possible outcomes of its move — and subsequent moves — it starts to learn more slowly when it reaches 297 instructions, MIT Tech Review's Will Douglas Heaven notes.
Where it stands: The code has been entered into the C++ library — the first change to the language's sorting algorithms in more than a decade.
- AlphaDev also generated faster hashing algorithms, which are used to retrieve and store information, that were also added to an open-source programming database.
- DeepMind estimates the sorting and hashing algorithms are now being used trillions of times each day.
The big picture: Generative AI tools are already being widely used by programmers in the field — raising concerns about code bloat and shoddy work that could create "technical debt" requiring expensive fixes, the WSJ's Isabelle Bousquette writes.
- But the AlphaDev approach is focused on producing code with very specific requirements and the algorithms can be proved to be correct, minimizing those risks, Solar-Lezama tells Axios.
What to watch: The AI system isn't going to make major improvements to top-of-the-line AI models without "significant additional research," Solar-Lezama says.
- But it could be used to "make improvements to the infrastructure used to train models in order to make it more efficient," he adds.
- Mankowitz says they want to try to use the approach to optimize the entire computing stack — from software and hardware to scheduling computing resources.