SemCoder: Training Code Language Models with Comprehensive Semantics Reasoning
On the map: LLM reasoning → Reasoning for agents, planning and code
Abstract (arXiv)
Code Large Language Models (Code LLMs) have excelled at tasks like code completion but often miss deeper semantics such as execution effects and dynamic states. This paper aims to bridge the gap between Code LLMs' reliance on static text data and the need for semantic understanding for complex tasks like debugging and program repair. We introduce a novel strategy, monologue reasoning, to train Code LLMs to reason comprehensive semantics, encompassing high-level functional descriptions, local execution effects of individual statements, and overall input/output behavior, thereby linking static code text with dynamic execution states. We begin by collecting PyX, a clean Python corpus of fully executable code samples with functional descriptions and test cases. We propose training Code LLMs not only to write code but also to understand code semantics by reasoning about key properties, constraints, and execution behaviors using natural language, mimicking human verbal debugging, i.e., rubber-duck debugging. This approach led to the development of SemCoder, a Code LLM with only 6.7B parameters, which shows competitive performance with GPT-3.5-turbo on code generation and execution reasoning tasks. SemCoder achieves 79.3% on HumanEval (GPT-3.5-turbo: 76.8%), 63.6% on CRUXEval-I (GPT-3.5-turbo: 50.3%), and 63.9% on CRUXEval-O (GPT-3.5-turbo: 59.0%). We also study the effectiveness of SemCoder's monologue-style execution reasoning compared to concrete scratchpad reasoning, showing that our approach integrates semantics from multiple dimensions more smoothly. Finally, we demonstrate the potential of applying learned semantics to improve Code LLMs' debugging and self-refining capabilities. Our data, code, and models are available at: https://github.com/ARiSE-Lab/SemCoder.
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 8 of its 57 references that are in the map. First posted on arXiv 3 Jun 2024.
Builds on
8 of 57 references.
Closest ancestors · 1
Same direction, newest first
- 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Code12 Mar
Other references · 7
- 2023StarCoder: may the source be with you!cited by 790
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
- 2023Textbooks Are All You Needcited by 561
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
- 2022The Stack: 3 TB of permissively licensed source codecited by 354
- 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 294
- 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 251
Built on by
Citing papers per year: 2024: 5; 2025: 18; 2026: 4.
27 papers.
Sort:
By area:
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMscited by 47
- 2026Code as Agent Harnesscited by 40
- 2024Reverse Thinking Makes LLMs Stronger Reasonerscited by 29
- 2025EquiBench: Benchmarking Large Language Models' Reasoning about Program Semantics via Equivalence Checkingcited by 23
- 2025Frontier AI's Impact on the Cybersecurity Landscapecited by 21
- 2025CodeARC: Benchmarking Reasoning Capabilities of LLM Agents for Inductive Program Synthesiscited by 15
- 2024What can Large Language Models Capture about Code Functional Equivalence?cited by 13
- 2024Scaling Parameter-Constrained Language Models with Quality Datacited by 12
- 2025CodeSense: a Real-World Benchmark and Dataset for Code Semantic Reasoningcited by 12
- 2025What I cannot execute, I do not understand: Training and Evaluating LLMs on Program Execution Tracescited by 11
- 2025Locus: Agentic Predicate Synthesis for Directed Fuzzingcited by 8
- 2025CoCoNUT: Structural Code Understanding does not fall out of a treecited by 7
15 more
- 2025The Quest for Efficient Reasoning: A Data-Centric Benchmark to CoT Distillationcited by 7
- 2025A Tool for In-depth Analysis of Code Execution Reasoning of Large Language Modelscited by 6
- 2025Disproving Program Equivalence with LLMscited by 5
- 2025Trace Gadgets: Minimizing Code Context for Machine Learning-Based Vulnerability Predictioncited by 5
- 2026FROST: Filtering Reasoning Outliers with Attention for Efficient Reasoningcited by 5
- 2025The Hitchhiker's Guide to Program Analysis, Part II: Deep Thoughts by LLMscited by 4
- 2025EyeMulator: Improving Code Language Models by Mimicking Human Visual Attentioncited by 4
- 2024Mastering the Craft of Data Synthesis for CodeLLMscited by 3
- 2025Do Code Semantics Help? A Comprehensive Study on Execution Trace-Based Information for Code Large Language Modelscited by 3
- 2025CCCI: Code Completion with Contextual Information for Complex Data Transfer Tasks Using Large Language Modelscited by 2
- 2024Morescient GAI for Software Engineering (Extended Version)cited by 1
- 2025Investigating Execution-Aware Language Models for Code Optimizationcited by 1
- 2026Enhancing the Code Reasoning Capabilities of LLMs via Consistency-based Reinforcement Learningcited by 1
- 2025Generating Verifiable Chain of Thoughts from Exection-Tracescited by 0
- 2026Improved Bug Localization with AI Agents Leveraging Hypothesis and Dynamic Cognitioncited by 0
- 2026Code as Agent Harness18 May 2026
- 2026Enhancing the Code Reasoning Capabilities of LLMs via Consistency-based Reinforcement Learning18 May 2026
- 2026FROST: Filtering Reasoning Outliers with Attention for Efficient Reasoning26 Jan 2026
- 2026Improved Bug Localization with AI Agents Leveraging Hypothesis and Dynamic Cognition18 Jan 2026
- 2025Generating Verifiable Chain of Thoughts from Exection-Traces28 Nov 2025
- 2025Do Code Semantics Help? A Comprehensive Study on Execution Trace-Based Information for Code Large Language Models15 Sep 2025
- 2025Locus: Agentic Predicate Synthesis for Directed Fuzzing29 Aug 2025
- 2025EyeMulator: Improving Code Language Models by Mimicking Human Visual Attention22 Aug 2025
- 2025CodeSense: a Real-World Benchmark and Dataset for Code Semantic Reasoning31 May 2025
- 2025The Quest for Efficient Reasoning: A Data-Centric Benchmark to CoT Distillation24 May 2025
- 2025Trace Gadgets: Minimizing Code Context for Machine Learning-Based Vulnerability Prediction18 Apr 2025
- 2025The Hitchhiker's Guide to Program Analysis, Part II: Deep Thoughts by LLMs16 Apr 2025
15 more
- 2025Frontier AI's Impact on the Cybersecurity Landscape7 Apr 2025
- 2025CCCI: Code Completion with Contextual Information for Complex Data Transfer Tasks Using Large Language Models29 Mar 2025
- 2025CodeARC: Benchmarking Reasoning Capabilities of LLM Agents for Inductive Program Synthesis29 Mar 2025
- 2025Investigating Execution-Aware Language Models for Code Optimization11 Mar 2025
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMs26 Feb 2025
- 2025EquiBench: Benchmarking Large Language Models' Reasoning about Program Semantics via Equivalence Checking18 Feb 2025
- 2025What I cannot execute, I do not understand: Training and Evaluating LLMs on Program Execution Traces10 Feb 2025
- 2025Disproving Program Equivalence with LLMs5 Feb 2025
- 2025A Tool for In-depth Analysis of Code Execution Reasoning of Large Language Models30 Jan 2025
- 2025CoCoNUT: Structural Code Understanding does not fall out of a tree27 Jan 2025
- 2024Reverse Thinking Makes LLMs Stronger Reasoners29 Nov 2024
- 2024Mastering the Craft of Data Synthesis for CodeLLMs16 Oct 2024
- 2024Scaling Parameter-Constrained Language Models with Quality Data4 Oct 2024
- 2024What can Large Language Models Capture about Code Functional Equivalence?20 Aug 2024
- 2024Morescient GAI for Software Engineering (Extended Version)7 Jun 2024
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMscited by 47
- 2024Reverse Thinking Makes LLMs Stronger Reasonerscited by 29
- 2025EquiBench: Benchmarking Large Language Models' Reasoning about Program Semantics via Equivalence Checkingcited by 23
- 2025CodeARC: Benchmarking Reasoning Capabilities of LLM Agents for Inductive Program Synthesiscited by 15
- 2025CodeSense: a Real-World Benchmark and Dataset for Code Semantic Reasoningcited by 12
- 2025The Quest for Efficient Reasoning: A Data-Centric Benchmark to CoT Distillationcited by 7
- 2025A Tool for In-depth Analysis of Code Execution Reasoning of Large Language Modelscited by 6
- 2026Enhancing the Code Reasoning Capabilities of LLMs via Consistency-based Reinforcement Learningcited by 1
- 2025Generating Verifiable Chain of Thoughts from Exection-Tracescited by 0
- 2026Enhancing the Code Reasoning Capabilities of LLMs via Consistency-based Reinforcement Learning18 May 2026
- 2025Generating Verifiable Chain of Thoughts from Exection-Traces28 Nov 2025
- 2025CodeSense: a Real-World Benchmark and Dataset for Code Semantic Reasoning31 May 2025
- 2025The Quest for Efficient Reasoning: A Data-Centric Benchmark to CoT Distillation24 May 2025
- 2025CodeARC: Benchmarking Reasoning Capabilities of LLM Agents for Inductive Program Synthesis29 Mar 2025
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMs26 Feb 2025
- 2025EquiBench: Benchmarking Large Language Models' Reasoning about Program Semantics via Equivalence Checking18 Feb 2025
- 2025A Tool for In-depth Analysis of Code Execution Reasoning of Large Language Models30 Jan 2025
- 2024Reverse Thinking Makes LLMs Stronger Reasoners29 Nov 2024
- 2026Code as Agent Harnesscited by 40
- 2025Locus: Agentic Predicate Synthesis for Directed Fuzzingcited by 8
- 2026Improved Bug Localization with AI Agents Leveraging Hypothesis and Dynamic Cognitioncited by 0
- 2026Code as Agent Harness18 May 2026
- 2026Improved Bug Localization with AI Agents Leveraging Hypothesis and Dynamic Cognition18 Jan 2026
- 2025Locus: Agentic Predicate Synthesis for Directed Fuzzing29 Aug 2025
- 2024Mastering the Craft of Data Synthesis for CodeLLMscited by 3
- 2024Mastering the Craft of Data Synthesis for CodeLLMs16 Oct 2024
- 2025Frontier AI's Impact on the Cybersecurity Landscapecited by 21
- 2024What can Large Language Models Capture about Code Functional Equivalence?cited by 13
- 2024Scaling Parameter-Constrained Language Models with Quality Datacited by 12
- 2025What I cannot execute, I do not understand: Training and Evaluating LLMs on Program Execution Tracescited by 11
- 2025CoCoNUT: Structural Code Understanding does not fall out of a treecited by 7
- 2025Disproving Program Equivalence with LLMscited by 5
- 2025Trace Gadgets: Minimizing Code Context for Machine Learning-Based Vulnerability Predictioncited by 5
- 2026FROST: Filtering Reasoning Outliers with Attention for Efficient Reasoningcited by 5
- 2025The Hitchhiker's Guide to Program Analysis, Part II: Deep Thoughts by LLMscited by 4
- 2025EyeMulator: Improving Code Language Models by Mimicking Human Visual Attentioncited by 4
- 2025Do Code Semantics Help? A Comprehensive Study on Execution Trace-Based Information for Code Large Language Modelscited by 3
- 2025CCCI: Code Completion with Contextual Information for Complex Data Transfer Tasks Using Large Language Modelscited by 2
12 most cited of 14 All 14 (JSON)
- 2026FROST: Filtering Reasoning Outliers with Attention for Efficient Reasoning26 Jan 2026
- 2025Do Code Semantics Help? A Comprehensive Study on Execution Trace-Based Information for Code Large Language Models15 Sep 2025
- 2025EyeMulator: Improving Code Language Models by Mimicking Human Visual Attention22 Aug 2025
- 2025Trace Gadgets: Minimizing Code Context for Machine Learning-Based Vulnerability Prediction18 Apr 2025
- 2025The Hitchhiker's Guide to Program Analysis, Part II: Deep Thoughts by LLMs16 Apr 2025
- 2025Frontier AI's Impact on the Cybersecurity Landscape7 Apr 2025
- 2025CCCI: Code Completion with Contextual Information for Complex Data Transfer Tasks Using Large Language Models29 Mar 2025
- 2025Investigating Execution-Aware Language Models for Code Optimization11 Mar 2025
- 2025What I cannot execute, I do not understand: Training and Evaluating LLMs on Program Execution Traces10 Feb 2025
- 2025Disproving Program Equivalence with LLMs5 Feb 2025
- 2025CoCoNUT: Structural Code Understanding does not fall out of a tree27 Jan 2025
- 2024Scaling Parameter-Constrained Language Models with Quality Data4 Oct 2024
12 newest of 14 All 14 (JSON)
Similar, not cited
Close in wording, no citation either way
- 2024CodeMind: Evaluating Large Language Models for Code Reasoning
- 2024NExT: Teaching Large Language Models to Reason about Code Execution
- 2026CodeEval: A pedagogical approach for targeted evaluation of code-trained Large Language Models
- 2025CoRe: Benchmarking LLMs Code Reasoning Capabilities through Static Analysis Tasks
- 2026Can LLMs Reason About Runtime Behavior? A Repository-Level Dynamic Benchmark
- 2025Demystifying Errors in LLM Reasoning Traces: An Empirical Study of Code Execution Simulation
- 2025Chain of Execution Supervision Promotes General Reasoning in Large Language Models
- 2024CodeMMLU: A Multi-Task Benchmark for Assessing Code Understanding & Reasoning Capabilities of CodeLLMs