跳到正文
arXiv (AI + Vision + Imaging)· Musfiqur Rahman, SayedHassan Khatoonabadi, Emad Shihab·· 9 天前AI 评分22

RealClassEval:LLM在真实仓库类级代码生成上正确率仅25-34%

Beyond Synthetic Benchmarks: Evaluating LLM Performance on Real-World Class-Level Code Generation

AI 导读

研究团队构建了来自真实开源仓库的RealClassEval基准,含400个类并按模型训练截止时间分为已见与未见两部分。对七个先进LLM的评测显示,合成任务正确率达84-89%,真实类级代码生成仅25-34%,已见与未见代码库差异极小。文档仅带来1-3%提升,检索增强提升4-7%,84%的失败集中于AttributeError、TypeError和AssertionError。

正文 · 原文

arXiv:2510.26130v3 Announce Type: replace-cross Abstract: Large language models (LLMs) have advanced rapidly from well-studied function-level code generation to emerging repository-level approaches, yet this progression reveals a critical gap: class-level code generation, which is the fundamental building block connecting individual functions to complete repositories, remains systematically underexplored. Understanding class-level capabilities is a prerequisite to repository-level success, as current approaches cannot distinguish whether failures stem from basic implementation deficiencies or sophisticated context management issues. We introduce RealClassEval, a benchmark derived from real-world open-source repositories, comprising 400 classes divided into seen and unseen partitions based on model training cutoffs. Our systematic evaluation across seven state-of-the-art LLMs reveals fundamental limitations masked by synthetic benchmarks: while LLMs achieve 84 to 89% correctness on synthetic tasks, they attain only 25 to 34% on real-world classes, with minimal distinction between seen and unseen codebases. Notably, this performance range converges with concurrent work using rich natural language descriptions and repository context, suggesting that specification complexity cannot overcome core implementation bottlenecks. Documentation provides marginal improvements (1 to 3%), while retrieval augmentation yields greater gains (4 to7%), specifically with incomplete specifications. Error analysis reveals AttributeError, TypeError, and AssertionError dominate 84% of failures, with distinct patterns between synthetic (logic-focused) and real-world (object-oriented) scenarios. These findings establish the diagnostic foundation necessary for advancing both fundamental LLM capabilities and sophisticated repository-level approaches, while providing actionable guidance for production deployment strategies.

来源:arXiv (AI + Vision + Imaging) · arxiv.org