{"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/retrieval-based-neural-code-generation","title":"Retrieval-Based Neural Code Generation","arxiv_id":"1808.10025","date":"2018-08-29","proceeding":"EMNLP 2018 10","authors":["Shirley Anugrah Hayati","Raphael Olivier","Pravalika Avvaru","Pengcheng Yin","Anthony Tomasic","Graham Neubig"],"abstract":"In models to generate program source code from natural language, representing\nthis code in a tree structure has been a common approach. However, existing\nmethods often fail to generate complex code correctly due to a lack of ability\nto memorize large and complex structures. We introduce ReCode, a method based\non subtree retrieval that makes it possible to explicitly reference existing\ncode examples within a neural code generation model. First, we retrieve\nsentences that are similar to input sentences using a dynamic-programming-based\nsentence similarity scoring method. Next, we extract n-grams of action\nsequences that build the associated abstract syntax tree. Finally, we increase\nthe probability of actions that cause the retrieved n-gram action subtree to be\nin the predicted code. We show that our approach improves the performance on\ntwo code generation tasks by up to +2.6 BLEU.","url_abs":"http://arxiv.org/abs/1808.10025v1","url_pdf":"http://arxiv.org/pdf/1808.10025v1.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":"retrieval-based-neural-code-generation","repo_url":"https://github.com/sweetpeach/ReCode","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"none","reach":{"status":"ok"}}],"tasks":[{"task_slug":"code-generation","task_name":"Code Generation"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"sentence","task_name":"Sentence"},{"task_slug":"sentence-similarity","task_name":"Sentence Similarity"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1808.10025","mcp":null,"developers":"https://syntology.ai/developers"},"arxiv_metadata":null,"syntology_extracted_results":null}