Microsoft’s AI is Learning to Write Code by Itself, Not Steal It

Volodymyr Kyrylyuk/Shutterstock.com

The algorithm would be able to augment its own ability by also looking at potential combinations of code for how a problem could be solved.

What if instead of searching through menus within programs like Microsoft Excel, our computers could understand the problem we’re trying to solve and write the software to solve it? It’s a hyper-futuristic idea, but one that has recently seen progress from Microsoft Research and the University of Cambridge.

In a November 2016 paper, which gained notoriety after being accepted into one of the year’s largest artificial intelligence conferences, Microsoft and Cambridge built an algorithm capable of writing code that would solve simple math problems. The algorithm, named DeepCoder, would be able to augment its own ability by also looking at potential combinations of code for how a problem could be solved. (It’s a bit complicated; we’ll break it down later.)

However, this doesn’t mean it steals code, or copy and pastes it from existing software, or searches the internet for solutions, as some reports have claimed.

“We’re targeting the people who can’t or don’t want to code, but can specify what their problem is,” says Marc Brockschmidt of Microsoft Research, a co-author of the paper, likening the work to Excel formulas that could take simple commands to solve for answers without being given the mathematical equation.

The system can be broken down into two distinct parts: the code-writing algorithm, and the mechanism to search through potential code.

Automated Code

The code-writing algorithm doesn’t work simply, but here’s how to think of it in simple terms.

A math problem has inputs and outputs—or the numbers you have and the number you need to calculate. The researchers took simple problems that had been solved with very basic bits of code, and showed the algorithm the inputs, outputs, and the code used to solve them.

Think of it like a tower of blocks. Researchers showed the algorithm the building blocks, and then the finished picture of what the tower should eventually look like. But the algorithm needs to know how to line up each block’s edges and make them stand on top of each other. While that might be easy for humans to figure out, it’s a tough problem for machines, which have no idea about gravity and why large blocks should support smaller ones.

But if machines are shown how blocks stack and fit together to eventually resemble the completed tower, by seeing hundreds or thousands of towers built, then they’ll be able to build towers with similarly shaped blocks. In terms of DeepCoder, the blocks are little bits of code.

When asked to solve a new problem, instead of using code that worked before, the algorithm predicts what code would have been used to solve similar problems it has seen before, and in what order.

Entire programming languages would be far too complex for these algorithms, so the Microsoft and Cambridge team made a smaller language, called a domain-specific language, like a toddler’s set of blocks. The system was able to solve simple programming challenges online, ranging from about 3-6 lines of code. The problems were descriptions of mathematical scenarios, plus inputs.

A World of Possibilities

To augment its ability to write code, DeepCoder also has the ability to scour potential code for a solution that could work. It’s not scanning popular code repositories like StackOverflow or GitHub for a solution, although the authors would love for that to happen in the future.

“We look at all possible programs you could write with this language under a certain length,” Brockschmidt said. “Computers are very good at searching through these things.”

He likens the task to trying to build a sentence about a fox jumping over a dog with only a few words and no knowledge of language.

You might start out with “Fox fox fox fox fox fox fox fox fox,” then “Fox fox fox fox fox fox fox fox dog,” and then on and on, until the proper sentence emerges. Another way to think about this is the “infinite monkey theorem,” according to Salesforce AI researcher Stephen Merity, in which an infinite number of monkeys typing for an infinite amount of time would produce Shakespeare. It’s the same thing here, except the monkey’s keyboards type blocks of code instead of letters.

But the ability to search through all the variations of programs and find the correct one is the team’s real contribution: The algorithm predicts which bits of code are most likely to be used to solve a problem, and then looks at those solutions first. If the algorithm finds one, the problem is seen as solved and it learns a little more about what proper code looks like.

Searching for code sounds like what humans do—going online to find a few lines of code that solves their problem—but it’s really just the closest term to describe the algorithm’s process of generating and sorting code. If a human were to do what the AI does, it would be like typing every combination of code they can think of, and then copying and pasting the code they just wrote into a new file and seeing if it works.

In the future, the Microsoft and Cambridge team says they want this system to understand the nuances of complete coding languages, and be able to recognize good code online.

X
This website uses cookies to enhance user experience and to analyze performance and traffic on our website. We also share information about your use of our site with our social media, advertising and analytics partners. Learn More / Do Not Sell My Personal Information
Accept Cookies
X
Cookie Preferences Cookie List

Do Not Sell My Personal Information

When you visit our website, we store cookies on your browser to collect information. The information collected might relate to you, your preferences or your device, and is mostly used to make the site work as you expect it to and to provide a more personalized web experience. However, you can choose not to allow certain types of cookies, which may impact your experience of the site and the services we are able to offer. Click on the different category headings to find out more and change our default settings according to your preference. You cannot opt-out of our First Party Strictly Necessary Cookies as they are deployed in order to ensure the proper functioning of our website (such as prompting the cookie banner and remembering your settings, to log into your account, to redirect you when you log out, etc.). For more information about the First and Third Party Cookies used please follow this link.

