Generative AI is changing the way developers interact with software systems, providing services that can produce and deliver new content, crafted to satisfy the actual needs of developers. For instance, developers can ask for new code dtrectly from within their IDEs by writing natural language prompts, and integrated services based on generative AI, such as Copilot, immediately respond to prompts by providing ready-to-use code snippets. Formulating the prompt appropriately, and incorporating the useful information while avoiding any information overload, can be an important factor in obtaining the right piece of code. The task of designing good prompts is known as prompt engineering. In this paper, we systematically investigate the influence of eight prompt features on the style and the content of prompts, on the level of correctness, complexity, size, and similarity to the developers' code of the generated code. We specifically consider the task of using Copilot with 124,800 prompts obtained by systematically combining the eight considered prompt features to generate the implementation of 200 Java methods. Results show how some prompt features, such as the presence of examples and the summary of the purpose of the method, can significantly influence the quality of the result. Ccs Concepts • Software and its engineering →Integrated and visual development environments.

Fagadau, I., Mariani, L., Micucci, D., Riganelli, O. (2024). Analyzing Prompt Influence on Automated Method Generation: An Empirical Study with Copilot. In ICPC '24: Proceedings of the 32nd IEEE/ACM International Conference on Program Comprehension (pp.24-34). IEEE Computer Society [10.1145/3643916.3644409].

Analyzing Prompt Influence on Automated Method Generation: An Empirical Study with Copilot

Fagadau, Ionut Daniel;Mariani, Leonardo;Micucci, Daniela;Riganelli, Oliviero
2024

Abstract

Generative AI is changing the way developers interact with software systems, providing services that can produce and deliver new content, crafted to satisfy the actual needs of developers. For instance, developers can ask for new code dtrectly from within their IDEs by writing natural language prompts, and integrated services based on generative AI, such as Copilot, immediately respond to prompts by providing ready-to-use code snippets. Formulating the prompt appropriately, and incorporating the useful information while avoiding any information overload, can be an important factor in obtaining the right piece of code. The task of designing good prompts is known as prompt engineering. In this paper, we systematically investigate the influence of eight prompt features on the style and the content of prompts, on the level of correctness, complexity, size, and similarity to the developers' code of the generated code. We specifically consider the task of using Copilot with 124,800 prompts obtained by systematically combining the eight considered prompt features to generate the implementation of 200 Java methods. Results show how some prompt features, such as the presence of examples and the summary of the purpose of the method, can significantly influence the quality of the result. Ccs Concepts • Software and its engineering →Integrated and visual development environments.
paper
code generation; Copilot; Prompt engineering;
English
ICPC '24: 32nd IEEE/ACM International Conference on Program Comprehension - April 15 - 16, 2024
2024
ICPC '24: Proceedings of the 32nd IEEE/ACM International Conference on Program Comprehension
9798400705861
2024
24
34
open
Fagadau, I., Mariani, L., Micucci, D., Riganelli, O. (2024). Analyzing Prompt Influence on Automated Method Generation: An Empirical Study with Copilot. In ICPC '24: Proceedings of the 32nd IEEE/ACM International Conference on Program Comprehension (pp.24-34). IEEE Computer Society [10.1145/3643916.3644409].
File in questo prodotto:
File Dimensione Formato  
Fagadau-2024-ICPC '24-VoR.pdf

accesso aperto

Descrizione: CC BY This work licensed under Creative Commons Attribution International 4.0 License.
Tipologia di allegato: Publisher’s Version (Version of Record, VoR)
Licenza: Creative Commons
Dimensione 947.52 kB
Formato Adobe PDF
947.52 kB Adobe PDF Visualizza/Apri

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/10281/490720
Citazioni
  • Scopus 2
  • ???jsp.display-item.citation.isi??? 1
Social impact