{"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/structural-language-models-for-any-code","title":"Structural Language Models of Code","arxiv_id":"1910.00577","date":"2019-09-30","proceeding":"ICML 2020 1","authors":["Uri Alon","Roy Sadaka","Omer Levy","Eran Yahav"],"abstract":"We address the problem of any-code completion - generating a missing piece of source code in a given program without any restriction on the vocabulary or structure. We introduce a new approach to any-code completion that leverages the strict syntax of programming languages to model a code snippet as a tree - structural language modeling (SLM). SLM estimates the probability of the program's abstract syntax tree (AST) by decomposing it into a product of conditional probabilities over its nodes. We present a neural model that computes these conditional probabilities by considering all AST paths leading to a target node. Unlike previous techniques that have severely restricted the kinds of expressions that can be generated in this task, our approach can generate arbitrary code in any programming language. Our model significantly outperforms both seq2seq and a variety of structured approaches in generating Java and C# code. Our code, data, and trained models are available at http://github.com/tech-srl/slm-code-generation/ . An online demo is available at http://AnyCodeGen.org .","url_abs":"https://arxiv.org/abs/1910.00577v4","url_pdf":"https://arxiv.org/pdf/1910.00577v4.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":"structural-language-models-for-any-code","repo_url":"https://github.com/tech-srl/slm-code-generation","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"structural-language-models-for-any-code","repo_url":"https://github.com/tihonovcore/model","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok"}}],"tasks":[{"task_slug":"c-code","task_name":"C++ code"},{"task_slug":"code-completion","task_name":"Code Completion"},{"task_slug":"code-generation","task_name":"Code Generation"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"}],"methods":[{"method_slug":"lstm","method_name":"LSTM"},{"method_slug":"seq2seq","method_name":"Seq2Seq"},{"method_slug":"sigmoid-activation","method_name":"Sigmoid Activation"},{"method_slug":"tanh-activation","method_name":"Tanh Activation"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1910.00577","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1910.00577"}},"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/tihonovcore/model","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/tech-srl/slm-code-generation","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":8},"by_repo_kind":{"official":{"samples":8,"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":"0e3bd17b6b88ea45","entry":"ParallelExtractDir","repo":"tech-srl/slm-code-generation","repo_kind":"official","path":"JavaExtractor/extract.py","file_url":"https://github.com/tech-srl/slm-code-generation/blob/HEAD/JavaExtractor/extract.py","link_basis":"first_harvest_node","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":"0e3bd17b6b88ea45"}},{"code_sha256_prefix":"99549bf0b7bd6143","entry":"get_immediate_files","repo":"tech-srl/slm-code-generation","repo_kind":"official","path":"JavaExtractor/extract.py","file_url":"https://github.com/tech-srl/slm-code-generation/blob/HEAD/JavaExtractor/extract.py","link_basis":"first_harvest_node","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":"99549bf0b7bd6143"}},{"code_sha256_prefix":"94cb8d60c8256a0a","entry":"get_immediate_subdirectories","repo":"tech-srl/slm-code-generation","repo_kind":"official","path":"JavaExtractor/extract.py","file_url":"https://github.com/tech-srl/slm-code-generation/blob/HEAD/JavaExtractor/extract.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":"94cb8d60c8256a0a"}},{"code_sha256_prefix":"535af502a418b7ff","entry":"make_example","repo":"tech-srl/slm-code-generation","repo_kind":"official","path":"preprocess.py","file_url":"https://github.com/tech-srl/slm-code-generation/blob/HEAD/preprocess.py","link_basis":"first_harvest_node","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":"535af502a418b7ff"}},{"code_sha256_prefix":"25eb72be1587171b","entry":"make_example_and_histograms","repo":"tech-srl/slm-code-generation","repo_kind":"official","path":"preprocess.py","file_url":"https://github.com/tech-srl/slm-code-generation/blob/HEAD/preprocess.py","link_basis":"first_harvest_node","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":"25eb72be1587171b"}},{"code_sha256_prefix":"343969d3f1436f23","entry":"make_example_from_line","repo":"tech-srl/slm-code-generation","repo_kind":"official","path":"preprocess.py","file_url":"https://github.com/tech-srl/slm-code-generation/blob/HEAD/preprocess.py","link_basis":"first_harvest_node","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":"343969d3f1436f23"}},{"code_sha256_prefix":"f9002ff6f18c407d","entry":"split_subtokens","repo":"tech-srl/slm-code-generation","repo_kind":"official","path":"baselines/prep_baseline.py","file_url":"https://github.com/tech-srl/slm-code-generation/blob/HEAD/baselines/prep_baseline.py","link_basis":"first_harvest_node","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":"f9002ff6f18c407d"}},{"code_sha256_prefix":"2da202e46aefd959","entry":"subtokenize_tree","repo":"tech-srl/slm-code-generation","repo_kind":"official","path":"baselines/prep_baseline.py","file_url":"https://github.com/tech-srl/slm-code-generation/blob/HEAD/baselines/prep_baseline.py","link_basis":"first_harvest_node","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":"2da202e46aefd959"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}