paperbot · PL 论文追踪

全部论文 待读 收藏

P2 JavaBench: A Benchmark of Object-Oriented Code Generation for Evaluating Large Language Models

JavaBench:面向大型语言模型的面向对象代码生成基准
ASE Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering2024匹配度 3/10 · 该论文是面向 LLM 的 Java 项目级 OOP 代码生成评测基准,研究目标是评估 LLM 的代码生成能力本身,而非将 LLM 作为工具用于静态分析/形式化验证,也不涉及浮点或贝叶斯程序分析,与用户画像的核心主线(PL↔AI 的程序分析交叉)基本错位。仅其“在缺乏基准的重要场景下构建高质量 benchmark(项目级 OOP、经 282 名本科生验证)”这一点与用户对基准类工作的偏好有轻微契合。引用 29 inbox
Jialun Cao, Zhiyong Chen, Jiarong Wu, Shing-Chi Cheung, Chang Xu
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出项目级 Java 基准 JavaBench,系统评测 LLM 生成面向对象代码的能力,发现其远逊于本科生。

现有代码生成基准在语言、粒度与特性三方面严重失衡:95.8% 涉及 Python,仅 5 个涉及 Java;超过 83.3% 为函数/语句级,项目级基准全部限于 Python;且普遍只考察基础语法,忽略封装、继承、多态等面向对象特性。为此作者提出 JavaBench——项目级 Java 基准,含 4 个项目、106 个类、389 个方法,测试覆盖率最高达 92%,并由 282 名本科生验证,平均得分 90.93/100。评测设计覆盖三种上下文设置、两种粒度的五种合成策略与三层级指标。实验显示 LLM 在项目级 Java 编程上远落后于本科生:无任何模型能完整正确完成任一项目,宽松评估下最高 Pass@5 仅 48.24%;以方法签名作为提示上下文可取得较理想的平衡。

问题
现有代码生成基准偏重 Python、偏重函数/语句级粒度,并忽视封装、继承、多态等面向对象特性,导致无法衡量 LLM 生成项目级 Java 代码的能力。
方法
构建项目级 Java 基准 JavaBench(4 个项目、106 个类、389 个方法,测试覆盖率 92%,经 282 名本科生验证),并设计涵盖三种上下文设置、两种粒度五种合成策略和三层级指标的系统评测方案。
评估
在 JavaBench 上对多个 LLM 展开实验:没有模型能完整正确完成任一项目,宽松评估下最高 Pass@5 为 48.24%,远低于本科生水平;同时比较不同上下文设置,发现方法签名是较理想的提示上下文。
原文摘要(Abstract)

Code generation benchmarks such as HumanEval are widely adopted to evaluate LLMs’ capabilities. However, after consolidating the latest 24 benchmarks, we noticed three significant imbalances. First, imbalanced programming language. 95.8% of benchmarks involve Python, while only 5 benchmarks involve Java, resulting in an insufficient understanding of LLMs’ capability to generate Java code. Second, imbalanced code granularity. Function-/statement-level benchmarks account for over 83.3% of benchmarks. Only a mere handful extends to class-/project-levels, and all are limited to Python. Third, lacking advanced features. Existing benchmarks primarily assess basic coding skills (e.g., variables, operators, and control structures), while overlooking advanced Object-Oriented Programming (OOP) features (i.e., encapsulation, inheritance, and polymorphism). Considering the prevalence of these advanced features in real-world Java project development, constructing benchmarks to test LLMs on handling OOP features is necessary.To fill these gaps, we propose JavaBench, a project-level Java benchmark that exercises OOP features. It comprises four Java projects with 389 methods in 106 Java classes. The test coverage is up to 92%, and JavaBench is attested by 282 undergraduate students, reaching a 90.93/100 average score (i.e., pass rate against the test suite), ensuring the quality of documentation, code skeleton, and tests. To better evaluate LLM’s capability against JavaBench, we introduce a systematic evaluation design covering three context settings and five synthesis strategies at two granularities using three hierarchical metrics. Our extensive experiment yields several interesting findings. First, we noticed that regarding project-level Java programming, LLMs are far behind undergraduate students (no project can be correctly completed by any studied LLMs, and at most 48.24% Pass@5 in a more relaxed evaluation). Second, using method signature as prompt context may strike an ideal balance for project-level code generation. JavaBench is publicly available at https://github.com/java-bench/JavaBench. We also release a leaderboard and invite model developers to participate and test their models against JavaBench at https://java-bench.github.io/leaderboard.html.CCS CONCEPTS• Software and its engineering → Automatic programming.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{CaoCWC024,
  title = {JavaBench: A Benchmark of Object-Oriented Code Generation for Evaluating Large Language Models},
  author = {Jialun Cao and Zhiyong Chen and Jiarong Wu and Shing-Chi Cheung and Chang Xu},
  booktitle = {ASE},
  year = {2024},
  doi = {10.1145/3691620.3695470}
}