Revisiting the Non-Determinism of Code Generation by the GPT-3.5 Large Language Model
Despite recent advancements in Large Language Models (LLMs) for code generation, their inherent non-determinism remains a significant obstacle for reliable and reproducible software engineering research. Prior work has highlighted the high degree of variability in LLM-generated code, even when prompted with identical inputs. This non-deterministic behavior can undermine the validity of scientific conclusions drawn from LLM-based experiments. This paper showcases the Tree of Thoughts (ToT) prompting strategy as a promising alternative for improving the predictability and quality of code generation results. By guiding the LLM through a structured Thoughts process, ToT aims to reduce the randomness inherent in the generation process and improve the consistency of the output. Our experiments on GPT-3.5 Turbo model using 829 code generation problems from benchmarks such as CodeContests, APPS (Automated Programming Progress Standard) and HumanEval demonstrate a substantial reduction in non-determinism compared to previous findings. Specifically, we observed a significant decrease in the number of coding tasks that produced inconsistent outputs across multiple requests. Nevertheless, we show that the reduction in semantic variability was less pronounced for HumanEval (69%), indicating unique challenges present in this dataset that are not fully mitigated by ToT.
Authors
- Rodrique Kafando (ORCID: https://orcid.org/0000-0002-7190-9225)
- Aminata Sabané (ORCID: https://orcid.org/0000-0001-7955-7562)
- Abdoul Kader Kaboré (ORCID: https://orcid.org/0000-0002-3151-9433)
- Tegawendé François Bissyandé (ORCID: https://orcid.org/0000-0001-7270-9869)
- Salimata Sawadogo
Institutions
- University of Luxembourg (LU)
Publication Details
- Published
- 2025-03-04
- DOI
- https://doi.org/10.1109/saner64311.2025.00012
- Citations
- 1
- Primary Topic
- Natural Language Processing Techniques
- Type
- article
- Field-Weighted Citation Impact
- 2.48