{"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/segment-policy-optimization-effective-segment","title":"Segment Policy Optimization: Effective Segment-Level Credit Assignment in RL for Large Language Models","arxiv_id":"2505.23564","date":"2025-05-29","proceeding":null,"authors":["Yiran Guo","Lijie Xu","Jie Liu","Dan Ye","Shuang Qiu"],"abstract":"Enhancing the reasoning capabilities of large language models effectively using reinforcement learning (RL) remains a crucial challenge. Existing approaches primarily adopt two contrasting advantage estimation granularities: Token-level methods (e.g., PPO) aim to provide the fine-grained advantage signals but suffer from inaccurate estimation due to difficulties in training an accurate critic model. On the other extreme, trajectory-level methods (e.g., GRPO) solely rely on a coarse-grained advantage signal from the final reward, leading to imprecise credit assignment. To address these limitations, we propose Segment Policy Optimization (SPO), a novel RL framework that leverages segment-level advantage estimation at an intermediate granularity, achieving a better balance by offering more precise credit assignment than trajectory-level methods and requiring fewer estimation points than token-level methods, enabling accurate advantage estimation based on Monte Carlo (MC) without a critic model. SPO features three components with novel strategies: (1) flexible segment partition; (2) accurate segment advantage estimation; and (3) policy optimization using segment advantages, including a novel probability-mask strategy. We further instantiate SPO for two specific scenarios: (1) SPO-chain for short chain-of-thought (CoT), featuring novel cutpoint-based partition and chain-based advantage estimation, achieving $6$-$12$ percentage point improvements in accuracy over PPO and GRPO on GSM8K. (2) SPO-tree for long CoT, featuring novel tree-based advantage estimation, which significantly reduces the cost of MC estimation, achieving $7$-$11$ percentage point improvements over GRPO on MATH500 under 2K and 4K context evaluation. We make our code publicly available at https://github.com/AIFrameResearch/SPO.","url_abs":"https://arxiv.org/abs/2505.23564v1","url_pdf":"https://arxiv.org/pdf/2505.23564v1.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":"segment-policy-optimization-effective-segment","repo_url":"https://github.com/aiframeresearch/spo","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"2k","task_name":"2k"},{"task_slug":"4k","task_name":"4k"},{"task_slug":"gsm8k","task_name":"GSM8K"},{"task_slug":"reinforcement-learning-1","task_name":"Reinforcement Learning (RL)"}],"methods":[{"method_slug":"adopt","method_name":"ADOPT"},{"method_slug":"entropy-regularization","method_name":"Entropy Regularization"},{"method_slug":"ppo","method_name":"PPO"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2505.23564","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2505.23564"}},"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/AIFrameResearch/SPO","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/aiframeresearch/spo","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":7,"unverified":2},"by_repo_kind":{"official":{"samples":9,"ran":7,"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":"358e91bb94af0ba2","entry":"SavedText","repo":"AIFrameResearch/SPO","repo_kind":"official","path":"src/guidance/_grammar.py","file_url":"https://github.com/AIFrameResearch/SPO/blob/HEAD/src/guidance/_grammar.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"358e91bb94af0ba2"}},{"code_sha256_prefix":"0751f6d65e347f7d","entry":"add_spaces","repo":"AIFrameResearch/SPO","repo_kind":"official","path":"src/guidance/_program.py","file_url":"https://github.com/AIFrameResearch/SPO/blob/HEAD/src/guidance/_program.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0751f6d65e347f7d"}},{"code_sha256_prefix":"f0a41b57b2a4951a","entry":"assistant","repo":"AIFrameResearch/SPO","repo_kind":"official","path":"src/guidance/library/_assistant.py","file_url":"https://github.com/AIFrameResearch/SPO/blob/HEAD/src/guidance/library/_assistant.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f0a41b57b2a4951a"}},{"code_sha256_prefix":"5e6a8e3edae86812","entry":"await_","repo":"AIFrameResearch/SPO","repo_kind":"official","path":"src/guidance/library/_await.py","file_url":"https://github.com/AIFrameResearch/SPO/blob/HEAD/src/guidance/library/_await.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5e6a8e3edae86812"}},{"code_sha256_prefix":"94e304b04bca6113","entry":"callable","repo":"AIFrameResearch/SPO","repo_kind":"official","path":"src/guidance/library/_callable.py","file_url":"https://github.com/AIFrameResearch/SPO/blob/HEAD/src/guidance/library/_callable.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"94e304b04bca6113"}},{"code_sha256_prefix":"12a84ce5d8467107","entry":"find_func_name","repo":"AIFrameResearch/SPO","repo_kind":"official","path":"src/guidance/_utils.py","file_url":"https://github.com/AIFrameResearch/SPO/blob/HEAD/src/guidance/_utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"12a84ce5d8467107"}},{"code_sha256_prefix":"41a6139f3b69cb44","entry":"load","repo":"AIFrameResearch/SPO","repo_kind":"official","path":"src/guidance/_utils.py","file_url":"https://github.com/AIFrameResearch/SPO/blob/HEAD/src/guidance/_utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"41a6139f3b69cb44"}},{"code_sha256_prefix":"07024abd2b391cdf","entry":"chain","repo":"AIFrameResearch/SPO","repo_kind":"official","path":"src/guidance/_utils.py","file_url":"https://github.com/AIFrameResearch/SPO/blob/HEAD/src/guidance/_utils.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":"07024abd2b391cdf"}},{"code_sha256_prefix":"e635b6a7bc9b6a4f","entry":"get_logger","repo":"AIFrameResearch/SPO","repo_kind":"official","path":"src/treetune/logging_utils.py","file_url":"https://github.com/AIFrameResearch/SPO/blob/HEAD/src/treetune/logging_utils.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":"e635b6a7bc9b6a4f"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}