在现实世界设置下评估大型语言模型的代码推理能力
Evaluating Code Reasoning Abilities of Large Language Models Under Real-World Settings
AI总结:
本文通过构建包含1200个问题的 dataset,评估 LLM 在现实复杂性下的代码推理能力,采用静态和动态分析方法,分类问题难度为 LC 或 HC,揭示现有评估方法主要偏向低复杂度问题。
摘要:
代码推理任务在大型语言模型 (LLM) 评估中变得普遍。然而,关于现实世界复杂性对代码推理影响的研究较少,例如过程间或过程内依赖、API 调用、嵌套构造和非原始复杂类型。在这样的简化设置下评估 LLM 会对其在实践中的泛化能力假设构成重大威胁。为了实现更真实的代码推理评估,我们从现有代码推理基准和流行的 GitHub Python 仓库中构建了 1200 个推理问题的数据集。我们的流程利用静态和动态程序分析,自动序列化/反序列化现实世界代码中的复合、复杂和自定义类型,远超以往仅使用原始类型的研究所能实现的范围。我们数据集的一个关键特征是通过九种多样且可解释的代码复杂度指标的原理性多数投票机制,将每个推理问题分类为低复杂度 (LC) 或高复杂度 (HC),从而得到两个具有语义意义且适合精确校准 LLM 推理能力的问题难度类别。这种分类表明,现有代码推理评估中使用的大多数问题属于 LC 类别,未能代表现实世界的复杂性。
英文摘要:
Code reasoning tasks are becoming prevalent in large language model (LLM) assessments. Yet, there is a dearth of studies on the impact of real-world complexities on code reasoning, e.g., inter- or intra-procedural dependencies, API calls, deeply nested constructs, and non-primitive complex types. Evaluating LLMs under such a simplistic setting poses a significant threat to assumptions about their generalizability in practice. To enable a more realistic evaluation of code reasoning, we construct a dataset of 1200 reasoning problems from two sources: existing code reasoning benchmarks and popular GitHub Python repositories. Our pipeline leverages static and dynamic program analysis to automatically serialize/deserialize compound, complex, and custom types galore in real-world code, going far beyond only primitive types used in prior studies. A key feature of our dataset is categorizing each reasoning problem as Lower Complexity (LC) or Higher Complexity (HC) via a principled majority-vote mechanism over nine diverse and interpretable code-complexity metrics, yielding two well-separated, semantically meaningful categories of problem difficulty suitable for precise calibration of LLM reasoning ability. This categorization shows that the problems used in existing code-reasoning evaluation mostly belong to the LC category, failing to represent real-world complexity.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。