Table of Contents
The "upstart" of the Alpha family discovers a faster sorting algorithm
Netizen: Not counting the discovery of a new sorting algorithm
Home Technology peripherals AI Reproduce the magic touch of AlphaGo back then! DeepMind's new AI discovered a 70% speed-up sorting algorithm, and the C++ library that hasn't been updated in ten years has been updated

Reproduce the magic touch of AlphaGo back then! DeepMind's new AI discovered a 70% speed-up sorting algorithm, and the C++ library that hasn't been updated in ten years has been updated

Jun 09, 2023 pm 09:59 PM
ai c++

DeepMind has once again appeared in Nature with blockbuster results!

This time, they have strengthened learning AI again and made new breakthroughs in the two most basic algorithms in the computer field:

One is the sorting algorithm, which has found the highest speed improvement 70% new implementation;

The other is the hashing algorithm, which also found a new way to increase the speed by 30%.

Reproduce the magic touch of AlphaGo back then! DeepMinds new AI discovered a 70% speed-up sorting algorithm, and the C++ library that hasnt been updated in ten years has been updated

Not only that, the method used by the AI ​​is called "recreating the magic touch of AlphaGo", which seems to be illegal, but actually defeats it in one fell swoop. That time with the human master Lee Sedol.

As soon as the news came out, it immediately detonated the academic circle. Some netizens called out:

I didn’t expect that such an ancient and basic algorithm could be further improved.

Reproduce the magic touch of AlphaGo back then! DeepMinds new AI discovered a 70% speed-up sorting algorithm, and the C++ library that hasnt been updated in ten years has been updated

It is precisely because of this latest achievement that the LLVM standard C library, which has not been updated for ten years, has been updated, and dozens of Billions of people will benefit.

Because, whether it is sorting or hashing, their application scenarios can be used in various scenarios from online shopping, cloud computing to supply chain management, etc., and they are called hundreds of millions of times every day!

However, as DeepMind said:

Don’t get too excited, the power of AI has just begun to be used to improve code efficiency.

Reproduce the magic touch of AlphaGo back then! DeepMinds new AI discovered a 70% speed-up sorting algorithm, and the C++ library that hasnt been updated in ten years has been updated

The "upstart" of the Alpha family discovers a faster sorting algorithm

This AI is called AlphaDev, and it belongs to the "upstart" of the Alpha family. And it is built based on AlphaZero (the chess AI that defeated the world champion in 2017).

Its discovery is not based on existing algorithms, but starts from the lowest level assembly instructions.

DeepMind researchers designed a single-player "assembly" game for it:

As long as you can search and select the appropriate instructions (process A in the figure below), it is correct and fast You can get rewards by arranging the data (process B in the figure below).

Reproduce the magic touch of AlphaGo back then! DeepMinds new AI discovered a 70% speed-up sorting algorithm, and the C++ library that hasnt been updated in ten years has been updated

But the challenge of this game is not only the size of the search space (the number of combinable instructions is equivalent to the number of particles in the universe), but also It lies in the nature of the reward function, because one wrong instruction may cause the entire algorithm to fail.

AlphaDev has two core components: learning algorithm and representation function.

Among them, the learning algorithm is mainly expanded on the powerful AlphaZero, which can combine DRL and random search optimization algorithms to conduct a huge amount of instruction searches; the main representation function is based on Transformer, which can capture assembly The underlying structure of a program and expressed as a special sequence.

As AlphaDev continues to fight monsters and upgrade, researchers will also limit the number of steps it can perform and the length of the sequence to be sorted.

In the end, AlphaDev discovered a new sorting algorithm:

If the sequence is short, it can increase the speed by 70% compared to the human baseline sorting algorithm; if the sequence length exceeds 25,000 elements, the increase is 1.7%.

Short sequence sorting is widely used in practice, especially as an important component of larger sorting functions and is called many times. As long as short sequences are improved, the sorting speed of all sequences can be improved. )

Specifically, the innovation of this algorithm mainly lies in two instruction sequences:

(1) AlphaDev Swap Move (exchange move)
(2) AlphaDev Copy Move (copy move) )

As shown in the figure below, the left side is the original sort3 implementation using min(A,B,C), and the right side is the implementation of "AlphaDev Swap Move", which only requires min(A,B). It can be found that one step of instructions can be omitted, and only the minimum values ​​of A and B need to be calculated.

Reproduce the magic touch of AlphaGo back then! DeepMinds new AI discovered a 70% speed-up sorting algorithm, and the C++ library that hasnt been updated in ten years has been updated

The author said that this novel method is reminiscent of AlphaGo's "Move 37" - a counterintuitive move that directly defeated the legendary Go player Lee Sedol, shocking the audience.

Similarly, AlphaDev skips a step by swapping and copying moves, achieving the goal in a way that seems wrong but is actually a shortcut.

As shown in the figure below, in the algorithm for sorting 8 elements, AlphaDev also uses "AlphaDev Copy Move" to replace the changes in the original implementation with max (B, min (A, C)) It is a complex max (B, min (A, C, D)) instruction, and the total number of instructions of the entire algorithm is also reduced by one step.

Reproduce the magic touch of AlphaGo back then! DeepMinds new AI discovered a 70% speed-up sorting algorithm, and the C++ library that hasnt been updated in ten years has been updated

After discovering a faster sorting algorithm, the author also tried the hash algorithm with AlphaDev to prove its versatility.

The results did not disappoint, AlphaDev also achieved a 30% speed increase in the length range of 9-16 bytes.

Like the sorting algorithm, they have integrated the new method into the Abseil library, which is now available to millions of developers around the world.

