Chain-of-Thought in Neural Code Generation: From and For Lightweight Language Models
On the map: LLM reasoning → Reasoning for agents, planning and code
Abstract (arXiv)
Large Language Models (LLMs) have demonstrated remarkable potential in code generation. The integration of Chain of Thought (CoT) reasoning can further boost their performance. However, current CoT methods often require manual writing or LLMs with over 100 billion parameters to generate, impeding their applicability in resource-constrained scenarios. In this study, we investigate lightweight Language Models (lLMs), which are defined to have fewer than 10 billion parameters. Empirically, we find that most lLMs cannot generate high-quality CoTs when prompted by the few-shot method, but can take advantage of high-quality CoTs generated elsewhere to improve their performance in code generation. Based on these findings, we design a novel approach COTTON which can leverage lLMs to automatically generate CoTs for code generation. We synthesize new datasets and conduct extensive experiments on various benchmarks. The results show that the CoTs generated by COTTON outperform the baselines in terms of automated and human evaluation metrics. In particular, the CoTs generated by COTTON boost various lLMs to achieve higher performance gains than those generated by LLMs such as ChatGLM (130B), and are competitive with those generated by gpt-3.5-turbo (175B). Our study also showcases the potential of lLMs in software engineering applications.
Key facts. Cited by 27 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 14 of its 109 references that are in the map. First posted on arXiv 9 Dec 2023.
Builds on
14 of 109 references.
Closest ancestors · 2
Same direction, newest first
- 2023Structured Chain-of-Thought Prompting for Code Generation11 May
- 2022Competition-Level Code Generation with AlphaCode8 Feb
Other references · 12
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
- 2022Large Language Models are Zero-Shot Reasonerscited by 4,323
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,397
- 2022Towards Reasoning in Large Language Models: A Surveycited by 593
- 2022Selection-Inference: Exploiting Large Language Models for Interpretable Logical Reasoningcited by 331
- 2022Large Language Models Are Reasoning Teacherscited by 318
- 2022Reasoning with Language Model Prompting: A Surveycited by 251
- 2023Specializing Smaller Language Models towards Multi-Step Reasoningcited by 249
- 2022Rethinking with Retrieval: Faithful Large Language Model Inferencecited by 145
- 2023Symbolic Chain-of-Thought Distillation: Small Models Can Also "Think" Step-by-Stepcited by 144
Built on by
Citing papers per year: 2024: 2; 2025: 12; 2026: 13.
27 papers.
Sort:
By area:
- 2024Making Reasoning Matter: Measuring and Improving Faithfulness of Chain-of-Thought Reasoningcited by 108
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMscited by 47
- 2025Chain-of-Thought Prompting Obscures Hallucination Cues in Large Language Models: An Empirical Evaluationcited by 20
- 2025VeriThoughts: Enabling Automated Verilog Code Generation using Reasoning and Formal Verificationcited by 15
- 2025Issue-Oriented Agent-Based Framework for Automated Review Comment Generationcited by 4
- 2025Designing LLM-based Multi-Agent Systems for Software Engineering Tasks: Quality Attributes, Design Patterns and Rationalecited by 3
- 2026Supervised Fine-Tuning versus Reinforcement Learning: A Study of Post-Training Methods for Large Language Modelscited by 3
- 2026Falsification, Not Exposure: An Internally Preregistered Placebo-Controlled Decomposition of Self-Repair Feedback in Frozen Small Code Modelscited by 3
- 2025Boost, Disentangle, and Customize: A Robust System2-to-System1 Pipeline for Code Generationcited by 2
- 2025Optimizing Token Consumption in LLMs: A Nano Surge Approach for Code Reasoning Efficiencycited by 2
- 2025Adversarial Reasoning for Repair Based on Inferred Program Intentcited by 2
15 more
- 2025Code-Driven Inductive Synthesis: Enhancing Reasoning Abilities of Large Language Models with Sequencescited by 1
- 2025CODE-DITING: A Reasoning-Based Metric for Functional Alignment in Code Evaluationcited by 1
- 2025The Cream Rises to the Top: Efficient Reranking Method for Verilog Code Generationcited by 1
- 2025Rethinking Reasoning: A Survey on Reasoning-based Backdoors in LLMscited by 1
- 2026Unseen-Codebases-Domain Data Synthesis and Training Based on Code Graphscited by 1
- 2026Can LLM Aid in Solving Constraints with Inductive Definitions?cited by 1
- 2026CrystalReasoner: Reasoning and RL for Property-Conditioned Crystal Structure Generationcited by 1
- 2026Developing LLM-based Multi-Agent Systems in Software Engineering: A Mixed-Method Experience Reportcited by 1
- 2026Toward Non-Expert Customized Congestion Control: Large Language Model-Assisted CCA Code Generation with eBPF Deploymentcited by 0
- 2026Design-Specification Tiling for ICL-based CAD Code Generationcited by 0
- 2026Temperature-Dependent Performance of Prompting Strategies in Extended Reasoning Large Language Modelscited by 0
- 2026CollabCoder: Plan-Code Co-Evolution via Collaborative Decision-Making for Efficient Code Generationcited by 0
- 2026Improving LLM Code Generation via Requirement-Aware Curriculum Reinforcement Learningcited by 0
- 2026Repository-Level Solidity Code Generation with Large Language Models: From Prompting to Fine-Tuningcited by 0
- 2026CIT-CAD: Constraint Intent Tree-based CAD Code Generation and Verificationcited by 0
- 2026CIT-CAD: Constraint Intent Tree-based CAD Code Generation and Verification7 Sep 2026
- 2026Developing LLM-based Multi-Agent Systems in Software Engineering: A Mixed-Method Experience Report12 Aug 2026
- 2026Falsification, Not Exposure: An Internally Preregistered Placebo-Controlled Decomposition of Self-Repair Feedback in Frozen Small Code Models30 Jun 2026
- 2026Repository-Level Solidity Code Generation with Large Language Models: From Prompting to Fine-Tuning18 Jun 2026
- 2026CrystalReasoner: Reasoning and RL for Property-Conditioned Crystal Structure Generation14 May 2026
- 2026Improving LLM Code Generation via Requirement-Aware Curriculum Reinforcement Learning1 May 2026
- 2026CollabCoder: Plan-Code Co-Evolution via Collaborative Decision-Making for Efficient Code Generation15 Apr 2026
- 2026Temperature-Dependent Performance of Prompting Strategies in Extended Reasoning Large Language Models18 Mar 2026
- 2026Supervised Fine-Tuning versus Reinforcement Learning: A Study of Post-Training Methods for Large Language Models14 Mar 2026
- 2026Design-Specification Tiling for ICL-based CAD Code Generation13 Mar 2026
- 2026Can LLM Aid in Solving Constraints with Inductive Definitions?4 Mar 2026
- 2026Unseen-Codebases-Domain Data Synthesis and Training Based on Code Graphs24 Feb 2026
15 more
- 2026Toward Non-Expert Customized Congestion Control: Large Language Model-Assisted CCA Code Generation with eBPF Deployment30 Jan 2026
- 2025Designing LLM-based Multi-Agent Systems for Software Engineering Tasks: Quality Attributes, Design Patterns and Rationale11 Nov 2025
- 2025Issue-Oriented Agent-Based Framework for Automated Review Comment Generation1 Nov 2025
- 2025Rethinking Reasoning: A Survey on Reasoning-based Backdoors in LLMs9 Oct 2025
- 2025The Cream Rises to the Top: Efficient Reranking Method for Verilog Code Generation24 Sep 2025
- 2025Chain-of-Thought Prompting Obscures Hallucination Cues in Large Language Models: An Empirical Evaluation20 Jun 2025
- 2025CODE-DITING: A Reasoning-Based Metric for Functional Alignment in Code Evaluation26 May 2025
- 2025Adversarial Reasoning for Repair Based on Inferred Program Intent19 May 2025
- 2025VeriThoughts: Enabling Automated Verilog Code Generation using Reasoning and Formal Verification16 May 2025
- 2025Optimizing Token Consumption in LLMs: A Nano Surge Approach for Code Reasoning Efficiency22 Apr 2025
- 2025Code-Driven Inductive Synthesis: Enhancing Reasoning Abilities of Large Language Models with Sequences17 Mar 2025
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMs26 Feb 2025
- 2025Boost, Disentangle, and Customize: A Robust System2-to-System1 Pipeline for Code Generation18 Feb 2025
- 2024Agents in Software Engineering: Survey, Landscape, and Vision13 Sep 2024
- 2024Making Reasoning Matter: Measuring and Improving Faithfulness of Chain-of-Thought Reasoning21 Feb 2024
- 2024Making Reasoning Matter: Measuring and Improving Faithfulness of Chain-of-Thought Reasoningcited by 108
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMscited by 47
- 2025Chain-of-Thought Prompting Obscures Hallucination Cues in Large Language Models: An Empirical Evaluationcited by 20
- 2025Boost, Disentangle, and Customize: A Robust System2-to-System1 Pipeline for Code Generationcited by 2
- 2025Optimizing Token Consumption in LLMs: A Nano Surge Approach for Code Reasoning Efficiencycited by 2
- 2025Adversarial Reasoning for Repair Based on Inferred Program Intentcited by 2
- 2025Code-Driven Inductive Synthesis: Enhancing Reasoning Abilities of Large Language Models with Sequencescited by 1
- 2025CODE-DITING: A Reasoning-Based Metric for Functional Alignment in Code Evaluationcited by 1
- 2025Rethinking Reasoning: A Survey on Reasoning-based Backdoors in LLMscited by 1
- 2026CrystalReasoner: Reasoning and RL for Property-Conditioned Crystal Structure Generationcited by 1
- 2026Temperature-Dependent Performance of Prompting Strategies in Extended Reasoning Large Language Modelscited by 0
- 2026CrystalReasoner: Reasoning and RL for Property-Conditioned Crystal Structure Generation14 May 2026
- 2026Temperature-Dependent Performance of Prompting Strategies in Extended Reasoning Large Language Models18 Mar 2026
- 2025Rethinking Reasoning: A Survey on Reasoning-based Backdoors in LLMs9 Oct 2025
- 2025Chain-of-Thought Prompting Obscures Hallucination Cues in Large Language Models: An Empirical Evaluation20 Jun 2025
- 2025CODE-DITING: A Reasoning-Based Metric for Functional Alignment in Code Evaluation26 May 2025
- 2025Adversarial Reasoning for Repair Based on Inferred Program Intent19 May 2025
- 2025Optimizing Token Consumption in LLMs: A Nano Surge Approach for Code Reasoning Efficiency22 Apr 2025
- 2025Code-Driven Inductive Synthesis: Enhancing Reasoning Abilities of Large Language Models with Sequences17 Mar 2025
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMs26 Feb 2025
- 2025Boost, Disentangle, and Customize: A Robust System2-to-System1 Pipeline for Code Generation18 Feb 2025
- 2024Making Reasoning Matter: Measuring and Improving Faithfulness of Chain-of-Thought Reasoning21 Feb 2024
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2025Issue-Oriented Agent-Based Framework for Automated Review Comment Generationcited by 4
- 2025Designing LLM-based Multi-Agent Systems for Software Engineering Tasks: Quality Attributes, Design Patterns and Rationalecited by 3
- 2026Developing LLM-based Multi-Agent Systems in Software Engineering: A Mixed-Method Experience Reportcited by 1
- 2026Developing LLM-based Multi-Agent Systems in Software Engineering: A Mixed-Method Experience Report12 Aug 2026
- 2025Designing LLM-based Multi-Agent Systems for Software Engineering Tasks: Quality Attributes, Design Patterns and Rationale11 Nov 2025
- 2025Issue-Oriented Agent-Based Framework for Automated Review Comment Generation1 Nov 2025
- 2024Agents in Software Engineering: Survey, Landscape, and Vision13 Sep 2024
- 2025VeriThoughts: Enabling Automated Verilog Code Generation using Reasoning and Formal Verificationcited by 15
- 2026Supervised Fine-Tuning versus Reinforcement Learning: A Study of Post-Training Methods for Large Language Modelscited by 3
- 2026Falsification, Not Exposure: An Internally Preregistered Placebo-Controlled Decomposition of Self-Repair Feedback in Frozen Small Code Modelscited by 3
- 2025The Cream Rises to the Top: Efficient Reranking Method for Verilog Code Generationcited by 1
- 2026Can LLM Aid in Solving Constraints with Inductive Definitions?cited by 1
- 2026Toward Non-Expert Customized Congestion Control: Large Language Model-Assisted CCA Code Generation with eBPF Deploymentcited by 0
- 2026Design-Specification Tiling for ICL-based CAD Code Generationcited by 0
- 2026CollabCoder: Plan-Code Co-Evolution via Collaborative Decision-Making for Efficient Code Generationcited by 0
- 2026Improving LLM Code Generation via Requirement-Aware Curriculum Reinforcement Learningcited by 0
- 2026CIT-CAD: Constraint Intent Tree-based CAD Code Generation and Verificationcited by 0
- 2026CIT-CAD: Constraint Intent Tree-based CAD Code Generation and Verification7 Sep 2026
- 2026Falsification, Not Exposure: An Internally Preregistered Placebo-Controlled Decomposition of Self-Repair Feedback in Frozen Small Code Models30 Jun 2026
- 2026Improving LLM Code Generation via Requirement-Aware Curriculum Reinforcement Learning1 May 2026
- 2026CollabCoder: Plan-Code Co-Evolution via Collaborative Decision-Making for Efficient Code Generation15 Apr 2026
- 2026Supervised Fine-Tuning versus Reinforcement Learning: A Study of Post-Training Methods for Large Language Models14 Mar 2026
- 2026Design-Specification Tiling for ICL-based CAD Code Generation13 Mar 2026
- 2026Can LLM Aid in Solving Constraints with Inductive Definitions?4 Mar 2026
- 2026Toward Non-Expert Customized Congestion Control: Large Language Model-Assisted CCA Code Generation with eBPF Deployment30 Jan 2026
- 2025The Cream Rises to the Top: Efficient Reranking Method for Verilog Code Generation24 Sep 2025
- 2025VeriThoughts: Enabling Automated Verilog Code Generation using Reasoning and Formal Verification16 May 2025
Similar, not cited
Close in wording, no citation either way
- 2025Understanding Chain-of-Thought Effectiveness in Code Generation: An Empirical and Information-Theoretic Analysis
- 2024Low-Cost Language Models: Survey and Performance Evaluation on Python Code Generation
- 2025Are They All Good? Evaluating the Quality of CoTs in LLM-based Code Generation
- 2024Enhancing Code Generation Performance of Smaller Models by Distilling the Reasoning Ability of LLMs
- 2024Assessing Code Generation with Intermediate Languages
- 2025Code Execution as Grounded Supervision for LLM Reasoning
- 2025Scaling Code-Assisted Chain-of-Thoughts and Instructions for Model Reasoning
- 2025Uncertainty-Guided Chain-of-Thought for Code Generation with LLMs