CoCoNUT:结构化代码理解并非从树中自然产生
CoCoNUT: Structural Code Understanding does not fall out of a tree
AI总结:
本文提出 CoCoNUT 数据集,通过追踪代码执行路径揭示当前 LLMs 在结构化控制流理解上的不足,并引入递归、并行处理和 OOP 等关键结构子集进行评估。
摘要:
大型语言模型(LLMs)在涉及结构化和非结构化文本数据的广泛任务中展现了出色的性能。近期在代码生成、修复或补全的各种基准测试上的结果表明,某些模型具备与人类相当甚至超越人类的编程能力。在本研究中,我们证明,在此类基准测试上的高性能与人类理解代码中结构化控制流的内在能力并不相关。为此,我们从相关模型表现强劲的 HumanEval 基准测试中提取解决方案,并使用从各自测试集中采样的函数调用来追踪其执行路径。利用该数据集,我们调查了七个最先进的 LLMs 匹配执行轨迹的能力,发现尽管它们能够生成语义相同的代码,但其追踪执行路径的能力有限,特别是对于较长的轨迹和特定的控制结构。我们发现,即使是表现最好的模型 Gemini,也只能完全正确生成 47% 的 HumanEval 任务轨迹。此外,我们还引入了 HumanEval 中未包含的三个关键结构的子集:递归、并行处理和面向对象编程(OOP),包括继承和多态等概念。除 OOP 外,我们表明所调查的模型在相关轨迹上的准确率均未超过 5%。将这些专门部分与 HumanEval 任务汇总,我们提出了 CoCoNUT:用于导航理解与测试的代码控制流,它衡量模型在相关调用下追踪代码执行的能力,包括高级结构组件。我们得出结论,当前的 LLMs 需要大幅改进以增强代码推理能力。我们希望我们的数据集能帮助研究人员弥合这一差距。
英文摘要:
Large Language Models (LLMs) have shown impressive performance across a wide array of tasks involving both structured and unstructured textual data. Recent results on various benchmarks for code generation, repair, or completion suggest that certain models have programming abilities comparable to or even surpass humans. In this work, we demonstrate that high performance on such benchmarks does not correlate to humans' innate ability to understand structural control flow in code. To this end, we extract solutions from the HumanEval benchmark, which the relevant models perform strongly on, and trace their execution path using function calls sampled from the respective test set. Using this dataset, we investigate the ability of seven state-of-the-art LLMs to match the execution trace and find that, despite their ability to generate semantically identical code, they possess limited ability to trace execution paths, especially for longer traces and specific control structures. We find that even the top-performing model, Gemini, can fully and correctly generate only 47% of HumanEval task traces. Additionally, we introduce a subset for three key structures not contained in HumanEval: Recursion, Parallel Processing, and Object-Oriented Programming, including concepts like Inheritance and Polymorphism. Besides OOP, we show that none of the investigated models achieve an accuracy over 5% on the relevant traces. Aggregating these specialized parts with HumanEval tasks, we present CoCoNUT: Code Control Flow for Navigation Understanding and Testing, which measures a model's ability to trace execution of code upon relevant calls, including advanced structural components. We conclude that current LLMs need significant improvement to enhance code reasoning abilities. We hope our dataset helps researchers bridge this gap.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。