{"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/programming-with-a-differentiable-forth","title":"Programming with a Differentiable Forth Interpreter","arxiv_id":"1605.06640","date":"2016-05-21","proceeding":"ICML 2017 8","authors":["Matko Bošnjak","Tim Rocktäschel","Jason Naradowsky","Sebastian Riedel"],"abstract":"Given that in practice training data is scarce for all but a small set of\nproblems, a core question is how to incorporate prior knowledge into a model.\nIn this paper, we consider the case of prior procedural knowledge for neural\nnetworks, such as knowing how a program should traverse a sequence, but not\nwhat local actions should be performed at each step. To this end, we present an\nend-to-end differentiable interpreter for the programming language Forth which\nenables programmers to write program sketches with slots that can be filled\nwith behaviour trained from program input-output data. We can optimise this\nbehaviour directly through gradient descent techniques on user-specified\nobjectives, and also integrate the program into any larger neural computation\ngraph. We show empirically that our interpreter is able to effectively leverage\ndifferent levels of prior program structure and learn complex behaviours such\nas sequence sorting and addition. When connected to outputs of an LSTM and\ntrained jointly, our interpreter achieves state-of-the-art accuracy for\nend-to-end reasoning about quantities expressed in natural language stories.","url_abs":"http://arxiv.org/abs/1605.06640v3","url_pdf":"http://arxiv.org/pdf/1605.06640v3.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":"programming-with-a-differentiable-forth","repo_url":"https://github.com/uclmr/d4","is_official":0,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"tf","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[{"method_slug":"lstm","method_name":"LSTM"},{"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=1605.06640","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1605.06640"}},"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/uclmr/d4","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":12},"by_repo_kind":{"named_in_paper":{"samples":12,"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":"53e66edf0a42913f","entry":"constant","repo":"uclmr/d4","repo_kind":"named_in_paper","path":"d4/intermediate.py","file_url":"https://github.com/uclmr/d4/blob/HEAD/d4/intermediate.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":"53e66edf0a42913f"}},{"code_sha256_prefix":"cfc3a28ecbb198ea","entry":"data_stack_elem","repo":"uclmr/d4","repo_kind":"named_in_paper","path":"d4/dsm/symbolic_dsm.py","file_url":"https://github.com/uclmr/d4/blob/HEAD/d4/dsm/symbolic_dsm.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":"cfc3a28ecbb198ea"}},{"code_sha256_prefix":"61b326e16068cc59","entry":"fetch","repo":"uclmr/d4","repo_kind":"named_in_paper","path":"d4/dsm/symbolic_dsm.py","file_url":"https://github.com/uclmr/d4/blob/HEAD/d4/dsm/symbolic_dsm.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":"61b326e16068cc59"}},{"code_sha256_prefix":"1b4fc26ce0acfe24","entry":"label","repo":"uclmr/d4","repo_kind":"named_in_paper","path":"d4/intermediate.py","file_url":"https://github.com/uclmr/d4/blob/HEAD/d4/intermediate.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":"1b4fc26ce0acfe24"}},{"code_sha256_prefix":"3a89dd4c9cb256d7","entry":"load_data","repo":"uclmr/d4","repo_kind":"named_in_paper","path":"experiments/data.py","file_url":"https://github.com/uclmr/d4/blob/HEAD/experiments/data.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":"3a89dd4c9cb256d7"}},{"code_sha256_prefix":"8b83fb97070754b0","entry":"load_single_dataset","repo":"uclmr/d4","repo_kind":"named_in_paper","path":"experiments/data.py","file_url":"https://github.com/uclmr/d4/blob/HEAD/experiments/data.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":"8b83fb97070754b0"}},{"code_sha256_prefix":"416413294085b836","entry":"merge_dsms","repo":"uclmr/d4","repo_kind":"named_in_paper","path":"d4/dsm/extensible_dsm.py","file_url":"https://github.com/uclmr/d4/blob/HEAD/d4/dsm/extensible_dsm.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":"416413294085b836"}},{"code_sha256_prefix":"77b79313562edff7","entry":"merge_tensors","repo":"uclmr/d4","repo_kind":"named_in_paper","path":"d4/dsm/extensible_dsm.py","file_url":"https://github.com/uclmr/d4/blob/HEAD/d4/dsm/extensible_dsm.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":"77b79313562edff7"}},{"code_sha256_prefix":"d04ebc999c76766f","entry":"new_label_generator","repo":"uclmr/d4","repo_kind":"named_in_paper","path":"d4/compiler.py","file_url":"https://github.com/uclmr/d4/blob/HEAD/d4/compiler.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":"d04ebc999c76766f"}},{"code_sha256_prefix":"7a7d91070abd6fac","entry":"number","repo":"uclmr/d4","repo_kind":"named_in_paper","path":"d4/intermediate.py","file_url":"https://github.com/uclmr/d4/blob/HEAD/d4/intermediate.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":"7a7d91070abd6fac"}},{"code_sha256_prefix":"126ffd4ab1709750","entry":"return_stack_elem","repo":"uclmr/d4","repo_kind":"named_in_paper","path":"d4/dsm/symbolic_dsm.py","file_url":"https://github.com/uclmr/d4/blob/HEAD/d4/dsm/symbolic_dsm.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":"126ffd4ab1709750"}},{"code_sha256_prefix":"55175596b0457cff","entry":"symbol_match","repo":"uclmr/d4","repo_kind":"named_in_paper","path":"d4/dsm/extensible_dsm.py","file_url":"https://github.com/uclmr/d4/blob/HEAD/d4/dsm/extensible_dsm.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":"55175596b0457cff"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}