paper-with-me

홈 › Papers

CodeCoT: Tackling Code Syntax Errors in CoT Reasoning for Code Generation

2023-08-17 · Dong Huang, Qingwen Bu, Yuhao QING, Heming Cui

Chain-of-thought (CoT) has emerged as a groundbreaking tool in NLP, notably for its efficacy in complex reasoning tasks, such as mathematical proofs. However, its application in code generation faces a distinct challenge, i.e., although the code generated with CoT reasoning is logically correct, it faces the problem of syntax error (e.g., invalid syntax error report) during code execution, which causes the CoT result's pass@1 in HumanEval even lower than the zero-shot result. In this paper, we present Code Chain-of-Thought (CodeCoT) that integrates CoT with a self-examination process for code generation. CodeCoT begins with the LLMs using CoT for initial code development to ensure the generated code follows the correct logic flow. Then, CodeCoT will generate test cases to validate whether the code has syntax errors during the execution. CodeCoT then employs a self-examination phase, in which the generated code is executed against these test cases in the local environment. If the local environment raises error information (e.g., invalid syntax error), CodeCoT will iteratively refine the code based on the feedback information. Within this loop, CodeCoT can make sure their generated codes not only follow the logic flow of the code description, but the syntax error will also be addressed with the self-examination process. Our evaluation results reveal that CodeCoT improves the effectiveness of code generation. For example, CodeCoT increases pass@1 from 75.6% to 79.3% for the HumanEval dataset.

📄 PDF Abstract BibTeX arXiv:2308.08784

Code (0)

등록된 구현이 없습니다.

Tasks

Code GenerationFew-Shot LearningHumanEvalMathematical Proofs

Similar Papers 제목 키워드 기반

Automated Correction for Syntax Errors in Programming Assignments using Recurrent Neural Networks

2016-03-19 · Sahil Bhatia, Rishabh Singh

We present a method for automatically generating repair feedback for syntax errors for introductory programming problems. Syntax errors constitute one of the largest classes of errors (34%) in our dataset of student subm…

valid

SYNFIX: Automatically Fixing Syntax Errors using Compiler Diagnostics

2021-04-29 · Toufique Ahmed, Noah Rose Ledesma, Premkumar Devanbu

Beginning programmers struggle with the complex grammar of modern programming languages like Java, and make lot of syntax errors. The diagnostic syntax error messages from compilers and IDEs are sometimes useful, but oft…

BIG-bench Machine LearningDiagnosticMulti-Label ClassificationMUlTI-LABEL-ClASSIFICATION+1

Logic Error Localization in Student Programming Assignments Using Pseudocode and Graph Neural Networks

2024-10-11 · Zhenyu Xu, Kun Zhang, Victor S. Sheng

Pseudocode is extensively used in introductory programming courses to instruct computer science students in algorithm design, utilizing natural language to define algorithmic behaviors. This learning approach enables stu…

DiagnosticGraph Neural Network

VerilogCoder: Autonomous Verilog Coding Agents with Graph-based Planning and Abstract Syntax Tree (AST)-based Waveform Tracing Tool

2024-08-15 · Chia-Tung Ho, Haoxing Ren, Brucek Khailany

Due to the growing complexity of modern Integrated Circuits (ICs), automating hardware design can prevent a significant amount of human error from the engineering process and result in less errors. Verilog is a popular h…

Code Generation

Grammar-Based Code Representation: Is It a Worthy Pursuit for LLMs?

2025-03-07 · Qingyuan Liang, Zhao Zhang, Zeyu Sun, Zheng Lin 외

Grammar serves as a cornerstone in programming languages and software engineering, providing frameworks to define the syntactic space and program structure. Existing research demonstrates the effectiveness of grammar-bas…

Code GenerationHumanEvalmbpp