What happens when computers program themselves?

Artificial intelligence could transform our world. But first, ERC researchers are trying to answer the basic questions – about life and the universe – that AI poses


Smart robots can work together to get a job done – better than humans? Mauro Birattari’s lab at Université Libre de Bruxelles is on it.

Can computers learn to code?

Software is eating the world, venture capitalist Marc Andreessen noted in 2011. That was six years after renown American software engineer Grady Booch estimated that more than one trillion lines of code had already been written, with a further 30 billion lines added each year. Today, those figures are likely to be much bigger still. Whereas Microsoft Office 2001 had about 25 million lines of code, Microsoft Office 2013 has about 45 million.

Source: Information is Beautiful

The steady rise in the amount of code reflects the growing complexity and richness of software – with more programming languages and libraries of code. For developers, that also means headaches. “As it becomes harder to utilise the (code) libraries, people make more mistakes,” says Vechev, the ETH Zurich researcher.

But help is at hand. Much of the software developed in recent years is open source, meaning that the code is publicly available and viewable. This has ushered in the era of “Big Code”, a shorthand term for this vast and growing library of open source code. This library can be used to train computers to identify patterns in software, just as advanced web services, such as Google Photos or Google Translate, process millions of samples to learn to identify particular images or phrases.
In a project funded by the ERC, Vechev and his team are harnessing Big Code. “We are building an AI system that can learn from lots of data showing how existing programmers and developers write code and how they fix code.”

What’s it take to make a computer smart?

Brave new world: A computer can even bore itself... (Courtesy: Cornell Creative Machines Lab)

Science often advances in trends – and artificial intelligence is today an uber-trend among eager computer scientists and engineers around the world. One measure: AI patenting is way up – with an average annual growth rate of 43 per cent, according to the European Patent Office.

But what’s involved in creating AI? Experts in artificial intelligence have broken the job of computerised thinking into several related tasks. First, a computer needs information to work on and a way to store it. Then it needs a way to reason about the information, and to learn how to perform tasks (the “machine learning” part of AI). And, of course, it needs a way to talk to the bothersome humans who keep asking it questions.

Want to dive deeper into the subject? Here’s a good blog by Sridhar Mahadevan, a senior researcher at software firm Adobe Systems, with a reading list.

To do this, the computer also has to estimate how good a particular piece of code might be. “It is more complex than simply capturing patterns” in the software, notes Vechev. “The solution also uses probabilistic methods: we can attach a probability that this is likely to be good code for a particular task.” That could lead to software solutions that are difficult or impossible to develop through traditional approaches.

Vechev says his ERC-funded project takes advantage of a confluence of three factors: the growing body of Big Code, the evolution of machine learning algorithms and recent progress in automated reasoning engines – software a computer uses to think its way through a problem. As there is no such thing as complete information or data, machines need to be able to reason to fill in the blanks. For example, if a machine was asked to find out in what country Dom Perignon is made, the system would need to be able to reason that Dom Perignon is a type of champagne, champagne is only produced in the region of Champagne, which lies in the country of France, as explained by AI startup company Grakn AI.

The specific tasks Vechev’s team is working on right now are fairly basic. “Within the timeframe of this project, we think this is achievable for small low-level tasks, such as a search for a graph, sorting a set of numbers in a very efficient way or writing a program that manipulates pictures, modifying or cropping an image and saving the result,” Vechev notes. In the long-term, he is hoping his team can create a system that is able to write sophisticated code from high-level descriptions. “If the system could beat an expert human in a programing competition, that would be success,” he says.
From there, managers might be able to give instructions to computers and robots, just as they do to other human beings, rather than meticulously writing precise code.  This could trigger a paradigm shift in the way software is created, with implications for millions of developers worldwide. It could also help to streamline and improve the development of machine learning, natural language processing, programming languages and software engineering.

To commercialise his research, Vechev and his former PhD student Veselin Raychev have co-founded an ETH spin-off, called DeepCode, which is developing a new AI-based system for automating code review.

