{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/learning-to-represent-programs-with-graphs","title":"Learning to Represent Programs with Graphs","arxiv_id":"1711.00740","date":"2017-11-01","proceeding":"ICLR 2018 1","authors":["Miltiadis Allamanis","Marc Brockschmidt","Mahmoud Khademi"],"abstract":"Learning tasks on source code (i.e., formal languages) have been considered\nrecently, but most work has tried to transfer natural language methods and does\nnot capitalize on the unique opportunities offered by code's known syntax. For\nexample, long-range dependencies induced by using the same variable or function\nin distant locations are often not considered. We propose to use graphs to\nrepresent both the syntactic and semantic structure of code and use graph-based\ndeep learning methods to learn to reason over program structures.\n  In this work, we present how to construct graphs from source code and how to\nscale Gated Graph Neural Networks training to such large graphs. We evaluate\nour method on two tasks: VarNaming, in which a network attempts to predict the\nname of a variable given its usage, and VarMisuse, in which the network learns\nto reason about selecting the correct variable that should be used at a given\nprogram location. Our comparison to methods that use less structured program\nrepresentations shows the advantages of modeling known structure, and suggests\nthat our models learn to infer meaningful names and to solve the VarMisuse task\nin many cases. Additionally, our testing showed that VarMisuse identifies a\nnumber of bugs in mature open-source projects.","url_abs":"http://arxiv.org/abs/1711.00740v3","url_pdf":"http://arxiv.org/pdf/1711.00740v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"learning-to-represent-programs-with-graphs","repo_url":"https://github.com/Microsoft/graph-based-code-modelling","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"tf","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"learning-to-represent-programs-with-graphs","repo_url":"https://github.com/microsoft/ptgnn","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[{"method_slug":"ggs-nns","method_name":"GGS-NNs"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1711.00740","mcp":null,"developers":"https://syntology.ai/developers"},"arxiv_metadata":null,"syntology_extracted_results":null}