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

使用大型语言模型进行自动库迁移:初步结果

Automatic Library Migration Using Large Language Models: First Results

Aylton Almeida, Laerte Xavier, Marco Tulio Valente

AI总结:

本研究首次探索使用ChatGPT支持API迁移任务,通过评估Zero-Shot、One-Shot和Chain Of Thoughts三种提示,发现One-Shot提示效果最佳,成功将客户端应用迁移至新版SQLAlchemy并保留原始行为。

摘要:

尽管大型语言模型(LLMs)仅在几年前被引入,但开发人员已广泛将其用于代码生成。然而,它们在自动化其他软件工程活动中的应用在很大程度上仍未被探索。因此,在本文中,我们报告了一项研究的初步结果,在该研究中,我们正在探索使用ChatGPT来支持API迁移任务,这是一个需要开发人员投入大量精力和注意力的重要问题。具体而言,在本文中,我们分享了使用ChatGPT迁移客户端应用程序以使用较新版本SQLAlchemy的初步结果,SQLAlchemy是Python中广泛使用的ORM(对象关系映射)库。我们评估了三种类型的提示(Zero-Shot、One-Shot和Chain Of Thoughts)的使用,并表明最佳结果是由One-Shot提示实现的,其次是Chain Of Thoughts。特别是,使用One-Shot提示,我们能够成功迁移目标应用程序的所有列,并升级其代码以使用SQLAlchemy最新版本启用的新功能,例如Python的asyncio和typing模块,同时保留原始代码行为。

英文摘要:

Despite being introduced only a few years ago, Large Language Models (LLMs) are already widely used by developers for code generation. However, their application in automating other Software Engineering activities remains largely unexplored. Thus, in this paper, we report the first results of a study in which we are exploring the use of ChatGPT to support API migration tasks, an important problem that demands manual effort and attention from developers. Specifically, in the paper, we share our initial results involving the use of ChatGPT to migrate a client application to use a newer version of SQLAlchemy, an ORM (Object Relational Mapping) library widely used in Python. We evaluate the use of three types of prompts (Zero-Shot, One-Shot, and Chain Of Thoughts) and show that the best results are achieved by the One-Shot prompt, followed by the Chain Of Thoughts. Particularly, with the One-Shot prompt we were able to successfully migrate all columns of our target application and upgrade its code to use new functionalities enabled by SQLAlchemy's latest version, such as Python's asyncio and typing modules, while preserving the original code behavior.

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

↑