{"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/unveiling-the-mechanisms-of-explicit-cot","title":"Unveiling the Mechanisms of Explicit CoT Training: How CoT Enhances Reasoning Generalization","arxiv_id":"2502.04667","date":"2025-02-07","proceeding":null,"authors":["Xinhao Yao","Ruifeng Ren","Yun Liao","Yong liu"],"abstract":"The integration of explicit Chain-of-Thought (CoT) reasoning into training large language models (LLMs) has advanced their reasoning capabilities, yet the mechanisms by which CoT enhances generalization remain poorly understood. This work investigates (1) \\textit{how} CoT training reshapes internal model representations and (2) \\textit{why} it improves both in-distribution (ID) and out-of-distribution (OOD) reasoning generalization. Through controlled experiments and theoretical analysis, we derive the following key insights. \\textbf{1)} Structural Advantage: CoT training internalizes reasoning into a two-stage generalizing circuit, where the number of stages corresponds to the explicit reasoning steps during training. Notably, CoT-trained models resolve intermediate results at shallower layers compared to non-CoT counterparts, freeing up deeper layers to specialize in subsequent reasoning steps. \\textbf{2)} Theoretical Analysis: the information-theoretic generalization bounds via distributional divergence can be decomposed into ID and OOD components. While ID error diminishes with sufficient training regardless of CoT, OOD error critically depends on CoT: Non-CoT training fails to generalize to OOD samples due to unseen reasoning patterns, whereas CoT training achieves near-perfect OOD generalization by mastering subtasks and reasoning compositions during training. The identified mechanisms explain our experimental results: CoT training accelerates convergence and enhances generalization from ID to both ID and OOD scenarios while maintaining robust performance even with tolerable noise. These findings are further validated on complex real-world datasets. This paper offers valuable insights for designing CoT strategies to enhance LLM reasoning robustness.","url_abs":"https://arxiv.org/abs/2502.04667v2","url_pdf":"https://arxiv.org/pdf/2502.04667v2.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":"unveiling-the-mechanisms-of-explicit-cot","repo_url":"https://github.com/chen123ctrls/t-cotmechanism","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"jax","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"generalization-bounds","task_name":"Generalization Bounds"},{"task_slug":"systematic-generalization","task_name":"Systematic Generalization"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2502.04667","atlas_url":"https://app.syntology.ai/?focus=2502.04667","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2502.04667"}},"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/chen123ctrls/t-cotmechanism","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":7,"ran_honours":1,"ran_draft_wrong":1,"unverified":1},"by_repo_kind":{"official":{"samples":10,"ran":9,"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":"cabf394868b62573","entry":"add_step_noise_to_gsm_fobar","repo":"chen123ctrls/t-cotmechanism","repo_kind":"official","path":"RealisticDataVerification/data_process.py","file_url":"https://github.com/chen123ctrls/t-cotmechanism/blob/HEAD/RealisticDataVerification/data_process.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":"cabf394868b62573"}},{"code_sha256_prefix":"d49412b3a690206e","entry":"batch_data","repo":"chen123ctrls/t-cotmechanism","repo_kind":"official","path":"RealisticDataVerification/utils/gen_vllm.py","file_url":"https://github.com/chen123ctrls/t-cotmechanism/blob/HEAD/RealisticDataVerification/utils/gen_vllm.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":"d49412b3a690206e"}},{"code_sha256_prefix":"a3ae250c1e40eeef","entry":"eval_items","repo":"chen123ctrls/t-cotmechanism","repo_kind":"official","path":"ControlledExperiments/eval_qa.py","file_url":"https://github.com/chen123ctrls/t-cotmechanism/blob/HEAD/ControlledExperiments/eval_qa.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":"a3ae250c1e40eeef"}},{"code_sha256_prefix":"bedd2bb861320f0e","entry":"eval_res","repo":"chen123ctrls/t-cotmechanism","repo_kind":"official","path":"ControlledExperiments/eval_qa.py","file_url":"https://github.com/chen123ctrls/t-cotmechanism/blob/HEAD/ControlledExperiments/eval_qa.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bedd2bb861320f0e"}},{"code_sha256_prefix":"3d999b95009c7537","entry":"get_config_class_from_processor_class","repo":"chen123ctrls/t-cotmechanism","repo_kind":"official","path":"ControlledExperiments/transformers/utils/create_dummy_models.py","file_url":"https://github.com/chen123ctrls/t-cotmechanism/blob/HEAD/ControlledExperiments/transformers/utils/create_dummy_models.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":"3d999b95009c7537"}},{"code_sha256_prefix":"0c0b81b081919d8e","entry":"get_processor_types_from_config_class","repo":"chen123ctrls/t-cotmechanism","repo_kind":"official","path":"ControlledExperiments/transformers/utils/create_dummy_models.py","file_url":"https://github.com/chen123ctrls/t-cotmechanism/blob/HEAD/ControlledExperiments/transformers/utils/create_dummy_models.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":"0c0b81b081919d8e"}},{"code_sha256_prefix":"bc440fba1f01ba1e","entry":"modify_output","repo":"chen123ctrls/t-cotmechanism","repo_kind":"official","path":"RealisticDataVerification/data_process.py","file_url":"https://github.com/chen123ctrls/t-cotmechanism/blob/HEAD/RealisticDataVerification/data_process.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":"bc440fba1f01ba1e"}},{"code_sha256_prefix":"62ef5378e10da132","entry":"parse_target","repo":"chen123ctrls/t-cotmechanism","repo_kind":"official","path":"ControlledExperiments/eval_qa.py","file_url":"https://github.com/chen123ctrls/t-cotmechanism/blob/HEAD/ControlledExperiments/eval_qa.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"62ef5378e10da132"}},{"code_sha256_prefix":"aea562a62336c08f","entry":"read_data_source_target","repo":"chen123ctrls/t-cotmechanism","repo_kind":"official","path":"ControlledExperiments/utils.py","file_url":"https://github.com/chen123ctrls/t-cotmechanism/blob/HEAD/ControlledExperiments/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":"aea562a62336c08f"}},{"code_sha256_prefix":"b176efb26f72e507","entry":"get_architectures_from_config_class","repo":"chen123ctrls/t-cotmechanism","repo_kind":"official","path":"ControlledExperiments/transformers/utils/create_dummy_models.py","file_url":"https://github.com/chen123ctrls/t-cotmechanism/blob/HEAD/ControlledExperiments/transformers/utils/create_dummy_models.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":"b176efb26f72e507"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}