With work like this, some analysts see AI entering a “third wave” of development. In the first wave, in the 1970s, hard-coded AI systems generated decisions that could be interpreted and explained by human beings, but couldn’t deal with uncertainty and noise. The second, current wave of AI solutions, involving deep learning, has its own limitations. “They can be used to learn how to drive a car, for example, but they are not explainable,” says Vechev. “But the system also needs to be interpretable: Code development needs to be transparent. Our Big Code project is an example of a third generation system in that it is a step towards a general AI system, more like the human brain.”

Can robots be delicate?

École polytechnique fédérale de Lausanne

Swiss researchers visit a watch-making school, to teach robots to think like a craftsman

Could robots put Swiss watchmakers out of business? Not for a long time. In fact, robots really struggle to emulate the kind of delicate, fine-tuned manipulation to be found in industries like watchmaking.


Researchers wire up the skilled hands of a watchmaker.

It takes four years for human apprentices to learn the intricate skills required to assemble a hand-made Swiss watch. That’s because they are working at a scale where their normal sense of touch alone isn’t sufficient to guide the precise manoeuvres and fine manipulation required to build the tiny mechanisms. Today, that kind of delicacy is beyond any robot. They don’t, for example, typically manipulate flexible materials, pack fragile goods such as wine glasses, or perform other tasks that require humans to “feel” their way.

How to close the dexterity gap between humans and robots is the subject of an ERC-funded research project being run by Aude Billard, a professor at the Swiss Federal Institute of Technology in Lausanne. “We roboticists need to understand how humans learn to do tasks that go beyond your natural sense of touch,” says Billard. “In the case of watchmaking, humans manage to control micro-level displacements and forces with precision, which is challenging given that the human sensory system is incredibly noisy,” she adds, referring to the continual input we get from our senses. The questions puzzling Billard are: How do humans learn to place their arms, fingers and joints and constrain them to overcome this sensory-motor noise? How do they manage to model the world in which they’re working?

One hypothesis is that we simplify. For instance, we may learn to forbid our joints to move in a certain way, only allowing the tactile impact to happen in specific directions. And we appear to filter our sensory inputs, focusing on what’s important for the task at hand.  Billard notes that beginner drivers tend to pay attention to everything that is happening around the vehicle, while experienced drivers have learnt that not everything matters; they subconsciously apply the right amount of pressure to the brake and accelerator pedals to adapt to each situation.

The art of watches

What’s so hard about making a watch? The graph here, based on Billard’s studies, shows the difference between a senior and junior watchmaker: the skilled worker makes fewer time-consuming mistakes.

Here, Billard’s team explains their work in more detail (in French.)

This diagramme breaks down the task of assembling a watch into different actions. Most of the time goes into preparation.

So that brings her to the watch industry. Her research team is following a cohort of apprentices at one of the most famous watchmaking schools in Switzerland, as they gradually learn, through repetition, to achieve the right level of precision in each task without breaking the delicate mechanisms in the watch. Billard’s team has mounted sensors on the apprentices to measure the position of the fingers and the forces applied. It also plans to employ a device to monitor the electrical activity in the muscles in the apprentice’s forearms.

Of course, her aim is not to disrupt her country’s most famous industry. ”We are not interested in teaching robots how to make watches,” Billard stresses. “We are most interested in how robots can learn to implement that kind of process and which variables you need to learn to control precisely.”

Billard’s research team is also developing software that can enable robots to interact with moving objects, so they can, for example, learn to catch items by achieving the right orientation. Although assembling a watch and catching a ball may seem like very different skills, Billard says they both rely heavily on preparation and assuming the right body posture – something human beings learn with practice.

“Skilled watchmakers spend about 80 per cent of the time spent on a task just placing the finger correctly,” she explains. “Doing the task itself is very quick. The same is true of catching an object. Preparation is important.”

The ultimate goal is to create robots that can learn many different tasks, rather than being hard-wired to perform a specific job. “We want to reach a point where robots have a flexible brain, so that when they get out of the factory, they learn whatever task you want them to do,” Billard says.

Read next on ERC=Science2: Can computers really do math?

Sign up for the newsletter to get the next instalment – or follow us on Twitter and Facebook.