{"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/strong-generalization-and-efficiency-in","title":"Strong Generalization and Efficiency in Neural Programs","arxiv_id":"2007.03629","date":"2020-07-07","proceeding":null,"authors":["Yujia Li","Felix Gimeno","Pushmeet Kohli","Oriol Vinyals"],"abstract":"We study the problem of learning efficient algorithms that strongly generalize in the framework of neural program induction. By carefully designing the input / output interfaces of the neural model and through imitation, we are able to learn models that produce correct results for arbitrary input sizes, achieving strong generalization. Moreover, by using reinforcement learning, we optimize for program efficiency metrics, and discover new algorithms that surpass the teacher used in imitation. With this, our approach can learn to outperform custom-written solutions for a variety of problems, as we tested it on sorting, searching in ordered lists and the NP-complete 0/1 knapsack problem, which sets a notable milestone in the field of Neural Program Induction. As highlights, our learned model can perform sorting perfectly on any input data size we tested on, with $O(n log n)$ complexity, whilst outperforming hand-coded algorithms, including quick sort, in number of operations even for list sizes far beyond those seen during training.","url_abs":"https://arxiv.org/abs/2007.03629v2","url_pdf":"https://arxiv.org/pdf/2007.03629v2.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":"strong-generalization-and-efficiency-in","repo_url":"https://github.com/hardbyte/sorting-gym","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"program-induction","task_name":"Program induction"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2007.03629","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2007.03629"}},"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/hardbyte/sorting-gym","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"unverified":9},"by_repo_kind":{"listed":{"samples":9,"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":"b70d684d703d7ee3","entry":"bin_packing_lower_bound","repo":"hardbyte/sorting-gym","repo_kind":"listed","path":"sorting_gym/bounds.py","file_url":"https://github.com/hardbyte/sorting-gym/blob/HEAD/sorting_gym/bounds.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b70d684d703d7ee3"}},{"code_sha256_prefix":"4abf7590b6429bfd","entry":"data_greater_than","repo":"hardbyte/sorting-gym","repo_kind":"listed","path":"sorting_gym/agents/scripted.py","file_url":"https://github.com/hardbyte/sorting-gym/blob/HEAD/sorting_gym/agents/scripted.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"4abf7590b6429bfd"}},{"code_sha256_prefix":"b285ef8446916ce8","entry":"data_less_than","repo":"hardbyte/sorting-gym","repo_kind":"listed","path":"sorting_gym/agents/scripted.py","file_url":"https://github.com/hardbyte/sorting-gym/blob/HEAD/sorting_gym/agents/scripted.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b285ef8446916ce8"}},{"code_sha256_prefix":"22287bda96accecb","entry":"descents","repo":"hardbyte/sorting-gym","repo_kind":"listed","path":"sorting_gym/envs/ring.py","file_url":"https://github.com/hardbyte/sorting-gym/blob/HEAD/sorting_gym/envs/ring.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"22287bda96accecb"}},{"code_sha256_prefix":"0fe8263a064edca4","entry":"is_rotation_of_sorted","repo":"hardbyte/sorting-gym","repo_kind":"listed","path":"sorting_gym/envs/ring.py","file_url":"https://github.com/hardbyte/sorting-gym/blob/HEAD/sorting_gym/envs/ring.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0fe8263a064edca4"}},{"code_sha256_prefix":"4f93634eefffa454","entry":"knapsack_lp_bound","repo":"hardbyte/sorting-gym","repo_kind":"listed","path":"sorting_gym/bounds.py","file_url":"https://github.com/hardbyte/sorting-gym/blob/HEAD/sorting_gym/bounds.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"4f93634eefffa454"}},{"code_sha256_prefix":"0db85d6ebb107100","entry":"knapsack_optimal","repo":"hardbyte/sorting-gym","repo_kind":"listed","path":"sorting_gym/bounds.py","file_url":"https://github.com/hardbyte/sorting-gym/blob/HEAD/sorting_gym/bounds.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0db85d6ebb107100"}},{"code_sha256_prefix":"69c62328eecadf78","entry":"merge_discrete_spaces","repo":"hardbyte/sorting-gym","repo_kind":"listed","path":"sorting_gym/envs/wrappers.py","file_url":"https://github.com/hardbyte/sorting-gym/blob/HEAD/sorting_gym/envs/wrappers.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"69c62328eecadf78"}},{"code_sha256_prefix":"9ce0eb119558ac72","entry":"v_less_than","repo":"hardbyte/sorting-gym","repo_kind":"listed","path":"sorting_gym/agents/scripted.py","file_url":"https://github.com/hardbyte/sorting-gym/blob/HEAD/sorting_gym/agents/scripted.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"9ce0eb119558ac72"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}