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

超越合成基准:评估大语言模型在真实世界类级别代码生成上的表现

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

Concordia University(康科德大学)

Musfiqur Rahman, SayedHassan Khatoonabadi, Emad Shihab

AI总结:

本文构建真实世界类级别代码生成基准,发现LLMs从合成基准的84-89%正确率骤降至25-34%,并证明检索增强比完整文档更能提升性能,为生产代码辅助提供改进方向。

摘要:

大语言模型(LLMs)在函数级代码生成基准上已展现出强大性能,然而真实世界的软件开发越来越需要类级别的实现,即在真实项目上下文中整合多个方法、属性和依赖关系。基准性能与实际效用之间的这一差距,引发了关于LLMs是否已准备好用于生产代码辅助的关键问题,尤其是它们在熟悉和陌生代码库之间的泛化能力。我们引入了一个源自真实世界开源仓库的基准,其中包含被划分为已见和未见分区的类,用于评估实际条件下的泛化能力。我们系统性地考察了输入规格完整性和检索增强生成如何影响多个最先进LLMs的类级别正确性。我们的评估揭示了一个显著的性能差距:尽管LLMs在合成基准上达到了84%至89%的正确率,但在真实世界类任务上仅达到25%至34%,且熟悉代码库与陌生代码库之间的差异极小。完整的文档仅带来边际改进(1%至3%),而检索增强通过提供具体实现模式带来了更大的提升(4%至7%)。错误分析表明,AttributeError、TypeError和AssertionError是主要的失败模式,并且在合成场景与真实世界场景之间存在不同的模式。这些发现为生产代码辅助工具中的上下文建模、文档策略和检索集成提供了可操作的见解。

英文摘要:

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.

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

↑