AI
New Dataset of 324K Python Classes Addresses Gap in LLM Code Generation Benchmarks
Researchers release OpenClassGen, a large-scale corpus of real-world Python classes extracted from open-source projects to enable robust evaluation of language models on code generation tasks.
Evaluating how well language models can generate code at the class level has been hampered by a lack of realistic, large-scale datasets. Prior benchmarks relied on either hand-crafted synthetic examples or collections too small for meaningful LLM training and assessment. A new corpus aims to close that gap.
The Dataset#
OpenClassGen comprises 324,843 Python classes drawn from 2,970 engineered open-source repositories. Each class is paired with a skeleton—the class and method signatures plus their associated docstrings—that serves as a complete specification for generation. The dataset also includes 27 static code metrics capturing properties like complexity, coupling, cohesion, and inheritance relationships, enabling nuanced analysis of class characteristics.
This design differs from earlier approaches that required access to full repository context to resolve dependencies. By providing self-contained class skeletons, OpenClassGen makes each example independently usable for model evaluation.
Evaluation Results#
The researchers evaluated three large language models—GPT-4o-mini, Claude-4-Sonnet, and Qwen-3-Coder—on a curated subset of 300 executable classes. The test suites for these classes achieved 58% branch coverage.
The findings revealed a consistent pattern:
- Semantic similarity was strong: CodeBERTScore-F3 reached 0.89 on average, indicating models produce structurally sound code that resembles human solutions
- Functional correctness lagged: Only 33% of generated classes passed their test suites
- Performance varied substantially: Meaningful differences across the three models confirm the dataset can effectively differentiate LLM capabilities
Enabling Further Research#
The corpus supports multiple research directions beyond basic benchmarking. Practitioners can use it for fine-tuning models, augmenting retrieval systems, analyzing what makes certain classes harder to generate, or investigating failure patterns that reveal model weaknesses.
The dataset and curation scripts are publicly available, positioning OpenClassGen as an open resource for the research community.

