{"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/octothinker-mid-training-incentivizes","title":"OctoThinker: Mid-training Incentivizes Reinforcement Learning Scaling","arxiv_id":"2506.20512","date":"2025-06-25","proceeding":null,"authors":["Zengzhi Wang","Fan Zhou","Xuefeng Li","PengFei Liu"],"abstract":"Different base language model families, such as Llama and Qwen, exhibit divergent behaviors during post-training with reinforcement learning (RL), especially on reasoning-intensive tasks. What makes a base language model suitable for reinforcement learning? Gaining deeper insight into this question is essential for developing RL-scalable foundation models of the next generation. In this work, we investigate how mid-training strategies shape RL dynamics, focusing on two representative model families: Qwen and Llama. Our study reveals that (1) high-quality mathematical corpora, such as MegaMath-Web-Pro, significantly improve both base model and RL performance, while existing alternatives (e.g., FineMath-4plus) fail to do so; (2) further adding QA-style data, particularly long chain-of-thought (CoT) reasoning examples, enhances RL outcomes, and instruction data further unlocks this effect; (3) while long-CoT improves reasoning depth, it can also induce verbosity of model responses and unstability of RL training, underscoring the importance of data formatting; (4) scaling mid-training consistently leads to stronger downstream RL performance. Building on these insights, we introduce a two-stage mid-training strategy, Stable-then-Decay, in which base models are first trained on 200B tokens with a constant learning rate, followed by 20B tokens across three CoT-focused branches with learning rate decay. This yields OctoThinker, a family of models demonstrating strong RL compatibility and closing the performance gap with more RL-friendly model families, i.e., Qwen. We hope our work will help shape pre-training strategies for foundation models in the RL era. To support further research, we release our open-source models along with a curated math reasoning-intensive corpus of over 70 billion tokens (i.e., MegaMath-Web-Pro-Max).","url_abs":"https://arxiv.org/abs/2506.20512v1","url_pdf":"https://arxiv.org/pdf/2506.20512v1.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":"octothinker-mid-training-incentivizes","repo_url":"https://github.com/gair-nlp/octothinker","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"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":[{"method_slug":"base","method_name":"BASE"},{"method_slug":"llama","method_name":"LLaMA"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2506.20512","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2506.20512"}},"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/gair-nlp/octothinker","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":3,"unverified":14},"by_repo_kind":{"official":{"samples":17,"ran":3,"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":"6390dea763ce122e","entry":"extract_boxed_answers","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/data_processing/answer_extraction.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/data_processing/answer_extraction.py","link_basis":"plan_row","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":"6390dea763ce122e"}},{"code_sha256_prefix":"0772e5020f6b0849","entry":"extract_program_output","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/data_processing/answer_extraction.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/data_processing/answer_extraction.py","link_basis":"plan_row","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":"0772e5020f6b0849"}},{"code_sha256_prefix":"5abed389274c4c03","entry":"strip_string","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/data_processing/answer_extraction.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/data_processing/answer_extraction.py","link_basis":"plan_row","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":"5abed389274c4c03"}},{"code_sha256_prefix":"8b9e2baf73bb9a6f","entry":"aggregate_metrics","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/summarize_results.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/summarize_results.py","link_basis":"first_harvest_node","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":"8b9e2baf73bb9a6f"}},{"code_sha256_prefix":"33425041e7f88b7f","entry":"aggregate_predictions","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/summarize_results.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/summarize_results.py","link_basis":"first_harvest_node","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":"33425041e7f88b7f"}},{"code_sha256_prefix":"1d961161c71cc153","entry":"extract_program","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/eval/eval_utils.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/eval/eval_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":"1d961161c71cc153"}},{"code_sha256_prefix":"73f280086b2714ce","entry":"generate_completions","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/eval/utils.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/eval/utils.py","link_basis":"first_harvest_node","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":"73f280086b2714ce"}},{"code_sha256_prefix":"19dce514835bd816","entry":"get_next_word_predictions","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/eval/utils.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/eval/utils.py","link_basis":"first_harvest_node","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":"19dce514835bd816"}},{"code_sha256_prefix":"de0231790ab22287","entry":"markup_question","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/run_subset_parallel.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/run_subset_parallel.py","link_basis":"first_harvest_node","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":"de0231790ab22287"}},{"code_sha256_prefix":"1c2220bf6666327d","entry":"normalize_numeric","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/eval/ocwcourses_eval_utils.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/eval/ocwcourses_eval_utils.py","link_basis":"first_harvest_node","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":"1c2220bf6666327d"}},{"code_sha256_prefix":"73354091e7f44255","entry":"normalize_symbolic_equation","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/eval/ocwcourses_eval_utils.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/eval/ocwcourses_eval_utils.py","link_basis":"first_harvest_node","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":"73354091e7f44255"}},{"code_sha256_prefix":"4951ea903a7ffa37","entry":"numeric_equality","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/eval/ocwcourses_eval_utils.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/eval/ocwcourses_eval_utils.py","link_basis":"first_harvest_node","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":"4951ea903a7ffa37"}},{"code_sha256_prefix":"49e328786ffb3f8f","entry":"parse_question","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/eval/eval_utils.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/eval/eval_utils.py","link_basis":"first_harvest_node","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":"49e328786ffb3f8f"}},{"code_sha256_prefix":"5ae15dd305f032e2","entry":"read_csv_file","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/summarize_results.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/summarize_results.py","link_basis":"first_harvest_node","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":"5ae15dd305f032e2"}},{"code_sha256_prefix":"3deb39de933b985a","entry":"read_data","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/utils.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/utils.py","link_basis":"first_harvest_node","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":"3deb39de933b985a"}},{"code_sha256_prefix":"8c63844c66973f8d","entry":"score_completions","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/eval/utils.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/eval/utils.py","link_basis":"first_harvest_node","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":"8c63844c66973f8d"}},{"code_sha256_prefix":"3358374eed4646e4","entry":"shuffle","repo":"gair-nlp/octothinker","repo_kind":"official","path":"eval/utils.py","file_url":"https://github.com/gair-nlp/octothinker/blob/HEAD/eval/utils.py","link_basis":"first_harvest_node","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":"3358374eed4646e4"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}