Skip to main content
QUICK REVIEW

[Paper Review] ICE-Score: Instructing Large Language Models to Evaluate Code

Terry Yue Zhuo|arXiv (Cornell University)|Apr 27, 2023
Topic ModelingComputer Science7 citations
TL;DR

ICE-Score proposes a reference-free, LLM-based evaluation metric for code generation that leverages instruction-tuned large language models to perform multi-dimensional code assessment, achieving high correlation with both human preferences and functional correctness across four programming languages without requiring test suites or reference code.

ABSTRACT

Recent advancements in the field of natural language generation have facilitated the use of large language models to assess the quality of generated text. Although these models have shown promising results in tasks such as machine translation and summarization, their applicability in code intelligence tasks remains limited without human involvement. The complexity of programming concepts required for such tasks makes it difficult to develop evaluation metrics that align with human judgment. Token-matching-based metrics, such as BLEU, have demonstrated weak correlations with human practitioners in code intelligence tasks. Moreover, utilizing human-written test suites to evaluate functional correctness can be challenging in domains with low resources. To overcome these obstacles, we propose exttt{ICE-Score}, a new evaluation metric via instructing large language models (LLMs) for code assessments. Our metric addresses the limitations of existing approaches by achieving superior correlations with functional correctness and human preferences, without the need for test oracles or references. We evaluate the efficacy of our metric on two different aspects ( extit{human preference} and extit{execution success}) and four programming languages. Our results demonstrate that our metric surpasses state-of-the-art metrics for code generation, delivering high levels of accuracy and consistency across various programming languages and tasks. We also make our evaluation metric and datasets available to the public\footnote{\url{https://github.com/terryyz/ice-score}}, encouraging further research in evaluating code intelligence tasks.

Motivation & Objective

  • Address the limitations of traditional token-matching metrics like BLEU and ROUGE, which show weak correlation with human judgment in code evaluation.
  • Overcome the reliance on human-written test suites or reference code in existing evaluation methods, which are costly and impractical in low-resource settings.
  • Develop a reference-free evaluation metric that aligns with human preferences and functional correctness in code intelligence tasks.
  • Enable consistent and accurate code evaluation across multiple programming languages without requiring execution or external oracles.
  • Provide a scalable, automated, and human-aligned evaluation framework for code generation that leverages the semantic understanding of instruction-tuned LLMs.

Proposed method

  • Utilize instruction-tuned large language models (LLMs) to evaluate code snippets based on predefined, multi-dimensional assessment criteria.
  • Design a prompt-based evaluation framework that guides LLMs through structured assessment steps without requiring instruction generation or weighted scoring functions.
  • Define a set of evaluation dimensions—such as correctness, readability, and semantic alignment—based on human judgment criteria.
  • Train and deploy the metric using LLMs pre-trained on both natural language and code data, enabling robust understanding of programming syntax and semantics.
  • Apply the metric at both example and corpus levels to assess individual code snippets and overall model outputs.
  • Ensure evaluation is reference-free by relying solely on the LLM’s ability to judge code quality through natural language instructions and internal knowledge.
Figure 1: An illustration of ICE-Score . On the left-hand side, we input the task problems and corresponding generated code snippets. On the right-hand side, ICE-Score outputs the corresponding assessments.
Figure 1: An illustration of ICE-Score . On the left-hand side, we input the task problems and corresponding generated code snippets. On the right-hand side, ICE-Score outputs the corresponding assessments.

Experimental results

Research questions

  • RQ1Can an LLM-based evaluation metric achieve high correlation with human preferences in code generation without requiring reference code?
  • RQ2To what extent can an instruction-tuned LLM assess functional correctness of generated code without executing it or using test suites?
  • RQ3How does the proposed ICE-Score metric compare to state-of-the-art metrics like CodeBERTScore and G-EVAL in terms of alignment with human judgment and functional correctness?
  • RQ4Does ICE-Score generalize across multiple programming languages, including Java, Python, C, C++, and JavaScript?
  • RQ5Can a reference-free, LLM-driven evaluation framework maintain consistency and accuracy in low-resource or complex code intelligence tasks?

Key findings

  • ICE-Score achieves superior correlation with human preferences compared to existing metrics like G-EVAL and CodeBERTScore, particularly in reference-free settings.
  • The metric demonstrates strong correlation with functional correctness across four programming languages, indicating robust generalization across diverse syntax and semantics.
  • ICE-Score outperforms traditional metrics such as BLEU and ROUGE, which show weak alignment with human judgment due to their reliance on token-level matching.
  • The evaluation framework does not require test suites or reference code, significantly reducing the cost and complexity of code evaluation in low-resource scenarios.
  • The method maintains high consistency and accuracy at both the example and corpus levels, confirming its reliability for large-scale model evaluation.
  • The authors publicly released the metric and associated datasets to support further research in automated code evaluation, promoting reproducibility and community development.
Figure 2: Example inputs and outputs with (a) ICE-Score , (b) ICE-Score with Zero-Shot Chain-of-Thought. With the step-by-step evaluation, the output assessment is more aligned with human preference.
Figure 2: Example inputs and outputs with (a) ICE-Score , (b) ICE-Score with Zero-Shot Chain-of-Thought. With the step-by-step evaluation, the output assessment is more aligned with human preference.

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.