{"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/contrastive-reinforcement-learning-of","title":"Contrastive Reinforcement Learning of Symbolic Reasoning Domains","arxiv_id":"2106.09146","date":"2021-06-16","proceeding":"NeurIPS 2021 12","authors":["Gabriel Poesia","WenXin Dong","Noah Goodman"],"abstract":"Abstract symbolic reasoning, as required in domains such as mathematics and logic, is a key component of human intelligence. Solvers for these domains have important applications, especially to computer-assisted education. But learning to solve symbolic problems is challenging for machine learning algorithms. Existing models either learn from human solutions or use hand-engineered features, making them expensive to apply in new domains. In this paper, we instead consider symbolic domains as simple environments where states and actions are given as unstructured text, and binary rewards indicate whether a problem is solved. This flexible setup makes it easy to specify new domains, but search and planning become challenging. We introduce four environments inspired by the Mathematics Common Core Curriculum, and observe that existing Reinforcement Learning baselines perform poorly. We then present a novel learning algorithm, Contrastive Policy Learning (ConPoLe) that explicitly optimizes the InfoNCE loss, which lower bounds the mutual information between the current state and next states that continue on a path to the solution. ConPoLe successfully solves all four domains. Moreover, problem representations learned by ConPoLe enable accurate prediction of the categories of problems in a real mathematics curriculum. Our results suggest new directions for reinforcement learning in symbolic domains, as well as applications to mathematics education.","url_abs":"https://arxiv.org/abs/2106.09146v2","url_pdf":"https://arxiv.org/pdf/2106.09146v2.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":"contrastive-reinforcement-learning-of","repo_url":"https://github.com/gpoesia/socratic-tutor","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"contrastive-reinforcement-learning-of","repo_url":"https://github.com/sagnikanupam/mathdsl","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"reinforcement-learning","task_name":"Reinforcement Learning"},{"task_slug":"reinforcement-learning-1","task_name":"Reinforcement Learning (RL)"},{"task_slug":"reinforcement-learning-2","task_name":"reinforcement-learning"}],"methods":[{"method_slug":"infonce","method_name":"InfoNCE"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2106.09146","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2106.09146"}},"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":"deterministic:regex_extraction","url":"https://github.com/gpoesia/socratic-tutor","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/sagnikanupam/mathdsl","reach":null}],"summary":{"ran":3,"ran_draft_wrong":1,"unverified":11},"by_repo_kind":{"official":{"samples":14,"ran":3,"repositories":1},"listed":{"samples":1,"ran":1,"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":15,"samples":[{"code_sha256_prefix":"3d82da901d88aa3c","entry":"RacketEnvironment","repo":"gpoesia/socratic-tutor","repo_kind":"official","path":"agent.py","file_url":"https://github.com/gpoesia/socratic-tutor/blob/HEAD/agent.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3d82da901d88aa3c"}},{"code_sha256_prefix":"43eefe3507985e75","entry":"Tree","repo":"sagnikanupam/mathdsl","repo_kind":"listed","path":"dreamcoder/domains/conpole/conpoleMathPrimitives.py","file_url":"https://github.com/sagnikanupam/mathdsl/blob/HEAD/dreamcoder/domains/conpole/conpoleMathPrimitives.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"43eefe3507985e75"}},{"code_sha256_prefix":"8e74322415ba2a24","entry":"random_initial_seed","repo":"gpoesia/socratic-tutor","repo_kind":"official","path":"agent.py","file_url":"https://github.com/gpoesia/socratic-tutor/blob/HEAD/agent.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8e74322415ba2a24"}},{"code_sha256_prefix":"6a1ad0909c55aa20","entry":"register","repo":"gpoesia/socratic-tutor","repo_kind":"official","path":"agent.py","file_url":"https://github.com/gpoesia/socratic-tutor/blob/HEAD/agent.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6a1ad0909c55aa20"}},{"code_sha256_prefix":"82b383962990e9ba","entry":"Action","repo":"gpoesia/socratic-tutor","repo_kind":"official","path":"agent.py","file_url":"https://github.com/gpoesia/socratic-tutor/blob/HEAD/agent.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"82b383962990e9ba"}},{"code_sha256_prefix":"e38eefb547b2a7fd","entry":"ContrastiveExample","repo":"gpoesia/socratic-tutor","repo_kind":"official","path":"agent.py","file_url":"https://github.com/gpoesia/socratic-tutor/blob/HEAD/agent.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e38eefb547b2a7fd"}},{"code_sha256_prefix":"bbc1dc4497b5ec6b","entry":"InverseLength","repo":"gpoesia/socratic-tutor","repo_kind":"official","path":"agent.py","file_url":"https://github.com/gpoesia/socratic-tutor/blob/HEAD/agent.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bbc1dc4497b5ec6b"}},{"code_sha256_prefix":"6740a0d260d2a467","entry":"LearningAgent","repo":"gpoesia/socratic-tutor","repo_kind":"official","path":"agent.py","file_url":"https://github.com/gpoesia/socratic-tutor/blob/HEAD/agent.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6740a0d260d2a467"}},{"code_sha256_prefix":"cd47224c2bdbef51","entry":"MultiTaskEnvironment","repo":"gpoesia/socratic-tutor","repo_kind":"official","path":"agent.py","file_url":"https://github.com/gpoesia/socratic-tutor/blob/HEAD/agent.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cd47224c2bdbef51"}},{"code_sha256_prefix":"519728cf68d959ec","entry":"NCE","repo":"gpoesia/socratic-tutor","repo_kind":"official","path":"agent.py","file_url":"https://github.com/gpoesia/socratic-tutor/blob/HEAD/agent.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"519728cf68d959ec"}},{"code_sha256_prefix":"05426ee7aeefc5ac","entry":"QFunction","repo":"gpoesia/socratic-tutor","repo_kind":"official","path":"agent.py","file_url":"https://github.com/gpoesia/socratic-tutor/blob/HEAD/agent.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"05426ee7aeefc5ac"}},{"code_sha256_prefix":"4566b327bd686f0c","entry":"RandomQFunction","repo":"gpoesia/socratic-tutor","repo_kind":"official","path":"agent.py","file_url":"https://github.com/gpoesia/socratic-tutor/blob/HEAD/agent.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4566b327bd686f0c"}},{"code_sha256_prefix":"2db358be2ba65b5e","entry":"RubiksGreedyHeuristic","repo":"gpoesia/socratic-tutor","repo_kind":"official","path":"agent.py","file_url":"https://github.com/gpoesia/socratic-tutor/blob/HEAD/agent.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2db358be2ba65b5e"}},{"code_sha256_prefix":"6f6ab6bad7d94b64","entry":"RustEnvironment","repo":"gpoesia/socratic-tutor","repo_kind":"official","path":"agent.py","file_url":"https://github.com/gpoesia/socratic-tutor/blob/HEAD/agent.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6f6ab6bad7d94b64"}},{"code_sha256_prefix":"a263044fe206c128","entry":"State","repo":"gpoesia/socratic-tutor","repo_kind":"official","path":"agent.py","file_url":"https://github.com/gpoesia/socratic-tutor/blob/HEAD/agent.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a263044fe206c128"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}