Improving ChatGPT Prompt for Code Generation
Chao Liu, Xuanlin Bao, Hongyu Zhang, Neng Zhang, Haibo Hu, Xiaohong, Zhang, Meng Yan

TL;DR
This paper investigates how prompt design influences ChatGPT's effectiveness in code generation, demonstrating that carefully crafted prompts significantly enhance performance in text-to-code and code-to-code tasks.
Contribution
It introduces prompt optimization strategies, including chain-of-thought techniques, to improve ChatGPT's code generation capabilities based on experimental evaluation.
Findings
Prompt design greatly affects ChatGPT's code generation quality
Chain-of-thought prompts lead to better results
Insights guide future prompt engineering research
Abstract
Automated code generation can be a powerful technique for software development, significantly reducing developers' efforts and time required to create new code by generating it automatically based on requirements. Recently, OpenAI's language model ChatGPT has emerged as a powerful tool for generating human-like responses to a wide range of textual inputs (i.e., prompts), including those related to code generation. However, the effectiveness of ChatGPT for code generation is not well understood, and the generation performance could be heavily influenced by the choice of prompt. To answer these questions, we conducted experiments using the CodeXGlue dataset to evaluate ChatGPT's capabilities for two code generation tasks, including text-to-code and code-to-code generation. We designed prompts by leveraging the chain-of-thought strategy with multi-step optimizations. Our results showed…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Artificial Intelligence in Healthcare and Education · Software Engineering Techniques and Practices
