A Study on Thinking Patterns of Large Reasoning Models in Code Generation
On the map: LLM reasoning → Reasoning for agents, planning and code
Abstract (arXiv)
Currently, many large language models (LLMs) are utilized for software engineering tasks such as code generation. The emergence of more advanced models known as large reasoning models (LRMs), such as OpenAI's o3, DeepSeek R1, and Qwen3. They have demonstrated the capability of performing multi-step reasoning. Despite the advancement in LRMs, little attention has been paid to systematically analyzing the reasoning patterns these models exhibit and how such patterns influence the generated code. This paper presents a comprehensive study aimed at investigating and uncovering the reasoning behavior of LRMs during code generation. We prompted several state-of-the-art LRMs of varying sizes with code generation tasks and applied open coding to manually annotate the reasoning traces. From this analysis, we derive a taxonomy of LRM reasoning behaviors, encompassing 15 reasoning actions across four phases. Our empirical study based on the taxonomy reveals a series of findings. First, we identify common reasoning patterns, showing that LRMs generally follow a human-like coding workflow, with more complex tasks eliciting additional actions such as scaffolding, flaw detection, and style checks. Second, we compare reasoning across models, finding that Qwen3 exhibits iterative reasoning while DeepSeek-R1-7B follows a more linear, waterfall-like approach. Third, we analyze the relationship between reasoning and code correctness, showing that actions such as unit test creation and scaffold generation strongly support functional outcomes, with LRMs adapting strategies based on task context. Finally, we evaluate lightweight prompting strategies informed by these findings, demonstrating the potential of context- and reasoning-oriented prompts to improve LRM-generated code. Our results offer insights and practical implications for advancing automatic code generation.
Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 21 of its 43 references that are in the map. First posted on arXiv 17 Sep 2025.
Builds on
21 of 43 references.
Closest ancestors · 3
Same direction, newest first
- 2024Qwen2.5-Coder Technical Report18 Sep
- 2024OpenCodeInterpreter: Integrating Code Generation with Execution and Refinement22 Feb
- 2024CodeMind: Evaluating Large Language Models for Code Reasoning15 Feb
Other references · 18
- 2021Training Verifiers to Solve Math Word Problemscited by 10,109
- 2025Qwen3 Technical Reportcited by 8,820
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2025DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learningcited by 6,330
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 399
- 2024CodeAgent: Enhancing Code Generation with Tool-Integrated Agent Systems for Real-World Repo-level Coding Challengescited by 282
- 2023ClassEval: A Manually-Crafted Benchmark for Evaluating LLMs on Class-level Code Generationcited by 168
- 2024Multi-Step Reasoning with Large Language Models, a Surveycited by 143
- 2025DeepSeek-R1 Thoughtology: Let's think about LLM Reasoningcited by 92
- 2024DevEval: A Manually-Annotated Code Generation Benchmark Aligned with Real-World Code Repositoriescited by 72
6 more
- 2025Reasoning Language Models: A Blueprintcited by 42
- 2023AceCoder: Utilizing Existing Code to Enhance Code Generationcited by 25
- 2025Thinking Machines: A Survey of LLM based Reasoning Strategiescited by 25
- 2025Exploring LLM Reasoning Through Controlled Prompt Variationscited by 10
- 2025Helpful Agent Meets Deceptive Judge: Understanding Vulnerabilities in Agentic Workflowscited by 7
- 2025Evaluating and Improving Large Language Models for Competitive Program Generationcited by 3
Built on by
Citing papers per year: 2026: 5.
5 papers.
- 2026GanitLLM: Difficulty-Aware Bengali Mathematical Reasoning through Curriculum-GRPOcited by 6
- 2026LawThinker: A Deep Research Legal Agent in Dynamic Environmentscited by 4
- 2026Understanding Conversational Patterns in Multi-agent Programming: A Case Study on Fibonacci Game Developmentcited by 1
- 2026Cognitive Profiling of LRMs' Reasoning Traces Using Bloom's Taxonomycited by 0
- 2026ThinkFuse: Trajectory-Aware Test-Time Fusion for Small Reasoning Modelscited by 0
- 2026ThinkFuse: Trajectory-Aware Test-Time Fusion for Small Reasoning Models6 Oct 2026
- 2026Cognitive Profiling of LRMs' Reasoning Traces Using Bloom's Taxonomy24 Aug 2026
- 2026Understanding Conversational Patterns in Multi-agent Programming: A Case Study on Fibonacci Game Development22 May 2026
- 2026LawThinker: A Deep Research Legal Agent in Dynamic Environments12 Feb 2026
- 2026GanitLLM: Difficulty-Aware Bengali Mathematical Reasoning through Curriculum-GRPO11 Jan 2026
Similar, not cited
Close in wording, no citation either way
- 2025An Empirical Study of Reasoning Steps in Thinking Code LLMs
- 2025Your thoughts tell who you are: Characterize the reasoning patterns of LRMs
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMs
- 2024Enhancing Code Generation Performance of Smaller Models by Distilling the Reasoning Ability of LLMs
- 2025Unveiling the Magic of Code Reasoning through Hypothesis Decomposition and Amendment
- 2025Think Like Human Developers: Harnessing Community Knowledge for Structured Code Reasoning
- 2025Evaluating Code Reasoning Abilities of Large Language Models Under Real-World Settings
- 2025Code Execution as Grounded Supervision for LLM Reasoning