arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2504.15564cs.SEcs.AIcs.LG
收藏

OpenClassGen: 一个大规模的真实世界Python类语料库用于大语言模型研究

OpenClassGen: A Large-Scale Corpus of Real-World Python Classes for LLM Research

Concordia University(康科德大学)

Musfiqur Rahman, SayedHassan Khatoonabadi, Emad Shihab

AI总结:

OpenClassGen提供324,843个Python类的语料库,用于评估大语言模型的代码生成能力,通过类骨架和静态代码度量指标,支持多种应用场景。

摘要:

现有类级代码生成数据集要么是合成的(ClassEval: 100类)要么规模不足(RealClassEval: 400类),限制了鲁棒评估和实证分析。我们提出了OpenClassGen,一个包含324,843个Python类的大型语料库,提取自2,970个工程开源项目。每个条目配对一个人工编写类与其对应的骨架,包含类和方法签名及其关联的文档字符串,并增强了27种静态代码度量指标,涵盖复杂性、耦合性、内聚性和继承性属性。不同于先前基准需要仓库级上下文解析,OpenClassGen提供自包含的类骨架作为完整的生成规范。我们通过评估三个LLM(GPT-o4-mini, Claude-4-Sonnet, Qwen-3-Coder)在300个经过筛选的可执行类子集上,增强了测试套件达到58%的分支覆盖率。结果表明语义相似性(CodeBERTScore-F3: 0.89)较强但功能正确性(通过率: 0.33)中等,模型间有显著差异。这种差异以及类特征的多样性证实了OpenClassGen能够区分LLM能力。该数据集支持多种用途,包括微调、检索增强生成、难度建模和失败模式分析。完整的数据集和编纂脚本在https://zenodo.org/records/18409150公开。

英文摘要:

Existing class-level code generation datasets are either synthetic (ClassEval: 100 classes) or insufficient in scale for modern training needs (RealClassEval: 400 classes), hindering robust evaluation and empirical analysis. We present OpenClassGen, a large-scale corpus of 324,843 Python classes extracted from 2,970 engineered open-source projects. Each entry pairs a human-written class with its corresponding skeleton, which comprises class and method signatures with associated docstrings, and is enriched with 27 static code metrics covering complexity, coupling, cohesion, and inheritance properties. Unlike prior benchmarks that require repository-level context resolution, OpenClassGen provides self-contained class skeletons that serve as complete generation specifications. We demonstrate the corpus's utility by evaluating three LLMs (GPT-o4-mini, Claude-4-Sonnet, Qwen-3-Coder) on a curated, executable subset of 300 classes, enriched with test suites achieving 58% branch coverage. Results show strong semantic similarity (CodeBERTScore-F3: 0.89) but moderate functional correctness (pass rate: 0.33), with substantial variance across models. This variance, along with diverse class characteristics, confirms that OpenClassGen enables meaningful differentiation of LLM capabilities. The dataset supports diverse use cases, including fine-tuning, retrieval-augmented generation, difficulty modelling, and failure mode analysis. The complete dataset and curation scripts are publicly available at https://zenodo.org/records/18409150.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