Artificial Intelligence can compose songs, paint pictures, help in cancer therapy, drive cars and play games. It’s also starting to write code.
Does it mean that the days of human developers are already numbered?
When you look at tests of personal assistants such as Siri, Google Assistant or Cortana, you will discover that probably the most frequent request they hear is:
Tell me a joke.
Is that really all that Artificial Intelligence can do for us? Not at all. Its achievements are getting more impressive every day.
So before we tackle the question of Artificial Intelligence replacing software devs, let’s explore the achievements of AI thus far.
What can AI do?
Beat humans in board games and quizzes
In 1997 in New York City, the IBM computer Deep Blue won a chess match against Garry Kasparov. It was the first time when a machine defeated the world chess champion under tournament conditions.
In 2011, another IBM computer - Watson - took part in the television quiz show “Jeopardy” against former winners. Watson had to listen to questions and give answers in natural human language.
He was not connected to the internet.
However, he learned from 200 million pages of structured and unstructured content taking up four terabytes of disk storage. Watson won the first place prize of $1 million.
In March 2016, AlphaGo - a computer programme from Google DeepMind created to play the board game Go - beat Lee Sedol, the World Champion in Go. The man and the machine played a five-game tournament in Seoul. Lee Sedol won only the fourth game. In the rest, the machine proved superior.
Make medical discoveries
AI has already led to breakthroughs in medical diagnostics.
In 2013, Artificial Intelligence was put to work to detect breast cancer. A neural network was trained to find signs of cancer using tens of thousands of mammographic pictures of the disease.
But the neural network has learned that it is not so important to look for the tumors themselves, but rather some other modifications of the tissue which aren’t in the immediate vicinity of the tumor cells.
This was new knowledge to humankind. Until 2013, medicine didn’t know that.
Compose songs
Magenta is a project from the Google Brain team. It tries to answer the question: “Can we use machine learning to create compelling art and music? If so, how? If not, why not?”
The team works using TensorFlow - a machine learning library from Google. Have a listen to Magenta’s first computer-generated song - composed without any human assistance.
Paint pictures
In February 2016 in San Francisco, Google sold 29 paintings on a charity auction. All of them were made by Google’s Artificial Intelligence.
The event was called “DeepDream: The art of neural networks.” The paintings (masterpieces, if you ask me) went for more than 8000$, as The Wall Street Journal reports.
And that’s not all AI can do. It can also drive motorways, write poems, and much more.
What it can’t do is write code. Or can it?
AI for everyone
In December 2015, Google released the TensorFlow library to the public. Now it’s an open-source software for machine learning.
Why did Google give out this powerful piece of software for free? According to prof. Christian Bauckhage from Fraunhofer-Institut für Intelligente Analyse- und Informationssysteme, Germany (IAIS), you can find the answer in Google’s history. About 10 years ago, Google has open sourced the Android Operating System for smartphones. 10 years later, 80% of all the smartphones in the world run on Android.
"This is what they are trying to do right now. 10 years from now, the idea is that 80% of AI will run on Google TensorFlow," prof. Bauckhage said at the CeBIT Conference last year.
What happened after Google’s release? A few weeks later Microsoft open-sourced their Computational Network Toolkit AI - a deep learning framework now called the Microsoft Cognitive Toolkit.
After another few weeks, Facebook opened-sourced their own Artificial Intelligence libraries - Caffe2.
AI is writing code
In 2015 Andrej Karpathy, now director of AI at Tesla and a Stanford Computer Science Ph.D. student, used Recurrent Neural Networks to generate code. He took a Linux repository (all the source files and headers files), combined it into one giant document (it was more than 400 MB of code) and trained the RNN with this code.
He left it running for the night. In the morning, he got this:
Literally overnight, the AI generated code including functions and function decorations. It had parameters, variables, loops and correct indents. Brackets were opened and later closed. It even had comments.
The AI made some mistakes of course. Sometimes variables were never used. Other times, there were variables which were not declared earlier. But Karpathy was satisfied with the result.
‘The code looks really quite great overall. Of course, I don’t think it compiles but when you scroll through the generate code it feels very much like a giant C code base,’ Karpathy wrote on his blog.
The project is available on GitHub. It uses the Torch7 deep learning library. Here is the whole output file received by Karpathy.
DeepCoder
Microsoft and Cambridge University researchers have developed an Artificial Intelligence that can write code. The AI is called DeepCoder and it has the ability to learn.
DeepCoder can write working code after searching through a huge code database. It tries to make the best possible arrangement for the harvested code fragments and improves its efficiency over time.
This doesn’t mean the AI steals code, or copy-pastes it from existing software, or searches the internet for solutions. The authors of DeepCoder expect that it will be participating programming competitions in the near future .
According to Marc Brockschmidt of Microsoft Research, who is a part of the project, such system could be of great utility to non-coders. They only have to describe their program idea and wait for the system to create it.
‘We might end up having such system in the next few years. But for now, DeepCoder’s capabilities are limited to programs consisting of five lines of code,’ he said.
You can find DeepCoder’s documentation is here.
Python code made by AI
Since this is a primarily Python-focused blog, we would be remiss if we didn’t give you at least one Python example.
In June 2016, a French engineer by the nickname of BenjaminTD published a blog post in which he explained how he was “teaching an AI to write Python code with Python code”.
He used Long Short Term Memory (LSTM) - one of the most popular architectures of recurrent neural networks. He fed it with lots of Python code (using libraries such as Pandas, Numpy, Scipy, Django, Scikit-Learn, PyBrain, Lasagne, Rasterio). The combined file weighed 27MB.
The AI then generated its own code. It was defining inits:
...using boolean expressions:
...and creating arrays:
If you look at the arrays carefully, you will find a syntax error. Benjamin’s code is far from perfect. But the engineer thinks that it’s not bad for a network that had to learn everything from reading example code.
‘Especially considering that it is only trying to guess what is coming next character by character,’ he concludes his blog post.
Will AI replace programmers?
The Hollywood fiction of AI supplanting humans hasn’t come true yet. We are far from a 2001: A Space Odyssey scenarios of a rogue AI turning against its human masters and killing off space crews.
That does not stop filmmakers from generously employing the theme of AI rebellion in their works.
But can we be so sure that real-life AI can be controlled?
In 2016, Microsoft released a Twitter bot - Tay. It was designed to mimic the language patterns of a 19-year-old American girl, and to learn from interacting with human users of Twitter. After just 16 hours following its launch, Microsoft was forced to shut Tay down because the bot began to post offensive tweets.
That’s not the only AI issue on record. In early 2017, Facebook had to shut down its bots - Bob and Alice. They were created to perform conversations between human and computer. But when the bots were directed to talk with each other, they started to communicate in a way that was impossible for people to understand.
A few months later a Chinese chatbot - Baby Q - was switched off after it started to criticize the Chinese Communist Party. Baby Q called it "a corrupt and incompetent political regime".
So, is AI a threat or an opportunity? Elon Musk is known for his scepticism towards AI. His worry is what will happen when the machine becomes smarter than the human.
"Even in the benign scenario, if AI is much smarter than a person, what do we do? What job do we have?’" he asks.
There is no doubt that computers will be much better at programming in the near future than they are now. Which brings us to a quite scary conclusion.
"It’s just a matter of time until neural networks will produce useful code. So things are looking bleak for computer scientists like me" prof. Bauckhage believes.
But is the future really that dark? According to Armando Solar-Lezama of MIT, tools like DeepCoder do have the potential to automate code development, but AI isn’t going to take away the jobs of developers. Instead, a system based on program synthesis can be used to automate the tedious parts of code development while the developers focus on complex tasks.
There are already startups using automation to build ‘smart software’. Dev9 is a custom software development company based in Seattle focused on Java and JavaScript. Dev9 assembles teams that use artificial intelligence to develop custom software, eliminating strenuous processes and drastically reducing manual overhead. Will Iverson, its Chief Technology Officer, was asked if programmers need to be worried about being replaced by AI in the near future, and replied:
Eventually, yes. But by that point, society will be very used to dealing with that kind of societal change. The millions of paid drivers replaced by self-driving cars will have long since forced our political and economic systems to figure out how to deal with these transitions. We have joked around the office that software development will be one of the last professions left.Will Iverson, CTO at Dev9
Regardless of whether our worries are justified, the fact is that nearly a third of software developers fear that artificial intelligence will eventually take their jobs. In an Evans Data Corp.survey, 550 software programmers were asked about the most worrisome thing in their careers. The most common response (29%) was:
"I and my development efforts are replaced by artificial intelligence."
According to Janel Garvin, CEO of Evans Data, the thought of obsolescence due to A.I., "was also more threatening than becoming old without a pension, being stifled at work by bad management, or by seeing their skills and tools become irrelevant."
There is no doubt that AI technology will developing and grow smarter. Eventually it will become smarter than humans. How can we handle such a possibility? Stephen Hawking also sees a real danger that computers will develop intelligence. But he also offers advice:
"We urgently need to develop direct connections to the brain so that computers can add to human intelligence rather than be in opposition," Hawking says.