Improving ChatGPT Prompt for Code Generation

05/15/2023
by   Chao Liu, et al.
0

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 that by carefully designing prompts to guide ChatGPT, the generation performance can be improved substantially. We also analyzed the factors that influenced the prompt design and provided insights that could guide future research.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
08/17/2023

CodeCoT and Beyond: Learning to Program and Test like a Developer

In natural language processing, transformer-based large language models ...
research
09/07/2023

Exploring an LM to generate Prolog Predicates from Mathematics Questions

Recently, there has been a surge in interest in NLP driven by ChatGPT. C...
research
07/18/2023

How is ChatGPT's behavior changing over time?

GPT-3.5 and GPT-4 are the two most widely used large language model (LLM...
research
05/24/2023

Is GPT-4 a Good Data Analyst?

As large language models (LLMs) have demonstrated their powerful capabil...
research
12/20/2022

A Survey on Pretrained Language Models for Neural Code Intelligence

As the complexity of modern software continues to escalate, software eng...
research
07/12/2023

Exploring the Effectiveness of LLMs in Automated Logging Generation: An Empirical Study

Automated logging statement generation techniques facilitate developers ...
research
02/19/2023

On the Reliability and Explainability of Automated Code Generation Approaches

Automatic code generation, the task of generating new code snippets from...

Please sign up or login with your details

Forgot password? Click here to reset