# Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generation

**Authors:** Jiawei Liu, Chunqiu Steven Xia, Yuyao Wang, Lingming Zhang  
**arXiv:** [2305.01210](https://arxiv.org/abs/2305.01210)  
**Date:** 2023-05-02  
**Summary page:** https://www.summarizepaper.com/en/paper/2305.01210v1/

## Key points

- Program synthesis using Large Language Models (LLMs) to generate code based on user intent written in natural language is a topic of interest.
- Evaluation of LLMs' performance in code synthesis has been limited by the quantity and quality of test-cases in existing datasets, raising concerns about functional correctness.
- Jiawei Liu and colleagues propose EvalPlus, a benchmarking framework that rigorously evaluates the functional correctness of LLM-synthesized code.
- EvalPlus uses an automatic input generation step to produce large amounts of new test inputs using both LLM-based and mutation-based input generators.
- The authors extend the popular HUMANEVAL benchmark and build HUMANEVAL+ with 81x additionally generated tests.
- Extensive evaluation across 14 popular LLMs demonstrates that HUMANEVAL+ is able to catch significant amounts of previously undetected wrong code synthesized by LLMs, reducing the pass@k by 15.1% on average!
- Several incorrect ground-truth implementations were found in HUMANEVAL as well.
- This research highlights the importance of rigorous testing when evaluating LLM-generated code and provides a framework for future evaluations to ensure that synthesized code is functionally correct.

## Summary

Program synthesis has been a topic of interest for a long time, and recent approaches have focused on using Large Language Models (LLMs) to generate code based on user intent written in natural language. However, the evaluation of LLMs' performance in code synthesis has been limited by the quantity and quality of test-cases in existing datasets. This raises concerns about the functional correctness of the generated code. To address this issue, Jiawei Liu and colleagues propose EvalPlus, a benchmarking framework that rigorously evaluates the functional correctness of LLM-synthesized code. EvalPlus takes an existing evaluation dataset and uses an automatic input generation step to produce large amounts of new test inputs using both LLM-based and mutation-based input generators. The authors extend the popular HUMANEVAL benchmark and build HUMANEVAL+ with 81x additionally generated tests. Their extensive evaluation across 14 popular LLMs demonstrates that HUMANEVAL+ is able to catch significant amounts of previously undetected wrong code synthesized by LLMs, reducing the pass@k by 15.1% on average! Moreover, they even found several incorrect ground-truth implementations in HUMANEVAL. The authors' work not only indicates that prior popular code synthesis evaluation results do not accurately reflect the true performance of LLMs for code synthesis but also opens up a new direction to improve programming benchmarks through automated test input generation. This research highlights the importance of rigorous testing when evaluating LLM-generated code and provides a framework for future evaluations to ensure that synthesized code is functionally correct.
