Comparative Analysis of ChatGPT, DeepSeek, and Gemini for Automated Code Generation
Code generation using artificial intelligence (AI) has revolutionized software development, providing automated coding solutions. This study conducts a systematic comparative analysis of three leading large language models (LLMs) such as ChatGPT (O1), DeepSeek (R1) and Gemini (2.0 Flash thinking), for Python code generation, evaluating their performance in correctness, code quality, and computational efficiency. Using a curated dataset of Codeforces programming problems that span various difficulty levels <tex xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">$(\mathbf{8 0 0 - 2 0 0 0}$</tex> complexity), the research employs a rigorous evaluation framework that integrates online judge validation, static code analysis, and runtime profiling. The experimental results reveal that DeepSeek achieves comparatively higher correctness by consistently producing accepted solutions in fewer attempts, although its reasoning time increases with problem complexity. Gemini, on the other hand, is remarkably fast, delivering results in a fraction of the time, but its correctness deteriorates on more complex tasks. ChatGPT offers balanced performance with intermediate correctness and efficiency; however, it sometimes exhibits lower code quality. Overall, our findings underscore the inherent trade-offs between efficiency, accuracy, and quality in AI-generated code. The study provides actionable insights for developers, emphasizing the need to align model selection with project requirements, and contributes a replicable framework for future evaluations of AI code generation tools.
Authors
- Khuram Shahzad (ORCID: https://orcid.org/0000-0002-7618-1907)
- Sohail Iqbal (ORCID: https://orcid.org/0000-0002-5255-6532)
Institutions
- National University of Sciences and Technology (PK)
Publication Details
- Published
- 2025-05-29
- DOI
- https://doi.org/10.1109/emes65692.2025.11045587
- Citations
- 3
- Primary Topic
- Artificial Intelligence in Healthcare and Education
- Type
- article
- Field-Weighted Citation Impact
- 1.96