[AI system implements real self-programming for the first time] using genetic algorithm to complete the explosion of junior programmers-Alibaba Cloud Developer Community

This article is about by using genetic algorithms, the primary programmers have been released, automatic AI programming has always been the dream of computer scientists. At present, the achievements in this aspect are still very limited, such as letting AI automatically complete the programming language or executing simple addition programs. The work we are going to introduce today claims to be the first machine learning system "AI Programmer" that can automatically generate complete software programs ".

Researchers said that they used this system to prove the long-standing assumption that fully functional programs can indeed be automatically generated. Specific to this work, AI Programmer use genetic algorithms in machine learning to simulate complex instructions. Although the program generated by AI Programmer now has the same complexity as the results written by novice programmers. However, researchers believe that the program compiled by AI Programmer can completely go beyond the traditional category and is not limited by human time and wisdom.

AI programs only find the most suitable point between test complexity and computing resources. In other words, the possibility is unlimited.

The researchers also said that we need to rethink and design a new machine-oriented programming language, because the current programming language is human-oriented and does not apply to ML-based programming. "When considering the future of ML driver generation, we need to give up and reconsider the method of creating typical programming languages."

the researchers wrote that only in this way can we begin to imagine a new future of computer software development driven by AI systems and guided by human creativity and design.

AI Programmer software architecture. As shown in the figure, there are very few parts driven by human beings. You only need to input instructions at the beginning and then receive functions that are applicable to a task. The rest parts are all completed by machines.

AI Programmer: using genetic algorithm to automatically generate programs can theoretically complete all types of tasks

according to the paper, researchers chose a non-type programming language, including only 8 instructions to drive AI Programmer generation software.

The programming language used by AI Programmer is Turing-complete, as shown in Table 1. Theoretically, Turing complete programming language can handle any programming task under the condition of unlimited time and memory. In essence, any programming language with this characteristic can solve a large number of programming problems. Similarly, the software generated by AI Programmer can complete all tasks.

With this guarantee, let's look at the core of AI Programmer-genetic algorithm.

To use genetic algorithms to generate software programs, you must first create a genome. A genome is a group of genes that are combined together as a single unit. The genome of the AI Programmer is encoded as a floating point group, and the fixed value range of each unique instruction is between 0 and 1, as shown in the gene range column in Table 1 above.

After creating the genome, the AI Programmer converts it into the corresponding program, executes it, and allocates suitability for the result program according to the output of the program. The closer the generated program is to solve the provided tasks, the higher the fitness and the more likely it is to continue the next generation of evolution. In each generation, AI Programmer use random selection and crossover and mutation to create subprograms, which contain slight random disturbances and may solve target tasks with better genomes than their parents.

Figure 3 shows an example of constructing a genome from a floating-point group. Each value range maps to a specific instruction in the programming language. Initially, these values are random, causing the generated program to fail to run normally. However, one or two of them must be able to run and execute some effective instructions. The more successful a program is executed, the more likely it is to continue using the code and realize more successful future generations.

In order to create offspring, parents give part of their genes to their children, and this process is shown in figure 4. In addition to inheriting parents' programming instructions, each child may also encounter mutations, that is, adding controlled but random disturbances to specific genes. This causes the value of a specific gene to be modified, making the obtained programming instructions change, thus changing the whole program.

Executable programs are ranked according to their execution, as shown in figure 5. Among them, specific programs will be immediately removed from the genome pool, and successful programs will be pushed forward to produce new offspring.

AI Programmer result: output "Hello World", reverse string, plus or minus multiplication, output Fibonacci sequence......

AI Programmer consists of a modular framework designed by C#.NET. Including engines running genetic algorithms, genome encoders and decoders, sandbox interpreters for executing analog programs, and compilers for converting code into binary executable files. Although C# was initially used in the design of AI Programmer, it should be noted that the design principle is not limited to the use of C#.

Researchers pointed out that AI Programmer adaptive test software framework is scalable and has been developed. Users can design countless customized software by themselves, and finally guide the generation of genetic algorithm (GA) and software program evolution of the system.

If the target program aims to generate a string, such as "Hello World" (see the above figure), the test score may be a number in the string. However, since AI Programmer generates code at the byte level, the incremental difference of the output characters should be taken into account in the test score.

Researchers said I, they can use AI Programmer to generate many software programs. Table 2 shows the list of generated programs.

At first, researchers asked AI Programmer to generate a very simple program to output "hi". After 5700 generations, the test is successful. The generated code is shown in Figure 9.

After 580 to 900 generations, "hello world" is generated, as shown in Figure 10.

After 6,057,200 generations, AI Programmer successfully generated "I love all humans", as shown in Figure 11.

AI Programmer program that generates a reverse string. The generated code is shown in Figure 13.

AI Programmer can generate addition program after 92,400 generations; Generate subtraction program after 177,900 generations, as shown in Figure 15.

The generating program shown in Figure 16 can output Fibonacci sequence from two initial input values.

Paper: AI Programmer, using genetic algorithm to automatically create software programs

in this article, we introduce the first machine learning (ML) system that can automatically generate complete software programs, with minimal human participation in the whole process. This system is called "AI Programmer", which takes genetic algorithm (GA) as the core and closely constrained programming language to minimize the overhead of ML search space. The novel part of AI Programmer originates from (I) unique system design, including embedded hand-crafted interpreter for efficiency and safety, and (ii) enhancement of genetic algorithms, randomized binding of instruction-gene and programming language-specific genome construction and elimination technologies are included. We introduced the system design of AI Programmer in detail, the working principle of the system in detail, and the experimental data using mainstream CPU to demonstrate its software generation function and performance.

Original release date: 2017-09-20 compilation: Wen Fei, Chang Peiqi this article is from xinzhiyuan, a partner of Yunqi community. For more information, please pay attention to the original link of "AI_era" WeChat public account

Selected, One-Stop Store for Enterprise Applications
Support various scenarios to meet companies' needs at different stages of development

Start Building Today with a Free Trial to 50+ Products

Learn and experience the power of Alibaba Cloud.

Sign Up Now