arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2511.20933cs.SE
收藏

大型语言模型代码设计能力的分层评估

Hierarchical Evaluation of Software Design Capabilities of Large Language Models of Code

Dalhouise University(达尔豪斯大学);McGill University(麦吉尔大学);University of Murcia(穆尔西亚大学);Linköping University(林雪平大学)

Mootez Saad, Boqi Chen, José Antonio Hernández López, Dániel Varró, Tushar Sharma

AI总结:

本文评估了大型语言模型在代码设计能力上的分层表现,发现其在耦合性推理上易受噪声影响,而内聚性分析在受控环境下较稳健,但整体自主推理能力有限。

摘要:

大型语言模型(LLMs)正在越来越多地被应用于软件工程领域,但其对核心软件设计概念的鲁棒性仍然不明确。我们进行了一项实证研究,系统地评估了它们对内聚性(模块内)和耦合性(模块间)的理解。我们通过编程生成设计不佳的代码片段,并在不同指导水平下测试DeepSeek-R1模型家族(14B、32B、70B)。从简单的Verification到Guided和Open-ended Generation,同时通过注入干扰元素来改变上下文噪声。虽然在理想条件下,模型对这两个概念有坚实的基线理解,但其实际知识是脆弱且高度不对称的。关于耦合性的推理证明是脆弱的;在嘈杂、开放性场景中性能崩溃,F1分数下降超过50%。相比之下,模型对内聚性的分析在受控任务中表现出对内部噪声的鲁棒性,显示出很小的性能下降。然而,这种韧性在去除所有指导时也失败了。推理跟踪分析证实了这些失败模式,揭示了耦合性中的认知捷径和更详尽(但仍然失败)的分析。总之,尽管LLMs可以提供可靠的识别设计缺陷的帮助,但它们在嘈杂、现实环境中的自主推理能力有限,突显了需要更可扩展和稳健的程序理解能力的迫切需求。

英文摘要:

Large language models (LLMs) are being increasingly adopted in the software engineering domain, yet the robustness of their grasp on core software design concepts remains unclear. We conduct an empirical study to systematically evaluate their understanding of cohesion (intra-module) and coupling (inter-module). We programmatically generate poorly designed code fragments and test the DeepSeek-R1 model family ($14$B, $32$B, $70$B) under varying levels of guidance, from simple \textit{Verification} to \textit{Guided} and \textit{Open-ended Generation}, while varying contextual noise by injecting distractor elements. While models exhibit a solid baseline understanding of both concepts in ideal conditions, their practical knowledge is fragile and highly asymmetrical. Reasoning about coupling proves brittle; performance collapses in noisy, open-ended scenarios, with F1 scores dropping by over $50\%$. In contrast, the models' analysis of cohesion is remarkably robust to internal noise in guided tasks, showing little performance degradation. However, this resilience also fails when all guidance is removed. Reasoning-trace analysis confirms these failure modes, revealing \textit{cognitive shortcutting} for coupling versus a more exhaustive (yet still failing) analysis for cohesion. To summarize, while LLMs can provide reliable assistance for recognizing design flaws, their ability to reason autonomously in noisy, realistic contexts is limited, highlighting the critical need for more scalable and robust program understanding capabilities.

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

↑