{"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/memory-augmented-recursive-neural-networks","title":"Compositional Generalization with Tree Stack Memory Units","arxiv_id":"1911.01545","date":"2019-11-05","proceeding":null,"authors":["Forough Arabshahi","Zhichu Lu","Pranay Mundra","Sameer Singh","Animashree Anandkumar"],"abstract":"We study compositional generalization, viz., the problem of zero-shot generalization to novel compositions of concepts in a domain. Standard neural networks fail to a large extent on compositional learning. We propose Tree Stack Memory Units (Tree-SMU) to enable strong compositional generalization. Tree-SMU is a recursive neural network with Stack Memory Units (\\SMU s), a novel memory augmented neural network whose memory has a differentiable stack structure. Each SMU in the tree architecture learns to read from its stack and to write to it by combining the stacks and states of its children through gating. The stack helps capture long-range dependencies in the problem domain, thereby enabling compositional generalization. Additionally, the stack also preserves the ordering of each node's descendants, thereby retaining locality on the tree. We demonstrate strong empirical results on two mathematical reasoning benchmarks. We use four compositionality tests to assess the generalization performance of Tree-SMU and show that it enables accurate compositional generalization compared to strong baselines such as Transformers and Tree-LSTMs.","url_abs":"https://arxiv.org/abs/1911.01545v5","url_pdf":"https://arxiv.org/pdf/1911.01545v5.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":"memory-augmented-recursive-neural-networks","repo_url":"https://github.com/ForoughA/recursiveMemNet","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"memory-augmented-recursive-neural-networks","repo_url":"https://github.com/ForoughA/neuralMath","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"mxnet","reach":{"status":"ok"}},{"paper_slug":"memory-augmented-recursive-neural-networks","repo_url":"https://github.com/maxwells-daemons/compositional-learning-experiments","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"mathematical-reasoning","task_name":"Mathematical Reasoning"},{"task_slug":"zero-shot-generalization","task_name":"Zero-shot Generalization"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1911.01545","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1911.01545"}},"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/ForoughA/neuralMath","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ForoughA/recursiveMemNet","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/maxwells-daemons/compositional-learning-experiments","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"unverified":6},"by_repo_kind":{"listed":{"samples":6,"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":"97fa004eb72ef955","entry":"get_rnn_constructor","repo":"maxwells-daemons/compositional-learning-experiments","repo_kind":"listed","path":"compositional_learning_experiments/models/sequence.py","file_url":"https://github.com/maxwells-daemons/compositional-learning-experiments/blob/HEAD/compositional_learning_experiments/models/sequence.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":"97fa004eb72ef955"}},{"code_sha256_prefix":"2f2df5bd3cf1e769","entry":"make_similarity_metric","repo":"maxwells-daemons/compositional-learning-experiments","repo_kind":"listed","path":"compositional_learning_experiments/models/base.py","file_url":"https://github.com/maxwells-daemons/compositional-learning-experiments/blob/HEAD/compositional_learning_experiments/models/base.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":"2f2df5bd3cf1e769"}},{"code_sha256_prefix":"ea5768c1e02fa903","entry":"plot_attention","repo":"maxwells-daemons/compositional-learning-experiments","repo_kind":"listed","path":"compositional_learning_experiments/models/sequence.py","file_url":"https://github.com/maxwells-daemons/compositional-learning-experiments/blob/HEAD/compositional_learning_experiments/models/sequence.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":"ea5768c1e02fa903"}},{"code_sha256_prefix":"913829c56c332c5c","entry":"sequence_root_index","repo":"maxwells-daemons/compositional-learning-experiments","repo_kind":"listed","path":"compositional_learning_experiments/data.py","file_url":"https://github.com/maxwells-daemons/compositional-learning-experiments/blob/HEAD/compositional_learning_experiments/data.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":"913829c56c332c5c"}},{"code_sha256_prefix":"64a131835e9e874f","entry":"stack_bidirectional_context","repo":"maxwells-daemons/compositional-learning-experiments","repo_kind":"listed","path":"compositional_learning_experiments/models/sequence.py","file_url":"https://github.com/maxwells-daemons/compositional-learning-experiments/blob/HEAD/compositional_learning_experiments/models/sequence.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":"64a131835e9e874f"}},{"code_sha256_prefix":"c4a020fd6fb7b54b","entry":"tokenize","repo":"maxwells-daemons/compositional-learning-experiments","repo_kind":"listed","path":"compositional_learning_experiments/data.py","file_url":"https://github.com/maxwells-daemons/compositional-learning-experiments/blob/HEAD/compositional_learning_experiments/data.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":"c4a020fd6fb7b54b"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}