{"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/implicit-reasoning-in-transformers-is","title":"Implicit Reasoning in Transformers is Reasoning through Shortcuts","arxiv_id":"2503.07604","date":"2025-03-10","proceeding":null,"authors":["Tianhe Lin","Jian Xie","Siyu Yuan","Deqing Yang"],"abstract":"Test-time compute is emerging as a new paradigm for enhancing language models' complex multi-step reasoning capabilities, as demonstrated by the success of OpenAI's o1 and o3, as well as DeepSeek's R1. Compared to explicit reasoning in test-time compute, implicit reasoning is more inference-efficient, requiring fewer generated tokens. However, why does the advanced reasoning capability fail to emerge in the implicit reasoning style? In this work, we train GPT-2 from scratch on a curated multi-step mathematical reasoning dataset and conduct analytical experiments to investigate how language models perform implicit reasoning in multi-step tasks. Our findings reveal: 1) Language models can perform step-by-step reasoning and achieve high accuracy in both in-domain and out-of-domain tests via implicit reasoning. However, this capability only emerges when trained on fixed-pattern data. 2) Conversely, implicit reasoning abilities emerging from training on unfixed-pattern data tend to overfit a specific pattern and fail to generalize further. Notably, this limitation is also observed in state-of-the-art large language models. These findings suggest that language models acquire implicit reasoning through shortcut learning, enabling strong performance on tasks with similar patterns while lacking generalization.","url_abs":"https://arxiv.org/abs/2503.07604v1","url_pdf":"https://arxiv.org/pdf/2503.07604v1.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":"implicit-reasoning-in-transformers-is","repo_url":"https://github.com/TianheL/LM-Implicit-Reasoning","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"mathematical-reasoning","task_name":"Mathematical Reasoning"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"cosine-annealing","method_name":"Cosine Annealing"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"discriminative-fine-tuning","method_name":"Discriminative Fine-Tuning"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"gpt-2","method_name":"GPT-2"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-cosine-annealing","method_name":"Linear Warmup With Cosine Annealing"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2503.07604","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2503.07604"}},"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/TianheL/LM-Implicit-Reasoning","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":1,"ran_draft_wrong":1,"unverified":5},"by_repo_kind":{"official":{"samples":7,"ran":2,"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":"dbea5358be6b5ad0","entry":"create_score_evaluation_response","repo":"TianheL/LM-Implicit-Reasoning","repo_kind":"official","path":"src/LLaMA-Factory-main/src/llamafactory/api/chat.py","file_url":"https://github.com/TianheL/LM-Implicit-Reasoning/blob/HEAD/src/LLaMA-Factory-main/src/llamafactory/api/chat.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":"dbea5358be6b5ad0"}},{"code_sha256_prefix":"e03d53ba9d4f9ae5","entry":"rotate_half","repo":"TianheL/LM-Implicit-Reasoning","repo_kind":"official","path":"src/model/modeling_gpt2_rope.py","file_url":"https://github.com/TianheL/LM-Implicit-Reasoning/blob/HEAD/src/model/modeling_gpt2_rope.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e03d53ba9d4f9ae5"}},{"code_sha256_prefix":"be41b9c696d434d2","entry":"apply_rotary_pos_emb","repo":"TianheL/LM-Implicit-Reasoning","repo_kind":"official","path":"src/model/modeling_gpt2_rope.py","file_url":"https://github.com/TianheL/LM-Implicit-Reasoning/blob/HEAD/src/model/modeling_gpt2_rope.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":"be41b9c696d434d2"}},{"code_sha256_prefix":"0fd288bf0e1555c6","entry":"gen","repo":"TianheL/LM-Implicit-Reasoning","repo_kind":"official","path":"src/testllm/gen_testdata.py","file_url":"https://github.com/TianheL/LM-Implicit-Reasoning/blob/HEAD/src/testllm/gen_testdata.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":"0fd288bf0e1555c6"}},{"code_sha256_prefix":"eb2b917ac6fc018f","entry":"get_num","repo":"TianheL/LM-Implicit-Reasoning","repo_kind":"official","path":"src/testllm/gen_testdata.py","file_url":"https://github.com/TianheL/LM-Implicit-Reasoning/blob/HEAD/src/testllm/gen_testdata.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":"eb2b917ac6fc018f"}},{"code_sha256_prefix":"944e75717d55e61e","entry":"is_integer_in_range","repo":"TianheL/LM-Implicit-Reasoning","repo_kind":"official","path":"src/testllm/gen_testdata.py","file_url":"https://github.com/TianheL/LM-Implicit-Reasoning/blob/HEAD/src/testllm/gen_testdata.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":"944e75717d55e61e"}},{"code_sha256_prefix":"d9ab7c4a042d88f4","entry":"reorder_equations","repo":"TianheL/LM-Implicit-Reasoning","repo_kind":"official","path":"src/eval/inference_testset.py","file_url":"https://github.com/TianheL/LM-Implicit-Reasoning/blob/HEAD/src/eval/inference_testset.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":"d9ab7c4a042d88f4"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}