Finally, the author stated that the implementation of two new algorithms shows that AlphaDev has a strong ability to discover original solutions, and will make us further think about how to improve basic algorithms in the computer field.

However, due to the limitations of the assembly language used in this study, they next plan to try AlphaDev's ability to optimize algorithms in high-level languages ​​(such as C).

Netizen: Not counting the discovery of a new sorting algorithm

Many people expressed great excitement about this achievement.

As this netizen said:

After AlphaGo amazed the world, what else can reinforcement learning do? Can anything of practical significance be done? This is the answer.

Reproduce the magic touch of AlphaGo back then! DeepMinds new AI discovered a 70% speed-up sorting algorithm, and the C++ library that hasnt been updated in ten years has been updated

But this time, many people pointed out that DeepMind seemed to be suspected of exaggerating the title.

It calculates algorithm delay, not time complexity in the traditional sense. If you really calculate the time complexity, the data may not look good.

Its improvement is not in the sorting algorithm itself, but in new sorting optimization for modern CPUs (especially for short sequences). This approach is actually very common. For example, libraries such as FFTW and ATLAS have adopted this method.

Reproduce the magic touch of AlphaGo back then! DeepMinds new AI discovered a 70% speed-up sorting algorithm, and the C++ library that hasnt been updated in ten years has been updated

Agreed, they just found a faster machine optimization for a specific CPU, not a new sorting algorithm , the method itself is cool, but not yet groundbreaking research.

Reproduce the magic touch of AlphaGo back then! DeepMinds new AI discovered a 70% speed-up sorting algorithm, and the C++ library that hasnt been updated in ten years has been updated

What do you think?

Paper address: https://www.php.cn/link/a3fefe83288ecb0e40ebe40b2bde29fe
Official blog: https://www.php.cn/link/f5b2aa928f940f3f09a0d14f45a27875

Reference link:
[1]https://www.php.cn/link/5383c7318a3158b9bc261d0b6996f7c2
[2]https:// www.php.cn/link/ecf9902e0f61677c8de25ae60b654669
[3]https://www.php.cn/link/0383314bf626052313b8275638fcccce

The above is the detailed content of Reproduce the magic touch of AlphaGo back then! DeepMind's new AI discovered a 70% speed-up sorting algorithm, and the C++ library that hasn't been updated in ten years has been updated. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

git software installation git software installation Apr 17, 2025 am 11:57 AM

Installing Git software includes the following steps: Download the installation package and run the installation package to verify the installation configuration Git installation Git Bash (Windows only)

How to solve the complexity of WordPress installation and update using Composer How to solve the complexity of WordPress installation and update using Composer Apr 17, 2025 pm 10:54 PM

When managing WordPress websites, you often encounter complex operations such as installation, update, and multi-site conversion. These operations are not only time-consuming, but also prone to errors, causing the website to be paralyzed. Combining the WP-CLI core command with Composer can greatly simplify these tasks, improve efficiency and reliability. This article will introduce how to use Composer to solve these problems and improve the convenience of WordPress management.

How to solve SQL parsing problem? Use greenlion/php-sql-parser! How to solve SQL parsing problem? Use greenlion/php-sql-parser! Apr 17, 2025 pm 09:15 PM

When developing a project that requires parsing SQL statements, I encountered a tricky problem: how to efficiently parse MySQL's SQL statements and extract the key information. After trying many methods, I found that the greenlion/php-sql-parser library can perfectly solve my needs.

How to solve complex BelongsToThrough relationship problem in Laravel? Use Composer! How to solve complex BelongsToThrough relationship problem in Laravel? Use Composer! Apr 17, 2025 pm 09:54 PM

In Laravel development, dealing with complex model relationships has always been a challenge, especially when it comes to multi-level BelongsToThrough relationships. Recently, I encountered this problem in a project dealing with a multi-level model relationship, where traditional HasManyThrough relationships fail to meet the needs, resulting in data queries becoming complex and inefficient. After some exploration, I found the library staudenmeir/belongs-to-through, which easily installed and solved my troubles through Composer.

Install git software Install git software Apr 17, 2025 am 11:00 AM

The Git software can be installed in the following steps: Download the Git installer. Run the installer. Verify the Git installation. Configure Git (user name, email). Set the default editor (optional). Clone or create a repository.

git software installation tutorial git software installation tutorial Apr 17, 2025 pm 12:06 PM

Git Software Installation Guide: Visit the official Git website to download the installer for Windows, MacOS, or Linux. Run the installer and follow the prompts. Configure Git: Set username, email, and select a text editor. For Windows users, configure the Git Bash environment.

How to solve the complex problem of PHP geodata processing? Use Composer and GeoPHP! How to solve the complex problem of PHP geodata processing? Use Composer and GeoPHP! Apr 17, 2025 pm 08:30 PM

When developing a Geographic Information System (GIS), I encountered a difficult problem: how to efficiently handle various geographic data formats such as WKT, WKB, GeoJSON, etc. in PHP. I've tried multiple methods, but none of them can effectively solve the conversion and operational issues between these formats. Finally, I found the GeoPHP library, which easily integrates through Composer, and it completely solved my troubles.

Solve CSS prefix problem using Composer: Practice of padaliyajay/php-autoprefixer library Solve CSS prefix problem using Composer: Practice of padaliyajay/php-autoprefixer library Apr 17, 2025 pm 11:27 PM

I'm having a tricky problem when developing a front-end project: I need to manually add a browser prefix to the CSS properties to ensure compatibility. This is not only time consuming, but also error-prone. After some exploration, I discovered the padaliyajay/php-autoprefixer library, which easily solved my troubles with Composer.

See all articles