{"id":2262,"date":"2019-06-14T17:10:00","date_gmt":"2019-06-14T17:10:00","guid":{"rendered":"https:\/\/www.aiproblog.com\/index.php\/2019\/06\/14\/toward-artificial-intelligence-that-learns-to-write-code\/"},"modified":"2019-06-14T17:10:00","modified_gmt":"2019-06-14T17:10:00","slug":"toward-artificial-intelligence-that-learns-to-write-code","status":"publish","type":"post","link":"https:\/\/www.aiproblog.com\/index.php\/2019\/06\/14\/toward-artificial-intelligence-that-learns-to-write-code\/","title":{"rendered":"Toward artificial intelligence that learns to write code"},"content":{"rendered":"<p>Author: Kim Martineau | MIT Quest for Intelligence<\/p>\n<div>\n<p>Learning to code involves recognizing how to structure a program, and how to fill in every last detail correctly. No wonder it can be so frustrating.<\/p>\n<p>A new program-writing AI, <a href=\"https:\/\/arxiv.org\/pdf\/1902.06349.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">SketchAdapt<\/a>, offers a way out. Trained on tens of thousands of program examples, SketchAdapt learns how to compose short, high-level programs, while letting a second set of algorithms find the right sub-programs to fill in the details. Unlike similar approaches for automated program-writing, SketchAdapt knows when to switch from statistical pattern-matching to a less efficient, but more versatile, symbolic reasoning mode to fill in the gaps.<\/p>\n<p>\u201cNeural nets are pretty good at getting the structure right, but not the details,\u201d says <a href=\"https:\/\/people.csail.mit.edu\/asolar\/\">Armando Solar-Lezama<\/a>, a professor at MIT\u2019s <a href=\"https:\/\/www.csail.mit.edu\/\">Computer Science and Artificial Intelligence Laboratory<\/a> (CSAIL). \u201cBy dividing up the labor \u2014 letting the neural nets handle the high-level structure, and using a search strategy to fill in the blanks \u2014 we can write efficient programs that give the right answer.\u201d<\/p>\n<p>SketchAdapt is a collaboration between Solar-Lezama and <a href=\"https:\/\/web.mit.edu\/cocosci\/josh.html\">Josh Tenenbaum<\/a>, a professor at CSAIL and MIT\u2019s <a href=\"https:\/\/cbmm.mit.edu\/\">Center for Brains, Minds and Machines<\/a>. The work will be presented at the <a href=\"https:\/\/icml.cc\/\">International Conference on Machine Learning<\/a> June 10-15.<\/p>\n<p>Program synthesis, or teaching computers to code, has long been a goal of AI researchers. A computer that can program itself is more likely to learn language faster, converse fluently, and even model human cognition. All of this drew Solar-Lezama to the field as a graduate student, where he laid the foundation for SketchAdapt.<\/p>\n<p>Solar-Lezama\u2019s early work, <a href=\"https:\/\/people.csail.mit.edu\/asolar\/papers\/Solar-Lezama09.pdf\">Sketch<\/a>, is based on the idea that a program\u2019s low-level details could be found mechanically if a high-level structure is provided. Among other applications, Sketch inspired spinoffs to automatically grade programming homework and convert hand-drawn diagrams into code. Later, as neural networks grew in popularity, students from Tenenbaum\u2019s computational cognitive science lab suggested a collaboration, out of which SketchAdapt formed.<\/p>\n<p>Rather than rely on experts to define program structure, SketchAdapt figures it out using deep learning. The researchers also added a twist: When the neural networks are unsure of what code to place where, SketchAdapt is programmed to leave the spot blank for search algorithms to fill.<\/p>\n<p>\u201cThe system decides for itself what it knows and doesn\u2019t know,\u201d says the study\u2019s lead author, <a href=\"https:\/\/maxwellnye.github.io\/\">Maxwell Nye<\/a>, a graduate student in MIT\u2019s <a href=\"https:\/\/bcs.mit.edu\/\">Department of Brain and Cognitive Sciences<\/a>. \u00a0\u201cWhen it gets stuck, and has no familiar patterns to draw on, it leaves placeholders in the code. It then uses a guess-and-check strategy to fill the holes.\u201d<\/p>\n<p>The researchers compared SketchAdapt\u2019s performance to programs modeled after Microsoft\u2019s proprietary <a href=\"https:\/\/arxiv.org\/pdf\/1703.07469.pdf\">RobustFill<\/a> and <a href=\"https:\/\/arxiv.org\/pdf\/1611.01989.pdf\">DeepCoder<\/a> software, successors to Excel\u2019s FlashFill feature, which analyzes adjacent cells to offer suggestions as you type \u2014 learning to transform a column of names into a column of corresponding email addresses, for example. RobustFill uses deep learning to write high-level programs from examples, while DeepCoder specializes in finding and filling in low-level details.<\/p>\n<p>The researchers found that SketchAdapt outperformed their\u00a0reimplemented versions of RobustFill and DeepCoder at their respective specialized tasks.\u00a0SketchAdapt outperformed the\u00a0RobustFill-like program\u00a0at string transformations; for example, writing a program to abbreviate Social Security numbers as three digits, and first names by their first letter. SketchAdapt also did better than the\u00a0DeepCoder-like program\u00a0at writing programs to\u00a0transform\u00a0a list of numbers.\u00a0Trained\u00a0only\u00a0on examples of three-line list-processing programs, SketchAdapt was better able to transfer its knowledge to a new scenario and write\u00a0correct\u00a0four-line programs.<\/p>\n<p>In yet another task, SketchAdapt outperformed both programs at converting math problems from English to code, and calculating the answer.<\/p>\n<p>Key to its success is the ability to switch from neural pattern-matching to a rules-based symbolic search, says <a href=\"https:\/\/rishabhmit.bitbucket.io\/\">Rishabh Singh<\/a>, a former graduate student of Solar-Lezama\u2019s, now a researcher at Google Brain. \u201cSketchAdapt learns how much pattern recognition is needed to write familiar parts of the program, and how much symbolic reasoning is needed to fill in details which may involve new or complicated concepts.\u201d<\/p>\n<p>SketchAdapt is limited to writing very short programs. Anything more requires too much computation. Nonetheless, it\u2019s intended more to complement programmers rather than replace them, the researchers say. \u201cOur focus is on giving programming tools to people who want them,\u201d says Nye. \u201cThey can tell the computer what they want to do, and the computer can write the program.\u201d<\/p>\n<p>Programming, after all, has always evolved. When Fortran was introduced in the 1950s, it was meant to replace human programmers. \u201cIts full name was Fortran Automatic Coding System, and its goal was to write programs as well as humans, but without the errors,\u201d says Solar-Lezama. \u201cWhat it really did was automate much of what programmers did before Fortran. It changed the nature of programming.\u201d<\/p>\n<p>The study\u2019s other co-author is Luke Hewitt. Funding was provided by the U.S. Air Force Office of Scientific Research, MIT-IBM Watson AI Lab and U.S. National Science Foundation.<\/p>\n<\/div>\n<p><a href=\"http:\/\/news.mit.edu\/2019\/toward-artificial-intelligence-that-learns-to-write-code-0614\">Go to Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Author: Kim Martineau | MIT Quest for Intelligence Learning to code involves recognizing how to structure a program, and how to fill in every last [&hellip;] <span class=\"read-more-link\"><a class=\"read-more\" href=\"https:\/\/www.aiproblog.com\/index.php\/2019\/06\/14\/toward-artificial-intelligence-that-learns-to-write-code\/\">Read More<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":475,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[24],"tags":[],"_links":{"self":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts\/2262"}],"collection":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/comments?post=2262"}],"version-history":[{"count":0,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts\/2262\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/media\/472"}],"wp:attachment":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/media?parent=2262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/categories?post=2262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/tags?post=2262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}