arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.01107cs.SEcs.AIcs.LG
收藏

通过LLM合成程序性编辑:SPELL

SPELL: Synthesis of Programmatic Edits using LLMs

Carnegie Mellon University(卡内基梅隆大学);Carnegie Mellon University USA(卡内基梅隆大学(美国));INESC-ID / IST - Universidade de Lisboa(INESC-ID / IST - 莱里斯本大学)

Daniel Ramos, Catarina Gamboa, Inês Lynce, Vasco Manquinho, Ruben Martins, Claire Le Goues

AI总结:

SPELL通过LLM提取迁移示例并泛化为可重用的转换脚本,实现自动化API迁移。

摘要:

库迁移是软件开发中常见的但容易出错的任务。开发人员可能需要由于需求变化或许可证变化等原因将一个库替换为另一个。迁移通常涉及手动更新和重写源代码。虽然存在自动迁移工具,但大多数依赖于从已经历类似迁移的现实项目中挖掘示例。然而,这些数据稀缺,为任意库对收集这些数据困难。此外,这些迁移工具往往未能充分利用现代代码转换基础设施。在本文中,我们提出了一种新的自动化API迁移方法,以规避上述限制。我们不依赖现有迁移数据或直接使用LLM进行转换,而是使用LLM提取迁移示例。然后,我们使用代理将这些示例泛化为可重用的转换脚本,以PolyglotPiranha为现代代码转换工具。我们的方法从LLM中提炼出潜在的迁移知识,转化为结构化、可测试和可重复的迁移逻辑,无需预先存在的语料库或手动工程努力。在Python库上的实验结果表明,我们的系统可以生成多样化的迁移示例,并合成能够泛化到真实代码库的转换脚本。

英文摘要:

Library migration is a common but error-prone task in software development. Developers may need to replace one library with another due to reasons like changing requirements or licensing changes. Migration typically entails updating and rewriting source code manually. While automated migration tools exist, most rely on mining examples from real-world projects that have already undergone similar migrations. However, these data are scarce, and collecting them for arbitrary pairs of libraries is difficult. Moreover, these migration tools often miss out on leveraging modern code transformation infrastructure. In this paper, we present a new approach to automated API migration that sidesteps the limitations described above. Instead of relying on existing migration data or using LLMs directly for transformation, we use LLMs to extract migration examples. Next, we use an Agent to generalize those examples to reusable transformation scripts in PolyglotPiranha, a modern code transformation tool. Our method distills latent migration knowledge from LLMs into structured, testable, and repeatable migration logic, without requiring preexisting corpora or manual engineering effort. Experimental results across Python libraries show that our system can generate diverse migration examples and synthesize transformation scripts that generalize to real-world codebases.

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

↑