{"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/logic-rl-unleashing-llm-reasoning-with-rule","title":"Logic-RL: Unleashing LLM Reasoning with Rule-Based Reinforcement Learning","arxiv_id":"2502.14768","date":"2025-02-20","proceeding":null,"authors":["Tian Xie","Zitian Gao","Qingnan Ren","Haoming Luo","Yuqian Hong","Bryan Dai","Joey Zhou","Kai Qiu","Zhirong Wu","Chong Luo"],"abstract":"Inspired by the success of DeepSeek-R1, we explore the potential of rule-based reinforcement learning (RL) in large reasoning models. To analyze reasoning dynamics, we use synthetic logic puzzles as training data due to their controllable complexity and straightforward answer verification. We make some key technical contributions that lead to effective and stable RL training: a system prompt that emphasizes the thinking and answering process, a stringent format reward function that penalizes outputs for taking shortcuts, and a straightforward training recipe that achieves stable convergence. Our 7B model develops advanced reasoning skills-such as reflection, verification, and summarization-that are absent from the logic corpus. Remarkably, after training on just 5K logic problems, it demonstrates generalization abilities to the challenging math benchmarks AIME and AMC.","url_abs":"https://arxiv.org/abs/2502.14768v1","url_pdf":"https://arxiv.org/pdf/2502.14768v1.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":"logic-rl-unleashing-llm-reasoning-with-rule","repo_url":"https://github.com/Unakar/Logic-RL","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"logic-rl-unleashing-llm-reasoning-with-rule","repo_url":"https://github.com/OpenLLMAI/OpenLLaMA2","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"logic-rl-unleashing-llm-reasoning-with-rule","repo_url":"https://github.com/OpenLLMAI/OpenRLHF","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"logic-rl-unleashing-llm-reasoning-with-rule","repo_url":"https://github.com/openrlhf/openrlhf","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"math","task_name":"Math"},{"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":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2502.14768","atlas_url":"https://app.syntology.ai/?focus=2502.14768","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2502.14768"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/Unakar/Logic-RL","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/OpenLLMAI/OpenRLHF","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/openrlhf/openrlhf","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/OpenLLMAI/OpenLLaMA2","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":12,"ran_honours":1,"ran_fixture":1,"ran_draft_wrong":1,"unverified":8},"by_repo_kind":{"official":{"samples":16,"ran":10,"repositories":1},"listed":{"samples":7,"ran":5,"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":"0edeb138e07fbecc","entry":"aggregate_loss","repo":"OpenLLMAI/OpenLLaMA2","repo_kind":"listed","path":"openrlhf/models/loss.py","file_url":"https://github.com/OpenLLMAI/OpenLLaMA2/blob/HEAD/openrlhf/models/loss.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0edeb138e07fbecc"}},{"code_sha256_prefix":"c146f3cb0e5259a0","entry":"compute_approx_kl","repo":"OpenLLMAI/OpenLLaMA2","repo_kind":"listed","path":"openrlhf/models/utils.py","file_url":"https://github.com/OpenLLMAI/OpenLLaMA2/blob/HEAD/openrlhf/models/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c146f3cb0e5259a0"}},{"code_sha256_prefix":"812f2e3f5cda7c93","entry":"compute_reward","repo":"OpenLLMAI/OpenLLaMA2","repo_kind":"listed","path":"openrlhf/models/utils.py","file_url":"https://github.com/OpenLLMAI/OpenLLaMA2/blob/HEAD/openrlhf/models/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"812f2e3f5cda7c93"}},{"code_sha256_prefix":"360c671d6041ba3b","entry":"create_huggingface_actor","repo":"Unakar/Logic-RL","repo_kind":"official","path":"verl/utils/model.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/verl/utils/model.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"360c671d6041ba3b"}},{"code_sha256_prefix":"b870fd9007fabd94","entry":"extract_solution","repo":"Unakar/Logic-RL","repo_kind":"official","path":"eval_kk/compute_score.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/eval_kk/compute_score.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b870fd9007fabd94"}},{"code_sha256_prefix":"216e28c040173a61","entry":"extract_step","repo":"Unakar/Logic-RL","repo_kind":"official","path":"verl/trainer/fsdp_sft_trainer.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/verl/trainer/fsdp_sft_trainer.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"216e28c040173a61"}},{"code_sha256_prefix":"557aef158c28bb84","entry":"get_loss_batch_info","repo":"OpenLLMAI/OpenLLaMA2","repo_kind":"listed","path":"openrlhf/utils/loss_utils.py","file_url":"https://github.com/OpenLLMAI/OpenLLaMA2/blob/HEAD/openrlhf/utils/loss_utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"557aef158c28bb84"}},{"code_sha256_prefix":"42a7954a8cfa89e0","entry":"is_transformers_version_in_range","repo":"Unakar/Logic-RL","repo_kind":"official","path":"verl/models/transformers/monkey_patch.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/verl/models/transformers/monkey_patch.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"42a7954a8cfa89e0"}},{"code_sha256_prefix":"0998b08e39672d66","entry":"load_jsonl","repo":"Unakar/Logic-RL","repo_kind":"official","path":"eval_kk/main_eval_instruct.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/eval_kk/main_eval_instruct.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0998b08e39672d66"}},{"code_sha256_prefix":"75afa2affd2a8e36","entry":"log_probs_from_logits","repo":"OpenLLMAI/OpenLLaMA2","repo_kind":"listed","path":"openrlhf/models/utils.py","file_url":"https://github.com/OpenLLMAI/OpenLLaMA2/blob/HEAD/openrlhf/models/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"75afa2affd2a8e36"}},{"code_sha256_prefix":"f4e717416b80af20","entry":"parse_cot_eval","repo":"Unakar/Logic-RL","repo_kind":"official","path":"eval_kk/kk_processor.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/eval_kk/kk_processor.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f4e717416b80af20"}},{"code_sha256_prefix":"df0cff7e9a4ca96e","entry":"parse_model_answer","repo":"Unakar/Logic-RL","repo_kind":"official","path":"eval_kk/compute_score.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/eval_kk/compute_score.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"df0cff7e9a4ca96e"}},{"code_sha256_prefix":"a6a2e23358e05581","entry":"parse_solution_text_format","repo":"Unakar/Logic-RL","repo_kind":"official","path":"eval_kk/compute_score.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/eval_kk/compute_score.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a6a2e23358e05581"}},{"code_sha256_prefix":"21331a58f93375e4","entry":"union_tensor_dict","repo":"Unakar/Logic-RL","repo_kind":"official","path":"verl/protocol.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/verl/protocol.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"DEP_MISSING","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"21331a58f93375e4"}},{"code_sha256_prefix":"25f0ea3f460f6ce1","entry":"unpad_dataproto","repo":"Unakar/Logic-RL","repo_kind":"official","path":"verl/protocol.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/verl/protocol.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"25f0ea3f460f6ce1"}},{"code_sha256_prefix":"1fb4adb621eefddc","entry":"apply_monkey_patch","repo":"Unakar/Logic-RL","repo_kind":"official","path":"verl/models/transformers/monkey_patch.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/verl/models/transformers/monkey_patch.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":"1fb4adb621eefddc"}},{"code_sha256_prefix":"19472d4343d0a082","entry":"get_huggingface_actor_config","repo":"Unakar/Logic-RL","repo_kind":"official","path":"verl/utils/model.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/verl/utils/model.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":"19472d4343d0a082"}},{"code_sha256_prefix":"5110d3bb195169a8","entry":"get_tensor_in_current_ring_attn_rank","repo":"OpenLLMAI/OpenLLaMA2","repo_kind":"listed","path":"openrlhf/models/ring_attn_utils.py","file_url":"https://github.com/OpenLLMAI/OpenLLaMA2/blob/HEAD/openrlhf/models/ring_attn_utils.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":"5110d3bb195169a8"}},{"code_sha256_prefix":"919cf310ad4c189a","entry":"get_weight_loader","repo":"Unakar/Logic-RL","repo_kind":"official","path":"verl/models/weight_loader_registry.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/verl/models/weight_loader_registry.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":"919cf310ad4c189a"}},{"code_sha256_prefix":"cbfcdbb8e1ddcaca","entry":"load_eval_records","repo":"Unakar/Logic-RL","repo_kind":"official","path":"eval_kk/main_eval_instruct.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/eval_kk/main_eval_instruct.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":"cbfcdbb8e1ddcaca"}},{"code_sha256_prefix":"26b075196c1c10bf","entry":"num_tokens_from_string","repo":"Unakar/Logic-RL","repo_kind":"official","path":"eval_kk/kk_processor.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/eval_kk/kk_processor.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":"26b075196c1c10bf"}},{"code_sha256_prefix":"e93117d99aa6b210","entry":"reset_ring_attn_position_ids","repo":"OpenLLMAI/OpenLLaMA2","repo_kind":"listed","path":"openrlhf/models/ring_attn_utils.py","file_url":"https://github.com/OpenLLMAI/OpenLLaMA2/blob/HEAD/openrlhf/models/ring_attn_utils.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":"e93117d99aa6b210"}},{"code_sha256_prefix":"3b15e2ac7497c441","entry":"squeeze","repo":"Unakar/Logic-RL","repo_kind":"official","path":"verl/utils/model.py","file_url":"https://github.com/Unakar/Logic-RL/blob/HEAD/verl/utils/model.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":"3b15e2ac7497c441"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}