Chain of Code: Reasoning with a Language Model-Augmented Code Emulator
On the map: LLM reasoning → Reasoning for agents, planning and code
Abstract (arXiv)
Code provides a general syntactic structure to build complex programs and perform precise computations when paired with a code interpreter - we hypothesize that language models (LMs) can leverage code-writing to improve Chain of Thought reasoning not only for logic and arithmetic tasks, but also for semantic ones (and in particular, those that are a mix of both). For example, consider prompting an LM to write code that counts the number of times it detects sarcasm in an essay: the LM may struggle to write an implementation for "detect_sarcasm(string)" that can be executed by the interpreter (handling the edge cases would be insurmountable). However, LMs may still produce a valid solution if they not only write code, but also selectively "emulate" the interpreter by generating the expected output of "detect_sarcasm(string)". In this work, we propose Chain of Code (CoC), a simple yet surprisingly effective extension that improves LM code-driven reasoning. The key idea is to encourage LMs to format semantic sub-tasks in a program as flexible pseudocode that the interpreter can explicitly catch undefined behaviors and hand off to simulate with an LM (as an "LMulator"). Experiments demonstrate that Chain of Code outperforms Chain of Thought and other baselines across a variety of benchmarks; on BIG-Bench Hard, Chain of Code achieves 84%, a gain of 12% over Chain of Thought. In a nutshell, CoC broadens the scope of reasoning questions that LMs can answer by "thinking in code".
Key facts. Cited by 120 papers in the map (data through 7 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 44 of its 49 references that are in the map. First posted on arXiv 7 Dec 2023.
Builds on
44 of 49 references.
Closest ancestors · 2
Same direction, newest first
- 2023ART: Automatic multi-step reasoning and tool-use for large language models16 Mar
- 2022Competition-Level Code Generation with AlphaCode8 Feb
Other references · 42
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2021Training Verifiers to Solve Math Word Problemscited by 9,743
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
- 2022Large Language Models are Zero-Shot Reasonerscited by 4,323
- 2023Toolformer: Language Models Can Teach Themselves to Use Toolscited by 4,072
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2023Grounding DINO: Marrying DINO with Grounded Pre-Training for Open-Set Object Detectioncited by 3,274
30 more
- 2023Tree of Thoughts: Deliberate Problem Solving with Large Language Modelscited by 3,155
- 2022Emergent Abilities of Large Language Modelscited by 2,483
- 2023Voyager: An Open-Ended Embodied Agent with Large Language Modelscited by 2,081
- 2022Beyond the Imitation Game: Quantifying and extrapolating the capabilities of language modelscited by 1,970
- 2023ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIscited by 1,880
- 2022Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Themcited by 1,767
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
- 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,397
- 2022Solving Quantitative Reasoning Problems with Language Modelscited by 1,359
- 2022Code as Policies: Language Model Programs for Embodied Controlcited by 1,172
- 2023PaLM 2 Technical Reportcited by 1,154
- 2022Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Taskscited by 1,057
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2023Graph of Thoughts: Solving Elaborate Problems with Large Language Modelscited by 873
- 2021Show Your Work: Scratchpads for Intermediate Computation with Language Modelscited by 871
- 2023Large Language Models as Optimizerscited by 830
- 2023CRITIC: Large Language Models Can Self-Correct with Tool-Interactive Critiquingcited by 751
- 2022PAL: Program-aided Language Modelscited by 635
- 2022Mixture-of-Experts with Expert Choice Routingcited by 611
- 2022ProgPrompt: Generating Situated Robot Task Plans using Large Language Modelscited by 598
- 2023ViperGPT: Visual Inference via Python Execution for Reasoningcited by 591
- 2022Decomposed Prompting: A Modular Approach for Solving Complex Taskscited by 554
- 2023Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought Reasoning by Large Language Modelscited by 550
- 2022Socratic Models: Composing Zero-Shot Multimodal Reasoning with Languagecited by 513
- 2023Augmented Language Models: a Surveycited by 398
- 2022TALM: Tool Augmented Language Modelscited by 197
- 2023Large Language Models as General Pattern Machinescited by 196
- 2023Solving Challenging Math Word Problems Using GPT-4 Code Interpreter with Code-based Self-Verificationcited by 166
- 2022Language Model Cascadescited by 104
- 2021A Neural Network Solves, Explains, and Generates University Math Problems by Program Synthesis and Few-Shot Learning at Human Levelcited by 96
Built on by
Citing papers per year: 2023: 1; 2024: 44; 2025: 42; 2026: 33.
120 papers.
Sort:
By area:
- 2024A Systematic Survey of Prompt Engineering in Large Language Models: Techniques and Applicationscited by 428
- 2024Data Interpreter: An LLM Agent For Data Sciencecited by 222
- 2024Forest-of-Thought: Scaling Test-Time Compute for Enhancing LLM Reasoningcited by 110
- 2025A Survey of Frontiers in LLM Reasoning: Inference Scaling, Learning to Reason, and Agentic Systemscited by 108
- 2024Functional Benchmarks for Robust Evaluation of Reasoning Performance, and the Reasoning Gapcited by 79
- 2024RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Horizon Generationcited by 75
- 2024Combining Induction and Transduction for Abstract Reasoningcited by 53
- 2024Granite-Function Calling Model: Introducing Function Calling Abilities via Multi-task Learning of Granular Taskscited by 52
- 2024Beyond Chain-of-Thought: A Survey of Chain-of-X Paradigms for LLMscited by 48
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMscited by 47
- 2024A Survey of Prompt Engineering Methods in Large Language Models for Different NLP Taskscited by 46
- 2024From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debuggingcited by 46
38 more
- 2025Open Deep Search: Democratizing Search with Open-source Reasoning Agentscited by 46
- 2026Code as Agent Harnesscited by 40
- 2025ARM: Adaptive Reasoning Modelcited by 38
- 2024Benchmarking Agentic Workflow Generationcited by 36
- 2025Flow-of-Action: SOP Enhanced LLM-Based Multi-Agent System for Root Cause Analysiscited by 32
- 2024CoA-VLA: Improving Vision-Language-Action Models via Visual-Textual Chain-of-Affordancecited by 29
- 2024ROS-LLM: A ROS framework for embodied AI with task feedback and structured reasoningcited by 27
- 2025TIGeR: Tool-Integrated Geometric Reasoning in Vision-Language Models for Roboticscited by 27
- 2024Instance-adaptive Zero-shot Chain-of-Thought Promptingcited by 25
- 2024Steering Large Language Models between Code Execution and Textual Reasoningcited by 24
- 2024EVOR: Evolving Retrieval for Code Generationcited by 22
- 2024StateAct: Enhancing LLM Base Agents via Self-prompting and State-trackingcited by 21
- 2024Code Prompting Elicits Conditional Reasoning Abilities in Text+Code LLMscited by 19
- 2024Divide-and-Conquer Meets Consensus: Unleashing the Power of Functions in Code Generationcited by 19
- 2023Mixed Distillation Helps Smaller Language Model Better Reasoningcited by 18
- 2025Minions: Cost-efficient Collaboration Between On-device and Cloud Language Modelscited by 17
- 2025R1-Code-Interpreter: LLMs Reason with Code via Supervised and Multi-stage Reinforcement Learningcited by 15
- 2025Generalizable End-to-End Tool-Use RL with Synthetic CodeGymcited by 14
- 2025TUMIX: Multi-Agent Test-Time Scaling with Tool-Use Mixturecited by 13
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligencecited by 13
- 2025An Efficient and Precise Training Data Construction Framework for Process-supervised Reward Model in Mathematical Reasoningcited by 12
- 2024Tree-of-Code: A Tree-Structured Exploring Framework for End-to-End Code Generation and Execution in Complex Task Handlingcited by 11
- 2025CodeSteer: Symbolic-Augmented Language Models via Code/Text Guidancecited by 11
- 2025Blueprint First, Model Second: A Framework for Deterministic LLM Workflowcited by 11
- 2024Learning to Reason via Program Generation, Emulation, and Searchcited by 9
- 2024Cognitive Kernel: An Open-source Agent System towards Generalist Autopilotscited by 9
- 2025A Systematic Survey on Large Language Models for Evolutionary Optimization: From Modeling to Solvingcited by 9
- 2024Large Language Models Synergize with Automated Machine Learningcited by 8
- 2024CodeNav: Beyond tool-use to using real-world codebases with LLM agentscited by 8
- 2025Policy Guided Tree Search for Enhanced LLM Reasoningcited by 8
- 2025ARC-GEN: A Mimetic Procedural Benchmark Generator for the Abstraction and Reasoning Corpuscited by 8
- 2024FLARE: Faithful Logic-Aided Reasoning and Explorationcited by 7
- 2025Language-to-Space Programming for Training-Free 3D Visual Groundingcited by 7
- 2025Beyond Single-Task: Robust Multi-Task Length Generalization for LLMscited by 7
- 2026User as Code: Executable Memory for Personalized Agentscited by 7
- 2024Adversarial Math Word Problem Generationcited by 6
- 2025Unveiling the Magic of Code Reasoning through Hypothesis Decomposition and Amendmentcited by 6
- 2025RedTeamLLM: an Agentic AI framework for offensive securitycited by 6
50 most cited of 120 All 120 (JSON)
- 2026LLMs are General Asynchronous Agents28 Sep 2026
- 2026Improving Medical Calculation of LLMs with Embedded Coding25 Sep 2026
- 2026Persuaded, Not Informed: Incentive-Misaligned Witnesses Defeat In-Context Grounding23 Sep 2026
- 2026Compile, Don't Memorize: A Context Compilation Architecture (CCA) for In-Context Learning1 Sep 2026
- 2026ExeCRE: Execution-Consistency Guided Reliability Estimation for Self-Correcting Code Generation5 Aug 2026
- 2026NVIDIA-labs OO Agents: Native Python Object-Oriented Agents22 Jul 2026
- 2026PreAct: Computer-Using Agents that Get Faster on Repeated Tasks16 Jun 2026
- 2026User as Code: Executable Memory for Personalized Agents15 Jun 2026
- 20263D-CoS: A New 3D Reconstruction Paradigm Based on VLM Code Synthesis9 Jun 2026
- 2026SDR: Set-Distance Rewards for Radiology Report Generation30 May 2026
- 2026The Deterministic Horizon: When Extended Reasoning Fails and Tool Delegation Becomes Necessary29 May 2026
- 2026Governed Evolution of Agent Runtimes through Executable Operational Cognition26 May 2026
38 more
- 2026Code as Agent Harness18 May 2026
- 2026Implicit Hierarchical GRPO: Decoupling Tool Invocation from Execution for Tool-Integrated Mathematical Reasoning18 May 2026
- 2026Beyond Individual Intelligence: Surveying Collaboration, Failure Attribution, and Self-Evolution in LLM-based Multi-Agent Systems14 May 2026
- 2026PruneTIR: Inference-Time Tool Call Pruning for Effective yet Efficient Tool-Integrated Reasoning11 May 2026
- 2026Text2Model: Modeling Copilots for Text-to-Model Translation14 Apr 2026
- 2026Structural Anchors and Reasoning Fragility:Understanding CoT Robustness in LLM4Code14 Apr 2026
- 2026MR-Coupler: Automated Metamorphic Test Generation via Functional Coupling Analysis11 Apr 2026
- 2026Agentic Tool Use in Large Language Models1 Apr 2026
- 2026Executing as You Generate: Hiding Execution Latency in LLM Code Interpreters1 Apr 2026
- 2026On the Mirage of Long-Range Dependency, with an Application to Integer Multiplication30 Mar 2026
- 2026Can LLMs Reason Like Automated Theorem Provers for Rust Verification? VCoT-Bench: Evaluating via Verification Chain of Thought18 Mar 2026
- 2026SemRep: Generative Code Representation Learning with Code Transformations13 Mar 2026
- 2026Code2Math: Can Your Code Agent Effectively Evolve Math Problems Through Exploration?3 Mar 2026
- 2026PseudoAct: Leveraging Pseudocode Synthesis for Flexible Planning and Action Control in Large Language Model Agents27 Feb 2026
- 2026Cognitive Models and AI Algorithms Provide Templates for Designing Language Agents26 Feb 2026
- 2026Grounding LLMs in Scientific Discovery via Embodied Actions24 Feb 2026
- 2026Decoding ML Decision: An Agentic Reasoning Framework for Large-Scale Ranking System20 Feb 2026
- 2026Chain of Mindset: Reasoning with Adaptive Cognitive Modes10 Feb 2026
- 2026Bongards at the Boundary of Perception and Reasoning: Programs or Language?3 Feb 2026
- 2026Localizing and Correcting Errors for LLM-based Planners30 Jan 2026
- 2026Guided by Trajectories: Repairing and Rewarding Tool-Use Trajectories for Tool-Integrated Reasoning30 Jan 2026
- 2025Figure It Out: Improve the Frontier of Reasoning with Executable Visual States30 Dec 2025
- 2025Asynchronous Reasoning: Training-Free Interactive Thinking LLMs11 Dec 2025
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligence23 Nov 2025
- 2025textttReMind: Understanding Deductive Code Reasoning in LLMs1 Nov 2025
- 2025ARC-GEN: A Mimetic Procedural Benchmark Generator for the Abstraction and Reasoning Corpus31 Oct 2025
- 2025Code-enabled language models can outperform reasoning models on diverse tasks23 Oct 2025
- 2025TIGeR: Tool-Integrated Geometric Reasoning in Vision-Language Models for Robotics8 Oct 2025
- 2025TUMIX: Multi-Agent Test-Time Scaling with Tool-Use Mixture30 Sep 2025
- 2025Abductive Logical Rule Induction by Bridging Inductive Logic Programming and Multimodal Large Language Models26 Sep 2025
- 2025UniTransfer: Video Concept Transfer via Progressive Spatial and Timestep Decomposition25 Sep 2025
- 2025Understanding Benchmark Language Under Weakened Formal Semantics22 Sep 2025
- 2025Generalizable End-to-End Tool-Use RL with Synthetic CodeGym22 Sep 2025
- 2025A Systematic Survey on Large Language Models for Evolutionary Optimization: From Modeling to Solving10 Sep 2025
- 2025Hell or High Water: Evaluating Agentic Recovery from External Failures14 Aug 2025
- 2025Mixed-Initiative Dialog for Human-Robot Collaborative Manipulation7 Aug 2025
- 2025NeuroSync: Intent-Aware Code-Based Problem Solving via Direct LLM Understanding Modification5 Aug 2025
- 2025Blueprint First, Model Second: A Framework for Deterministic LLM Workflow1 Aug 2025
50 newest of 120 All 120 (JSON)
- 2024Forest-of-Thought: Scaling Test-Time Compute for Enhancing LLM Reasoningcited by 110
- 2025A Survey of Frontiers in LLM Reasoning: Inference Scaling, Learning to Reason, and Agentic Systemscited by 108
- 2024Functional Benchmarks for Robust Evaluation of Reasoning Performance, and the Reasoning Gapcited by 79
- 2024RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Horizon Generationcited by 75
- 2024Combining Induction and Transduction for Abstract Reasoningcited by 53
- 2024Beyond Chain-of-Thought: A Survey of Chain-of-X Paradigms for LLMscited by 48
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMscited by 47
- 2025Open Deep Search: Democratizing Search with Open-source Reasoning Agentscited by 46
- 2025ARM: Adaptive Reasoning Modelcited by 38
- 2024ROS-LLM: A ROS framework for embodied AI with task feedback and structured reasoningcited by 27
- 2025TIGeR: Tool-Integrated Geometric Reasoning in Vision-Language Models for Roboticscited by 27
- 2024Instance-adaptive Zero-shot Chain-of-Thought Promptingcited by 25
12 most cited of 46 All 46 (JSON)
- 2026SDR: Set-Distance Rewards for Radiology Report Generation30 May 2026
- 2026The Deterministic Horizon: When Extended Reasoning Fails and Tool Delegation Becomes Necessary29 May 2026
- 2026Implicit Hierarchical GRPO: Decoupling Tool Invocation from Execution for Tool-Integrated Mathematical Reasoning18 May 2026
- 2026PruneTIR: Inference-Time Tool Call Pruning for Effective yet Efficient Tool-Integrated Reasoning11 May 2026
- 2026Structural Anchors and Reasoning Fragility:Understanding CoT Robustness in LLM4Code14 Apr 2026
- 2026Can LLMs Reason Like Automated Theorem Provers for Rust Verification? VCoT-Bench: Evaluating via Verification Chain of Thought18 Mar 2026
- 2026Chain of Mindset: Reasoning with Adaptive Cognitive Modes10 Feb 2026
- 2026Bongards at the Boundary of Perception and Reasoning: Programs or Language?3 Feb 2026
- 2026Localizing and Correcting Errors for LLM-based Planners30 Jan 2026
- 2026Guided by Trajectories: Repairing and Rewarding Tool-Use Trajectories for Tool-Integrated Reasoning30 Jan 2026
- 2025Asynchronous Reasoning: Training-Free Interactive Thinking LLMs11 Dec 2025
- 2025textttReMind: Understanding Deductive Code Reasoning in LLMs1 Nov 2025
12 newest of 46 All 46 (JSON)
- 2024Data Interpreter: An LLM Agent For Data Sciencecited by 222
- 2024Granite-Function Calling Model: Introducing Function Calling Abilities via Multi-task Learning of Granular Taskscited by 52
- 2026Code as Agent Harnesscited by 40
- 2024Benchmarking Agentic Workflow Generationcited by 36
- 2025Flow-of-Action: SOP Enhanced LLM-Based Multi-Agent System for Root Cause Analysiscited by 32
- 2024StateAct: Enhancing LLM Base Agents via Self-prompting and State-trackingcited by 21
- 2025Generalizable End-to-End Tool-Use RL with Synthetic CodeGymcited by 14
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligencecited by 13
- 2024Cognitive Kernel: An Open-source Agent System towards Generalist Autopilotscited by 9
- 2024CodeNav: Beyond tool-use to using real-world codebases with LLM agentscited by 8
- 2025RedTeamLLM: an Agentic AI framework for offensive securitycited by 6
- 2025Hell or High Water: Evaluating Agentic Recovery from External Failurescited by 6
12 most cited of 27 All 27 (JSON)
- 2026LLMs are General Asynchronous Agents28 Sep 2026
- 2026Persuaded, Not Informed: Incentive-Misaligned Witnesses Defeat In-Context Grounding23 Sep 2026
- 2026NVIDIA-labs OO Agents: Native Python Object-Oriented Agents22 Jul 2026
- 2026PreAct: Computer-Using Agents that Get Faster on Repeated Tasks16 Jun 2026
- 2026Governed Evolution of Agent Runtimes through Executable Operational Cognition26 May 2026
- 2026Code as Agent Harness18 May 2026
- 2026Beyond Individual Intelligence: Surveying Collaboration, Failure Attribution, and Self-Evolution in LLM-based Multi-Agent Systems14 May 2026
- 2026Agentic Tool Use in Large Language Models1 Apr 2026
- 2026Code2Math: Can Your Code Agent Effectively Evolve Math Problems Through Exploration?3 Mar 2026
- 2026PseudoAct: Leveraging Pseudocode Synthesis for Flexible Planning and Action Control in Large Language Model Agents27 Feb 2026
- 2026Cognitive Models and AI Algorithms Provide Templates for Designing Language Agents26 Feb 2026
- 2026Decoding ML Decision: An Agentic Reasoning Framework for Large-Scale Ranking System20 Feb 2026
12 newest of 27 All 27 (JSON)
- 2024EVOR: Evolving Retrieval for Code Generationcited by 22
- 2024EVOR: Evolving Retrieval for Code Generation19 Feb 2024
- 2024A Survey of Prompt Engineering Methods in Large Language Models for Different NLP Taskscited by 46
- 2024From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debuggingcited by 46
- 2024Divide-and-Conquer Meets Consensus: Unleashing the Power of Functions in Code Generationcited by 19
- 2025Blueprint First, Model Second: A Framework for Deterministic LLM Workflowcited by 11
- 2025A Systematic Survey on Large Language Models for Evolutionary Optimization: From Modeling to Solvingcited by 9
- 2024Large Language Models Synergize with Automated Machine Learningcited by 8
- 2025ARC-GEN: A Mimetic Procedural Benchmark Generator for the Abstraction and Reasoning Corpuscited by 8
- 2025Language-to-Space Programming for Training-Free 3D Visual Groundingcited by 7
- 2025Beyond Single-Task: Robust Multi-Task Length Generalization for LLMscited by 7
- 2026User as Code: Executable Memory for Personalized Agentscited by 7
- 2024Adversarial Math Word Problem Generationcited by 6
- 2025Position: Foundation Models for Tabular Data within Systemic Contexts Need Groundingcited by 5
12 most cited of 43 All 43 (JSON)
- 2026Improving Medical Calculation of LLMs with Embedded Coding25 Sep 2026
- 2026Compile, Don't Memorize: A Context Compilation Architecture (CCA) for In-Context Learning1 Sep 2026
- 2026ExeCRE: Execution-Consistency Guided Reliability Estimation for Self-Correcting Code Generation5 Aug 2026
- 2026User as Code: Executable Memory for Personalized Agents15 Jun 2026
- 20263D-CoS: A New 3D Reconstruction Paradigm Based on VLM Code Synthesis9 Jun 2026
- 2026Text2Model: Modeling Copilots for Text-to-Model Translation14 Apr 2026
- 2026MR-Coupler: Automated Metamorphic Test Generation via Functional Coupling Analysis11 Apr 2026
- 2026Executing as You Generate: Hiding Execution Latency in LLM Code Interpreters1 Apr 2026
- 2026On the Mirage of Long-Range Dependency, with an Application to Integer Multiplication30 Mar 2026
- 2026SemRep: Generative Code Representation Learning with Code Transformations13 Mar 2026
- 2026Grounding LLMs in Scientific Discovery via Embodied Actions24 Feb 2026
- 2025Figure It Out: Improve the Frontier of Reasoning with Executable Visual States30 Dec 2025
12 newest of 43 All 43 (JSON)
Similar, not cited
Close in wording, no citation either way
- 2025Scaling Code-Assisted Chain-of-Thoughts and Instructions for Model Reasoning
- 2025Chain of Execution Supervision Promotes General Reasoning in Large Language Models
- 2025On Code-Induced Reasoning in LLMs
- 2025Premise-Augmented Reasoning Chains Improve Error Identification in Math reasoning with LLMs
- 2026Hierarchical Chain-of-Thought: Enhancing LLM Reasoning Performance and Efficiency
- 2024Language Models as Compilers: Simulating Pseudocode Execution Improves Algorithmic Reasoning in Language Models
- 2025An Empirical Study of Reasoning Steps in Thinking Code LLMs
- 2024Break the Chain: Large Language Models Can be Shortcut Reasoners