{"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/code2seq-generating-sequences-from-structured","title":"code2seq: Generating Sequences from Structured Representations of Code","arxiv_id":"1808.01400","date":"2018-08-04","proceeding":"ICLR 2019 5","authors":["Uri Alon","Shaked Brody","Omer Levy","Eran Yahav"],"abstract":"The ability to generate natural language sequences from source code snippets\nhas a variety of applications such as code summarization, documentation, and\nretrieval. Sequence-to-sequence (seq2seq) models, adopted from neural machine\ntranslation (NMT), have achieved state-of-the-art performance on these tasks by\ntreating source code as a sequence of tokens. We present ${\\rm {\\scriptsize\nCODE2SEQ}}$: an alternative approach that leverages the syntactic structure of\nprogramming languages to better encode source code. Our model represents a code\nsnippet as the set of compositional paths in its abstract syntax tree (AST) and\nuses attention to select the relevant paths while decoding. We demonstrate the\neffectiveness of our approach for two tasks, two programming languages, and\nfour datasets of up to $16$M examples. Our model significantly outperforms\nprevious models that were specifically designed for programming languages, as\nwell as state-of-the-art NMT models. An interactive online demo of our model is\navailable at http://code2seq.org. Our code, data and trained models are\navailable at http://github.com/tech-srl/code2seq.","url_abs":"http://arxiv.org/abs/1808.01400v6","url_pdf":"http://arxiv.org/pdf/1808.01400v6.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":"code2seq-generating-sequences-from-structured","repo_url":"https://github.com/tech-srl/code2seq","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"code2seq-generating-sequences-from-structured","repo_url":"https://github.com/Attn-to-FC/Attn-to-FC","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok"}},{"paper_slug":"code2seq-generating-sequences-from-structured","repo_url":"https://github.com/hukuda222/code2seq","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"code2seq-generating-sequences-from-structured","repo_url":"https://github.com/m3yrin/code2seq","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"code2seq-generating-sequences-from-structured","repo_url":"https://github.com/superli3/CYRMPR","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok"}},{"paper_slug":"code2seq-generating-sequences-from-structured","repo_url":"https://github.com/superli3/codenavi","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok"}}],"tasks":[{"task_slug":"code-summarization-1","task_name":"Code Summarization"},{"task_slug":"nmt","task_name":"NMT"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"code-summarization","task_name":"Source Code Summarization"},{"task_slug":"translation","task_name":"Translation"}],"methods":[],"datasets_introduced":[{"slug":"code2seq","name":"Code2Seq (Java)","full_name":""}],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1808.01400","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1808.01400"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/tech-srl/code2seq","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Attn-to-FC/Attn-to-FC","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/hukuda222/code2seq","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/superli3/codenavi","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/m3yrin/code2seq","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/superli3/CYRMPR","reach":{"status":"ok"}}],"summary":{"unverified":3},"by_repo_kind":{"listed":{"samples":3,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"8d7b265962bbb359","entry":"ids_to_sentence","repo":"m3yrin/code2seq","repo_kind":"listed","path":"src/utils.py","file_url":"https://github.com/m3yrin/code2seq/blob/HEAD/src/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8d7b265962bbb359"}},{"code_sha256_prefix":"4cf55f6111d41522","entry":"sentence_to_ids","repo":"m3yrin/code2seq","repo_kind":"listed","path":"src/utils.py","file_url":"https://github.com/m3yrin/code2seq/blob/HEAD/src/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4cf55f6111d41522"}},{"code_sha256_prefix":"65464c0b108cf699","entry":"trim_eos","repo":"m3yrin/code2seq","repo_kind":"listed","path":"src/utils.py","file_url":"https://github.com/m3yrin/code2seq/blob/HEAD/src/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"65464c0b108cf699"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}