mlsanityData to 14 Oct 2026

Bridging Code Semantic and LLMs: Semantic Chain-of-Thought Prompting for Code Generation

arXiv 2310.10698 ↗First posted 16 Oct 2023cs.CLcited by 6

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

  1. 2023Structured Chain-of-Thought Prompting for Code Generation11 May

Other references · 33

  1. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
  2. 2020Language Models are Few-Shot Learnerscited by 32,419
  3. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
  4. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
  5. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
  6. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  7. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,326
  8. 2021Program Synthesis with Large Language Modelscited by 3,637
  9. 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,512
  10. 2023Tree of Thoughts: Deliberate Problem Solving with Large Language Modelscited by 3,211
  11. 2022Self-Instruct: Aligning Language Models with Self-Generated Instructionscited by 2,724
  12. 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,234
21 more
  1. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  2. 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,850
  3. 2021Calibrate Before Use: Improving Few-Shot Performance of Language Modelscited by 1,392
  4. 2023Language Models Don't Always Say What They Think: Unfaithful Explanations in Chain-of-Thought Promptingcited by 1,122
  5. 2023StarCoder: may the source be with you!cited by 799
  6. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 733
  7. 2023Instruction Tuning with GPT-4cited by 686
  8. 2022Towards Reasoning in Large Language Models: A Surveycited by 596
  9. 2022Reasoning with Language Model Prompting: A Surveycited by 252
  10. 2021PanGu-α: Large-scale Autoregressive Pretrained Chinese Language Models with Auto-parallel Computationcited by 134
  11. 2023Self-planning Code Generation with Large Language Modelscited by 124
  12. 2023CodeScore: Evaluating Code Generation by Learning Code Executioncited by 67
  13. 2023Synthetic Prompting: Generating Chain-of-Thought Demonstrations for Large Language Modelscited by 61
  14. 2023Evaluating Instruction-Tuned Large Language Models on Code Comprehension and Generationcited by 50
  15. 2023Re-Reading Improves Reasoning in Large Language Modelscited by 37
  16. 2023Large Language Models are Edge-Case Fuzzers: Testing Deep Learning Libraries via FuzzGPTcited by 36
  17. 2023Benchmarking LLM powered Chatbots: Methods and Metricscited by 19
  18. 2021GraphSearchNet: Enhancing GNNs via Capturing Global Dependencies for Semantic Code Searchcited by 15
  19. 2023KNOD: Domain Knowledge Distilled Tree Decoder for Automated Program Repaircited by 13
  20. 2021deGraphCS: Embedding Variable-based Flow Graph for Neural Code Searchcited by 3
  21. 2023Recommending Analogical APIs via Knowledge Graph Embeddingcited by 2

Built on by

Cited by year

Citing papers per year: 2024: 3; 2025: 3.

6 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025Code Semantic Zooming ↗
  2. 2025Do Code Semantics Help? A Comprehensive Study on Execution Trace-Based Information for Code Large Language Models
  3. 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval
  4. 2023On the Effectiveness of Large Language Models in Domain-Specific Code Generation
  5. 2024Assessing Code Generation with Intermediate Languages
  6. 2025Evaluating Large Language Models for Functional and Maintainable Code in Industrial Settings: A Case Study at ASML
  7. 2026Enhancing LLM-Based Code Translation with Verified Multi-Semantic Representations ↗
  8. 2024SemCoder: Training Code Language Models with Comprehensive Semantics Reasoning