Skip to main content
QUICK REVIEW

[Paper Review] Advancing GenAI Assisted Programming--A Comparative Study on Prompt Efficiency and Code Quality Between GPT-4 and GLM-4

Angus Yang, Zehan Li|arXiv (Cornell University)|Feb 20, 2024
Parallel Computing and Optimization TechniquesComputer Science6 citations
TL;DR

The study compares GPT-4 and GLM-4 for GenAI-assisted programming, showing simple prompts yield the best code generation, a preliminary confirmation step boosts success, GPT-4 marginally outperforms GLM-4, and GenAI can increase coding efficiency by 30–100x.

ABSTRACT

This study aims to explore the best practices for utilizing GenAI as a programming tool, through a comparative analysis between GPT-4 and GLM-4. By evaluating prompting strategies at different levels of complexity, we identify that simplest and straightforward prompting strategy yields best code generation results. Additionally, adding a CoT-like preliminary confirmation step would further increase the success rate. Our results reveal that while GPT-4 marginally outperforms GLM-4, the difference is minimal for average users. In our simplified evaluation model, we see a remarkable 30 to 100-fold increase in code generation efficiency over traditional coding norms. Our GenAI Coding Workshop highlights the effectiveness and accessibility of the prompting methodology developed in this study. We observe that GenAI-assisted coding would trigger a paradigm shift in programming landscape, which necessitates developers to take on new roles revolving around supervising and guiding GenAI, and to focus more on setting high-level objectives and engaging more towards innovation.

Motivation & Objective

  • Assess best practices for using GenAI as a programming tool via cross-model comparison (GPT-4 vs GLM-4).
  • Determine how prompt complexity affects code generation quality and success.
  • Evaluate the impact of a CoT-like preliminary confirmation on generation success.
  • Provide general guidelines and insights for GenAI-assisted coding workflows.

Proposed method

  • Use the game Snake as a controlled coding task to compare LLMs.
  • Design four one-shot prompt levels with increasing complexity to probe code generation.
  • Establish evaluation criteria: success rate, debugging efficiency, code readability, functionality richness.
  • Implement a follow-up prompting loop to simulate iterative debugging and refinement.
  • Collect 240 outcomes across prompts and interactions for statistical analysis.
  • Analyze differences in code generation strategies (e.g., library choices) between GPT-4 and GLM-4.
Figure 1: Representative screenshots of Snake games programmed in Python v3.11, assisted by GenAI: GPT-4 (left) and GLM-4 (right)
Figure 1: Representative screenshots of Snake games programmed in Python v3.11, assisted by GenAI: GPT-4 (left) and GLM-4 (right)

Experimental results

Research questions

  • RQ1How does prompt complexity affect one-shot code generation success for GPT-4 and GLM-4?
  • RQ2Do CoT-like preliminary confirmations improve GenAI-assisted code generation success and efficiency?
  • RQ3What are the relative strengths and weaknesses of GPT-4 vs GLM-4 in Python-based game coding tasks?
  • RQ4How does code quality (readability, completeness, correctness) compare across models and prompt levels?

Key findings

  • Simplest prompts (Prompt 1) achieve the highest one-shot success (GPT-4 and GLM-4).
  • Preliminary confirmation rounds significantly boost one-shot success rates, aligned with Chain-of-Thought benefits.
  • GPT-4 marginally outperforms GLM-4 overall, though GLM-4 can reach comparable success on the most complex prompt.
  • GLM-4 frequently exhibits Type 2 failures (incomplete or truncated code) and tends to rely on specific libraries (e.g., Pygame).
  • A 30–100x increase in coding efficiency is suggested for GenAI-assisted coding versus traditional norms in the simplified model.
  • GenAI prompting advances enable beginners to develop functional Snake games in short timeframes, indicating portability and accessibility of the approach.
Figure 2: One-shot prompt success rate for GPT-4
Figure 2: One-shot prompt success rate for GPT-4

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.