Studying How Configurations Impact Code Generation in LLMs: the Case of ChatGPT

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Donato, Benedetta, Mariani, Leonardo, Micucci, Daniela, Riganelli, Oliviero
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910843086569472
author Donato, Benedetta
Mariani, Leonardo
Micucci, Daniela
Riganelli, Oliviero
author_facet Donato, Benedetta
Mariani, Leonardo
Micucci, Daniela
Riganelli, Oliviero
contents Leveraging LLMs for code generation is becoming increasingly common, as tools like ChatGPT can suggest method implementations with minimal input, such as a method signature and brief description. Empirical studies further highlight the effectiveness of LLMs in handling such tasks, demonstrating notable performance in code generation scenarios. However, LLMs are inherently non-deterministic, with their output influenced by parameters such as temperature, which regulates the model's level of creativity, and top-p, which controls the choice of the tokens that shall appear in the output. Despite their significance, the role of these parameters is often overlooked. This paper systematically studies the impact of these parameters, as well as the number of prompt repetitions required to account for non-determinism, in the context of 548 Java methods. We observe significantly different performances across different configurations of ChatGPT, with temperature having a marginal impact compared to the more prominent influence of the top-p parameter. Additionally, we show how creativity can enhance code generation tasks. Finally, we provide concrete recommendations for addressing the non-determinism of the model.
format Preprint
id arxiv_https___arxiv_org_abs_2502_17450
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Studying How Configurations Impact Code Generation in LLMs: the Case of ChatGPT
Donato, Benedetta
Mariani, Leonardo
Micucci, Daniela
Riganelli, Oliviero
Software Engineering
Leveraging LLMs for code generation is becoming increasingly common, as tools like ChatGPT can suggest method implementations with minimal input, such as a method signature and brief description. Empirical studies further highlight the effectiveness of LLMs in handling such tasks, demonstrating notable performance in code generation scenarios. However, LLMs are inherently non-deterministic, with their output influenced by parameters such as temperature, which regulates the model's level of creativity, and top-p, which controls the choice of the tokens that shall appear in the output. Despite their significance, the role of these parameters is often overlooked. This paper systematically studies the impact of these parameters, as well as the number of prompt repetitions required to account for non-determinism, in the context of 548 Java methods. We observe significantly different performances across different configurations of ChatGPT, with temperature having a marginal impact compared to the more prominent influence of the top-p parameter. Additionally, we show how creativity can enhance code generation tasks. Finally, we provide concrete recommendations for addressing the non-determinism of the model.
title Studying How Configurations Impact Code Generation in LLMs: the Case of ChatGPT
topic Software Engineering
url https://arxiv.org/abs/2502.17450