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

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Chon, Heejae, Lee, Seonghyeon, Yeo, Jinyoung, Lee, Dongha
Format: Preprint
Publié: 2024
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866910579305742336
author Chon, Heejae
Lee, Seonghyeon
Yeo, Jinyoung
Lee, Dongha
author_facet Chon, Heejae
Lee, Seonghyeon
Yeo, Jinyoung
Lee, Dongha
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2408_14504
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Is Functional Correctness Enough to Evaluate Code Language Models? Exploring Diversity of Generated Codes
Chon, Heejae
Lee, Seonghyeon
Yeo, Jinyoung
Lee, Dongha
Software Engineering
Artificial Intelligence
Programming Languages
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.
title Is Functional Correctness Enough to Evaluate Code Language Models? Exploring Diversity of Generated Codes
topic Software Engineering
Artificial Intelligence
Programming Languages
url https://arxiv.org/abs/2408.14504