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

大语言模型在Python和JavaScript类型与调用图分析中的实证研究

An Empirical Study of Large Language Models for Type and Call Graph Analysis in Python and JavaScript

Ashwin Prasad Shivarpatna Venkatesh, Rose Sunil, Samkutty Sabu, Amir M. Mir, Sofia Reis, Eric Bodden

AI总结:

实证评估24个LLM在Python和JavaScript调用图分析与类型推断中的表现,发现LLM在类型推断上优于传统工具,但在调用图生成上仍不及传统静态分析工具。

摘要:

大语言模型(LLMs)在软件工程中的潜力正受到越来越多的探索,特别是在静态分析任务中。在本研究中,我们调查了当前LLMs在增强Python和JavaScript程序的调用图分析和类型推断方面的潜力。我们实证评估了24个LLMs,包括OpenAI的GPT系列以及LLaMA和Mistral等开源模型,使用了现有和新开发的基准。具体而言,我们为用于Python类型推断的微型基准框架TypeEvalPy增强了自动生成能力,将其范围从860个Python类型注解扩展到77,268个。此外,我们引入了SWARM-CG和SWARM-JS,这是用于评估跨多种编程语言的调用图构建工具的综合基准套件。我们的发现揭示了LLMs在静态分析任务中表现出对比鲜明的性能。对于调用图生成,诸如用于Python的PyCG和用于JavaScript的Jelly等传统静态分析工具始终优于LLMs。虽然像mistral-large-it-2407-123b和gpt-4o这样的先进模型显示出前景,但它们在两种语言的调用图分析中仍难以保证完整性和健全性。相比之下,LLMs在Python类型推断中表现出明显优势,超越了HeaderGen等传统工具和HiTyper等混合方法。这些结果表明,尽管LLMs在类型推断方面具有前景,但它们在调用图分析中的局限性凸显了进一步研究的必要性。我们的研究为将LLMs集成到静态分析工作流中奠定了基础,提供了对其优势和当前局限性的见解。

英文摘要:

Large Language Models (LLMs) are increasingly being explored for their potential in software engineering, particularly in static analysis tasks. In this study, we investigate the potential of current LLMs to enhance call-graph analysis and type inference for Python and JavaScript programs. We empirically evaluated 24 LLMs, including OpenAI's GPT series and open-source models like LLaMA and Mistral, using existing and newly developed benchmarks. Specifically, we enhanced TypeEvalPy, a micro-benchmarking framework for type inference in Python, with auto-generation capabilities, expanding its scope from 860 to 77,268 type annotations for Python. Additionally, we introduced SWARM-CG and SWARM-JS, comprehensive benchmarking suites for evaluating call-graph construction tools across multiple programming languages. Our findings reveal a contrasting performance of LLMs in static analysis tasks. For call-graph generation, traditional static analysis tools such as PyCG for Python and Jelly for JavaScript consistently outperform LLMs. While advanced models like mistral-large-it-2407-123b and gpt-4o show promise, they still struggle with completeness and soundness in call-graph analysis across both languages. In contrast, LLMs demonstrate a clear advantage in type inference for Python, surpassing traditional tools like HeaderGen and hybrid approaches such as HiTyper. These results suggest that, while LLMs hold promise in type inference, their limitations in call-graph analysis highlight the need for further research. Our study provides a foundation for integrating LLMs into static analysis workflows, offering insights into their strengths and current limitations.

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

↑