HackerPapers

arXiv:2308.02828cs.SE

An Empirical Study of the Non-determinism of ChatGPT in Code Generation

Shuyin Ouyang, Jie M. Zhang, Mark Harman, Meng Wang

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

Abstract

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 75.76%, 51.00%, and 47.56% for 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.

arXiv comments
Journal reference
DOI
doi:10.1145/3697010
Subjects
cs.SESoftware Engineering

On Hacker News

Linked by 1 identifiable commenter in 1 comment across 1 thread, from Sep 2023 to Sep 2023. Found in 1 HN submission from Dec 2023 to Dec 2023. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments1 thread

    • LLMs don't seem to be deterministic [0, 1, 2, 3]. So no, pinning the version wouldn't be enough. [0] https://matt-rickard.com/foundational-models-are-not-enough [1] https://arxiv.org/pdf/2308.02828.pdf [2] https://www.sitation.com/non-determinism-in-ai-llm-output/ [3]…

      eatonphilView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.