Bridging Code Semantic and LLMs: Semantic Chain-of-Thought Prompting for Code Generation
On the map: LLM reasoning → Reasoning for agents, planning and code
Abstract (arXiv)
Large language models (LLMs) have showcased remarkable prowess in code generation. However, automated code generation is still challenging since it requires a high-level semantic mapping between natural language requirements and codes. Most existing LLMs-based approaches for code generation rely on decoder-only causal language models often treate codes merely as plain text tokens, i.e., feeding the requirements as a prompt input, and outputing code as flat sequence of tokens, potentially missing the rich semantic features inherent in source code. To bridge this gap, this paper proposes the "Semantic Chain-of-Thought" approach to intruduce semantic information of code, named SeCoT. Our motivation is that the semantic information of the source code (eg data flow and control flow) describes more precise program execution behavior, intention and function. By guiding LLM consider and integrate semantic information, we can achieve a more granular understanding and representation of code, enhancing code generation accuracy. Meanwhile, while traditional techniques leveraging such semantic information require complex static or dynamic code analysis to obtain features such as data flow and control flow, SeCoT demonstrates that this process can be fully automated via the intrinsic capabilities of LLMs (i.e., in-context learning), while being generalizable and applicable to challenging domains. While SeCoT can be applied with different LLMs, this paper focuses on the powerful GPT-style models: ChatGPT(close-source model) and WizardCoder(open-source model). The experimental study on three popular DL benchmarks (i.e., HumanEval, HumanEval-ET and MBPP) shows that SeCoT can achieves state-of-the-art performance, greatly improving the potential for large models and code generation.
Key facts. Cited by 6 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 34 of its 40 references that are in the map. First posted on arXiv 16 Oct 2023.
Builds on
34 of 40 references.
Closest ancestors · 1
Same direction, newest first
Other references · 33
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,326
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,512
- 2023Tree of Thoughts: Deliberate Problem Solving with Large Language Modelscited by 3,211
- 2022Self-Instruct: Aligning Language Models with Self-Generated Instructionscited by 2,724
- 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,234
21 more
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,850
- 2021Calibrate Before Use: Improving Few-Shot Performance of Language Modelscited by 1,392
- 2023Language Models Don't Always Say What They Think: Unfaithful Explanations in Chain-of-Thought Promptingcited by 1,122
- 2023StarCoder: may the source be with you!cited by 799
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 733
- 2023Instruction Tuning with GPT-4cited by 686
- 2022Towards Reasoning in Large Language Models: A Surveycited by 596
- 2022Reasoning with Language Model Prompting: A Surveycited by 252
- 2021PanGu-α: Large-scale Autoregressive Pretrained Chinese Language Models with Auto-parallel Computationcited by 134
- 2023Self-planning Code Generation with Large Language Modelscited by 124
- 2023CodeScore: Evaluating Code Generation by Learning Code Executioncited by 67
- 2023Synthetic Prompting: Generating Chain-of-Thought Demonstrations for Large Language Modelscited by 61
- 2023Evaluating Instruction-Tuned Large Language Models on Code Comprehension and Generationcited by 50
- 2023Re-Reading Improves Reasoning in Large Language Modelscited by 37
- 2023Large Language Models are Edge-Case Fuzzers: Testing Deep Learning Libraries via FuzzGPTcited by 36
- 2023Benchmarking LLM powered Chatbots: Methods and Metricscited by 19
- 2021GraphSearchNet: Enhancing GNNs via Capturing Global Dependencies for Semantic Code Searchcited by 15
- 2023KNOD: Domain Knowledge Distilled Tree Decoder for Automated Program Repaircited by 13
- 2021deGraphCS: Embedding Variable-based Flow Graph for Neural Code Searchcited by 3
- 2023Recommending Analogical APIs via Knowledge Graph Embeddingcited by 2
Built on by
Citing papers per year: 2024: 3; 2025: 3.
6 papers.
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2024SuperCoder2.0: Technical Report on Exploring the feasibility of LLMs as Autonomous Programmercited by 3
- 2025Understanding Chain-of-Thought Effectiveness in Code Generation: An Empirical and Information-Theoretic Analysiscited by 2
- 2024Bridging the Language Gap: Enhancing Multilingual Prompt-Based Code Generation in LLMs via Zero-Shot Cross-Lingual Transfercited by 1
- 2025Knowledge-Graph-Driven Data Synthesis for Low-Resource Software Development: A HarmonyOS Case Studycited by 1
- 2025Reasoning Distillation and Structural Alignment for Improved Code Generationcited by 0
- 2025Understanding Chain-of-Thought Effectiveness in Code Generation: An Empirical and Information-Theoretic Analysis10 Dec 2025
- 2025Knowledge-Graph-Driven Data Synthesis for Low-Resource Software Development: A HarmonyOS Case Study29 Nov 2025
- 2025Reasoning Distillation and Structural Alignment for Improved Code Generation20 Oct 2025
- 2024SuperCoder2.0: Technical Report on Exploring the feasibility of LLMs as Autonomous Programmer17 Sep 2024
- 2024Agents in Software Engineering: Survey, Landscape, and Vision13 Sep 2024
- 2024Bridging the Language Gap: Enhancing Multilingual Prompt-Based Code Generation in LLMs via Zero-Shot Cross-Lingual Transfer19 Aug 2024
Similar, not cited
Close in wording, no citation either way
- 2025Code Semantic Zooming ↗
- 2025Do Code Semantics Help? A Comprehensive Study on Execution Trace-Based Information for Code Large Language Models
- 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval
- 2023On the Effectiveness of Large Language Models in Domain-Specific Code Generation
- 2024Assessing Code Generation with Intermediate Languages
- 2025Evaluating Large Language Models for Functional and Maintainable Code in Industrial Settings: A Case Study at ASML
- 2026Enhancing LLM-Based Code Translation with Verified Multi-Semantic Representations ↗
- 2024SemCoder: Training Code Language Models with Comprehensive Semantics Reasoning