journal article·2025-02Open access

Comparing Large Language Models and Human Programmers for Generating Programming Code

Wenpin Hou, Zhicheng Ji

Advanced Science· Volume 12· Issue 8

Abstract

Abstract The performance of seven large language models (LLMs) in generating programming code using various prompt strategies, programming languages, and task difficulties is systematically evaluated. GPT‐4 substantially outperforms other LLMs, including Gemini Ultra and Claude 2. The coding performance of GPT‐4 varies considerably with different prompt strategies. In most LeetCode and GeeksforGeeks coding contests evaluated in this study, GPT‐4, employing the optimal prompt strategy, outperforms 85 percent of human participants in a competitive environment, many of whom are students and professionals with moderate programming experience. GPT‐4 demonstrates strong capabilities in translating code between different programming languages and in learning from past errors. The computational efficiency of the code generated by GPT‐4 is comparable to that of human programmers. GPT‐4 is also capable of handling broader programming tasks, including front‐end design and database operations. These results suggest that GPT‐4 has the potential to serve as a reliable assistant in programming code generation and software development. A programming assistant is designed based on an optimal prompt strategy to facilitate the practical use of LLMs for programming.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Software Testing and Debugging Techniques · Software Engineering Research · Software Engineering Techniques and Practices

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

Department of Biostatistics Mailman School of Public Health Columbia University New York City NY 10032 USA

Department of Biostatistics and Bioinformatics Duke University School of Medicine Durham NC 07024 USA

Funding

National Institutes of Health

References (29)

Show source-provided references
1. S.Bubeck V.Chandrasekaran R.Eldan J.Gehrke E.Horvitz E.Kamar P.Lee Y. T.Lee Y.Li S.Lundberg H.Nori H.Palangi M. T.Ribeiro Y.Zhang arXiv preprint arXiv:2303.127122023.
2. J.Li B.Hui G.Qu B.Li J.Yang B.Li B.Wang B.Qin R.Cao R.Geng N.Huo X.Zhou C.Ma G.Li K. C. C.Chang F.Huang R.Cheng Y.Li arXiv preprint arXiv:2305.031112023.
3. S.Bordt U.vonLuxburg arXiv preprint arXiv:2303.094612023.
4. L.Cheng X.Li L.Bing arXiv preprint arXiv:2305.150382023.
5. A.Singla inProc. of the 2023 ACM Conf. on Int. Computing Education Research‐Vol. 2 Association for Computing Machinery New York2023 pp.14–15.10.1145/3568812.3603474 ↗
6. A.Tarassow arXiv preprint arXiv:2307.130182023.
7. B. P.Cipriano P.Alves inProceedings of the 2023 Conf. on Innovation and Technology in Computer Science Education V. 1 Association for Computing Machinery New York2023 pp.61–67.10.1145/3587102.3588814 ↗
8. H.Tian W.Lu T. O.Li X.Tang S.‐C.Cheung J.Klein T. F.Bissyandé arXiv preprint arXiv:2304.119382023.
9. Phung T. · Int. J. Manag. · 2023 · 21
10. 10.1371/journal.pdig.000019810.1371/journal.pdig.0000198 ↗
11. W.Hou Z.Ji bioRxiv.2023.
12. 10.1038/s41592-024-02235-410.1038/s41592-024-02235-4 ↗
13. W.Hou Z.Ji bioRxiv.2024.
14. 10.15302/J-QB-023-032710.15302/J-QB-023-0327 ↗
15. 10.1016/j.diii.2023.02.00310.1016/j.diii.2023.02.003 ↗
16. M.Chen J.Tworek H.Jun Q.Yuan H. P. d. O.Pinto J.Kaplan H.Edwards Y.Burda N.Joseph G.Brockman A.Ray R.Puri G.Krueger M.Petrov H.Khlaaf G.Sastry P.Mishkin B.Chan S.Gray N.Ryder M.Pavlov A.Power L.Kaiser M.Bavarian C.Winter P.Tillet F. P.Such D.Cummings M.Plappert F.Chantzis et al. arXiv preprint arXiv:2107.033742021.
17. J.Austin A.Odena M.Nye M.Bosma H.Michalewski D.Dohan E.Jiang C.Cai M.Terry Q.Le C.Sutton arXiv preprint arXiv:2108.077322021.
18. D.Hendrycks S.Basart S.Kadavath M.Mazeika A.Arora E.Guo C.Burns S.Puranik H.He D.Song J.Steinhardt arXiv preprint arXiv:2105.099382021.
19. P.Yin B.Deng E.Chen B.Vasilescu G.Neubig inProceedings of the 15th Int. Conf. on Mining Software Repositories IEEE New York2018 pp.476–486.10.1145/3196398.3196408 ↗
20. 10.1126/science.abq115810.1126/science.abq1158 ↗
21. Anthropic Model card and evaluations for claude models 2023 https://www‐cdn.anthropic.com/bd2a28d2535bfb0494cc8e2a3bf135d2e7523226/Model‐Card‐Claude‐2.pdf(accessed: October 2024).
22. Gemini Team Google arXiv preprint arXiv:2312.118052023.
23. OpenAI arXiv preprint arXiv:2303.087742023.
24. B.Roziere J.Gehring F.Gloeckle S.Sootla I.Gat X. E.Tan Y.Adi J.Liu T.Remez J.Rapin A.Kozhevnikov I.Evtimov J.Bitton M.Bhatt C. C.Ferrer A.Grattafiori W.Xiong A.Défossez J.Copet F.Azhar H.Touvron L.Martin N.Usunier T.Scialom G.Synnaeve arXiv preprint arXiv:2308.129502023.
25. H.Touvron L.Martin K.Stone P.Albert A.Almahairi Y.Babaei N.Bashlykov S.Batra P.Bhargava S.Bhosale D.Bikel L.Blecher C. C.Ferrer M.Chen G.Cucurull D.Esiobu J.Fernandes J.Fu W.Fu B.Fuller C.Gao V.Goswami N.Goyal A.Hartshorn S.Hosseini R.Hou H.Inan M.Kardas V.Kerkez M.Khabsa et al. arXiv preprint arXiv:2307.092882023.
26. Wei J. · Adv. Neural. Inf. Process. Syst. · 2022 · 35
27. S.Yao D.Yu J.Zhao I.Shafran T. L.Griffiths Y.Cao K.Narasimhan arXiv preprint arXiv:2305.106012023.
28. OpenAI New embedding models and api updates 2024 https://openai.com/index/new‐embedding‐models‐and‐api‐updates/(accessed: October 2024).
29. 10.1111/j.2517-6161.1995.tb02031.x10.1111/j.2517-6161.1995.tb02031.x ↗