LLM is Like a Box of Chocolates: the Non-determinism of ChatGPT in Code Generation

08/05/2023
by   Shuyin Ouyang, et al.
0

There has been a recent explosion of research on Large Language Models (LLMs) for software engineering tasks, in particular code generation. However, results from LLMs can be highly unstable; nondeterministically returning very different codes for the same prompt. Non-determinism is a potential menace to scientific conclusion validity. When non-determinism is high, scientific conclusions simply cannot be relied upon unless researchers change their behaviour to control for it in their empirical analyses. This paper conducts an empirical study to demonstrate that non-determinism is, indeed, high, thereby underlining the need for this behavioural change. We choose to study ChatGPT because it is already highly prevalent in the code generation research literature. We report results from a study of 829 code generation problems from three code generation benchmarks (i.e., CodeContests, APPS, and HumanEval). Our results reveal high degrees of non-determinism: the ratio of coding tasks with zero equal test output across different requests is 72.73 CodeContests, APPS, and HumanEval, respectively. In addition, we find that setting the temperature to 0 does not guarantee determinism in code generation, although it indeed brings less non-determinism than the default configuration (temperature=1). These results confirm that there is, currently, a significant threat to scientific conclusion validity. In order to put LLM-based research on firmer scientific foundations, researchers need to take into account non-determinism in drawing their conclusions.

READ FULL TEXT
research
08/22/2023

Towards an Understanding of Large Language Models in Software Engineering Tasks

Large Language Models (LLMs) have drawn widespread attention and researc...
research
09/06/2018

Standards of Validity and the Validity of Standards in Behavioral Software Engineering Research: The Perspective of Psychological Test Theory

Background. There are some publications in software engineering research...
research
06/12/2019

Better Code, Better Sharing:On the Need of Analyzing Jupyter Notebooks

By bringing together code, text, and examples, Jupyter notebooks have be...
research
10/14/2020

Android Code Smells: From Introduction to Refactoring

Object-oriented code smells are well-known concepts in software engineer...
research
11/14/2019

On the Time-Based Conclusion Stability of Software Defect Prediction Models

Researchers in empirical software engineering often make claims based on...
research
12/25/2020

Contextual Temperature for Language Modeling

Temperature scaling has been widely used as an effective approach to con...

Please sign up or login with your details

Forgot password? Click here to reset