Allow All Cookies

Manage Consent Preferences

Strictly Necessary Cookies - Always Active

We do not allow you to opt-out of our certain cookies, as they are necessary to ensure the proper functioning of our website (such as prompting our cookie banner and remembering your privacy choices) and/or to monitor site performance. These cookies are not used in a way that constitutes a “sale” of your data under the CCPA. You can set your browser to block or alert you about these cookies, but some parts of the site will not work as intended if you do so. You can usually find these settings in the Options or Preferences menu of your browser. Visit www.allaboutcookies.org to learn more.

Sale of Personal Data, Targeting & Social Media Cookies

Under the California Consumer Privacy Act, you have the right to opt-out of the sale of your personal information to third parties. These cookies collect information for analytics and to personalize your experience with targeted ads. You may exercise your right to opt out of the sale of personal information by using this toggle switch. If you opt out we will not be able to offer you personalised ads and will not hand over your personal information to any third parties. Additionally, you may contact our legal department for further clarification about your rights as a California consumer by using this Exercise My Rights link

If you have enabled privacy controls on your browser (such as a plugin), we have to take that as a valid request to opt-out. Therefore we would not be able to track your activity through the web. This may affect our ability to personalize ads according to your preferences.

Targeting cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising.

Social media cookies are set by a range of social media services that we have added to the site to enable you to share our content with your friends and networks. They are capable of tracking your browser across other sites and building up a profile of your interests. This may impact the content and messages you see on other websites you visit. If you do not allow these cookies you may not be able to use or see these sharing tools.

If you want to opt out of all of our lead reports and lists, please submit a privacy request at our Do Not Sell page.

Save Settings
Cookie Preferences Cookie List

Cookie List

A cookie is a small piece of data (text file) that a website – when visited by a user – asks your browser to store on your device in order to remember information about you, such as your language preference or login information. Those cookies are set by us and called first-party cookies. We also use third-party cookies – which are cookies from a domain different than the domain of the website you are visiting – for our advertising and marketing efforts. More specifically, we use cookies and other tracking technologies for the following purposes:

Strictly Necessary Cookies

We do not allow you to opt-out of our certain cookies, as they are necessary to ensure the proper functioning of our website (such as prompting our cookie banner and remembering your privacy choices) and/or to monitor site performance. These cookies are not used in a way that constitutes a “sale” of your data under the CCPA. You can set your browser to block or alert you about these cookies, but some parts of the site will not work as intended if you do so. You can usually find these settings in the Options or Preferences menu of your browser. Visit www.allaboutcookies.org to learn more.

Functional Cookies

We do not allow you to opt-out of our certain cookies, as they are necessary to ensure the proper functioning of our website (such as prompting our cookie banner and remembering your privacy choices) and/or to monitor site performance. These cookies are not used in a way that constitutes a “sale” of your data under the CCPA. You can set your browser to block or alert you about these cookies, but some parts of the site will not work as intended if you do so. You can usually find these settings in the Options or Preferences menu of your browser. Visit www.allaboutcookies.org to learn more.

Performance Cookies

We do not allow you to opt-out of our certain cookies, as they are necessary to ensure the proper functioning of our website (such as prompting our cookie banner and remembering your privacy choices) and/or to monitor site performance. These cookies are not used in a way that constitutes a “sale” of your data under the CCPA. You can set your browser to block or alert you about these cookies, but some parts of the site will not work as intended if you do so. You can usually find these settings in the Options or Preferences menu of your browser. Visit www.allaboutcookies.org to learn more.

Sale of Personal Data

We also use cookies to personalize your experience on our websites, including by determining the most relevant content and advertisements to show you, and to monitor site traffic and performance, so that we may improve our websites and your experience. You may opt out of our use of such cookies (and the associated “sale” of your Personal Information) by using this toggle switch. You will still see some advertising, regardless of your selection. Because we do not track you across different devices, browsers and GEMG properties, your selection will take effect only on this browser, this device and this website.

Social Media Cookies

We also use cookies to personalize your experience on our websites, including by determining the most relevant content and advertisements to show you, and to monitor site traffic and performance, so that we may improve our websites and your experience. You may opt out of our use of such cookies (and the associated “sale” of your Personal Information) by using this toggle switch. You will still see some advertising, regardless of your selection. Because we do not track you across different devices, browsers and GEMG properties, your selection will take effect only on this browser, this device and this website.

Targeting Cookies

We also use cookies to personalize your experience on our websites, including by determining the most relevant content and advertisements to show you, and to monitor site traffic and performance, so that we may improve our websites and your experience. You may opt out of our use of such cookies (and the associated “sale” of your Personal Information) by using this toggle switch. You will still see some advertising, regardless of your selection. Because we do not track you across different devices, browsers and GEMG properties, your selection will take effect only on this browser, this device and this website.