Comparing large language models and human programmers for generating programming code

Wenpin Hou,Zhicheng Ji
2024-10-05
Abstract:We systematically evaluated the performance of seven large language models in generating programming code using various prompt strategies, programming languages, and task difficulties. GPT-4 substantially outperforms other large language models, 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. Additionally, 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. These results suggest that GPT-4 has the potential to serve as a reliable assistant in programming code generation and software development.
Software Engineering,Artificial Intelligence,Computation and Language,Programming Languages
What problem does this paper attempt to address?
This paper aims to evaluate the performance of large language models (LLMs) in generating programming code and compare it with human programmers. Specifically, the researchers systematically assessed the code generation capabilities of seven large language models under different prompting strategies, programming languages, and task difficulties. The main objectives include: 1. **Evaluating the impact of different prompting strategies on LLMs' programming performance**: The researchers designed six different prompting strategies to test how these strategies affect the programming performance of LLMs. 2. **Directly comparing the programming abilities of LLMs with human programmers**: By participating in LeetCode and GeeksforGeeks programming competitions, the performance of LLMs was evaluated and compared with the scores of human participants. 3. **Assessing the performance of LLMs in different programming languages**: Not limited to Python, but also including other commonly used programming languages such as Java, JavaScript, and C++. 4. **Examining the learning ability of LLMs**: Investigating how LLMs learn from mistakes and improve the success rate of code generation through multiple attempts. 5. **Evaluating the computational efficiency of the code generated by LLMs**: Comparing the performance of LLM-generated code in terms of runtime and memory usage with the code generated by human programmers. The study found that GPT-4 significantly outperformed other LLMs across all evaluation metrics, especially when using the optimal prompting strategy, its performance even exceeded 85% of human participants. These results indicate that GPT-4 has great potential in programming code generation and software development, making it a reliable auxiliary tool.