mlsanityData to 7 Oct 2026

SemCoder: Training Code Language Models with Comprehensive Semantics Reasoning

arXiv 2406.01006 ↗First posted 3 Jun 2024cs.CL cs.AI cs.SEcited by 27

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

  1. 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Code12 Mar

Other references · 7

  1. 2023StarCoder: may the source be with you!cited by 790
  2. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
  3. 2023Textbooks Are All You Needcited by 561
  4. 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
  5. 2022The Stack: 3 TB of permissively licensed source codecited by 354
  6. 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 294
  7. 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 251

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 5; 2025: 18; 2026: 4.

27 papers.

Sort:

By area:

  1. 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMscited by 47
  2. 2026Code as Agent Harnesscited by 40
  3. 2024Reverse Thinking Makes LLMs Stronger Reasonerscited by 29
  4. 2025EquiBench: Benchmarking Large Language Models' Reasoning about Program Semantics via Equivalence Checkingcited by 23
  5. 2025Frontier AI's Impact on the Cybersecurity Landscapecited by 21
  6. 2025CodeARC: Benchmarking Reasoning Capabilities of LLM Agents for Inductive Program Synthesiscited by 15
  7. 2024What can Large Language Models Capture about Code Functional Equivalence?cited by 13
  8. 2024Scaling Parameter-Constrained Language Models with Quality Datacited by 12
  9. 2025CodeSense: a Real-World Benchmark and Dataset for Code Semantic Reasoningcited by 12
  10. 2025What I cannot execute, I do not understand: Training and Evaluating LLMs on Program Execution Tracescited by 11
  11. 2025Locus: Agentic Predicate Synthesis for Directed Fuzzingcited by 8
  12. 2025CoCoNUT: Structural Code Understanding does not fall out of a treecited by 7
15 more
  1. 2025The Quest for Efficient Reasoning: A Data-Centric Benchmark to CoT Distillationcited by 7
  2. 2025A Tool for In-depth Analysis of Code Execution Reasoning of Large Language Modelscited by 6
  3. 2025Disproving Program Equivalence with LLMscited by 5
  4. 2025Trace Gadgets: Minimizing Code Context for Machine Learning-Based Vulnerability Predictioncited by 5
  5. 2026FROST: Filtering Reasoning Outliers with Attention for Efficient Reasoningcited by 5
  6. 2025The Hitchhiker's Guide to Program Analysis, Part II: Deep Thoughts by LLMscited by 4
  7. 2025EyeMulator: Improving Code Language Models by Mimicking Human Visual Attentioncited by 4
  8. 2024Mastering the Craft of Data Synthesis for CodeLLMscited by 3
  9. 2025Do Code Semantics Help? A Comprehensive Study on Execution Trace-Based Information for Code Large Language Modelscited by 3
  10. 2025CCCI: Code Completion with Contextual Information for Complex Data Transfer Tasks Using Large Language Modelscited by 2
  11. 2024Morescient GAI for Software Engineering (Extended Version)cited by 1
  12. 2025Investigating Execution-Aware Language Models for Code Optimizationcited by 1
  13. 2026Enhancing the Code Reasoning Capabilities of LLMs via Consistency-based Reinforcement Learningcited by 1
  14. 2025Generating Verifiable Chain of Thoughts from Exection-Tracescited by 0
  15. 2026Improved Bug Localization with AI Agents Leveraging Hypothesis and Dynamic Cognitioncited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2024CodeMind: Evaluating Large Language Models for Code Reasoning
  2. 2024NExT: Teaching Large Language Models to Reason about Code Execution
  3. 2026CodeEval: A pedagogical approach for targeted evaluation of code-trained Large Language Models
  4. 2025CoRe: Benchmarking LLMs Code Reasoning Capabilities through Static Analysis Tasks
  5. 2026Can LLMs Reason About Runtime Behavior? A Repository-Level Dynamic Benchmark
  6. 2025Demystifying Errors in LLM Reasoning Traces: An Empirical Study of Code Execution Simulation
  7. 2025Chain of Execution Supervision Promotes General Reasoning in Large Language Models
  8. 2024CodeMMLU: A Multi-Task Benchmark for Assessing Code Understanding & Reasoning Capabilities of CodeLLMs