2025-02-18 · 专家 · 计算机视觉 · 自然语言处理 · 机器学习

SURGE: On the Potential of Large Language Models as General-Purpose Surrogate Code Executors

本文提出了一种名为SURGE的基准,用于评估大型语言模型作为通用代理代码执行器的潜力,并通过实验分析指出LLMs在代码执行预测方面的局限性和改进方向。

更新于 2025-02-18。作者:Bohan Lyu、Siqiao Huang、Zichen Liang。

中文摘要

大型语言模型(LLMs)在代码相关任务上表现出卓越的能力,如代码理解和代码生成。然而,一个同等重要但尚未充分研究的问题是,LLMs能否作为通用代码执行代理,在不实际运行程序的情况下预测其输出和行为。为了系统地调查这种能力,我们引入了SURGE,这是一个涵盖八个关键方面的全面基准:多语言编程任务、竞争级编程问题、代码库级代码分析、高成本科学计算、时间复杂度密集型算法、错误代码分析、依赖特定编译器或执行环境的程序,以及形式数学证明验证。我们在SURGE上评估了多个开源和专有LLMs,并进行了扩展研究,以分析模型大小和训练数据规模对代理执行准确性的影响。此外,我们对模型预测错误进行了分类,并探索了潜在的提升领域。我们的研究结果表明,尽管LLMs可以在某些情况下预测代码执行结果,但在通用代码执行代理方面存在局限性。这项研究为使用LLMs作为代理代码执行器的可行性提供了经验洞察。代码和数据集已发布在https://github.com/Imbernoulli/SURGE。

英文摘要

Large language models (LLMs) have demonstrated remarkable capabilities in code-related tasks, such as code understanding and code generation. However, an equally important yet underexplored question is whether LLMs can serve as general-purpose surrogate code executors, to predict the output and behavior of a program without actually running it. To systematically investigate this capability, we introduce SURGE, a comprehensive benchmark covering eight key aspects: multi-language programming tasks, competition-level programming problems, repository-level code analysis, high-cost scientific computing, time-complexity-intensive algorithms, buggy code analysis, programs dependent on specific compilers or execution environments, and formal mathematical proof verification. We evaluate multiple open-source and proprietary LLMs on SURGE and conduct a scaling study to analyze the impact of model size and training data scale on surrogate execution accuracy. Additionally, we categorize model prediction errors and explore potential areas for improvement. Our findings indicate that while LLMs can predict code execution results in certain cases, they exhibit limitations in general-purpose surrogate execution. This study provides empirical insights into the feasibility of using LLMs as surrogate code executors. Code and dataset are released at https://github.com/Imbernoulli/SURGE.

解读

一句话总结

本文提出了一种名为SURGE的基准,用于评估大型语言模型作为通用代理代码执行器的潜力,并通过实验分析指出LLMs在代码执行预测方面的局限性和改进方向。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源