Is Functional Correctness Enough to Evaluate Code Language Models? Exploring Diversity of Generated Codes

Heejae Chon, Seonghyeon Lee, Jinyoung Yeo, Dongha Lee
8/24/2024
cs.SEcs.AIcs.PL

No official code found. Best implementation: 0914eagle/Code-Diversity (1 star, last commit 2024-10-16).

Abstract

Language models (LMs) have exhibited impressive abilities in generating codes from natural language requirements. In this work, we highlight the diversity of code generated by LMs as a critical criterion for evaluating their code generation capabilities, in addition to functional correctness. Despite its practical implications, there is a lack of studies focused on assessing the diversity of generated code, which overlooks its importance in the development of code LMs. We propose a systematic approach to evaluate the diversity of generated code, utilizing various metrics for inter-code similarity as well as functional correctness. Specifically, we introduce a pairwise code similarity measure that leverages large LMs' capabilities in code understanding and reasoning, demonstrating the highest correlation with human judgment. We extensively investigate the impact of various factors on the quality of generated code, including model sizes, temperatures, training approaches, prompting strategies, and the difficulty of input problems. Our consistent observation of a positive correlation between the test pass score and the inter-code similarity score indicates that current LMs tend to produce functionally correct code with limited diversity.

View on arXivView PDF

Code Implementations(1)

10PythonJun 16, 20242 years ago

Similar Papers

Cite this paper

@article{chon2024functional,
  title  = {Is Functional Correctness Enough to Evaluate Code Language Models? Exploring Diversity of Generated Codes},
  author = {Heejae Chon and Seonghyeon Lee and Jinyoung Yeo and Dongha Lee},
  year   = {2024},
  eprint = {2408.14504},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2408.14504v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2408.14504.svg)](https://codeofpaper.com/paper/2408.14504)

Discussion