arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2403.09740cs.SEcs.AI
收藏

教机器编程:基于大语言模型的智能合约翻译

Teaching Machines to Code: Smart Contract Translation with LLMs

University Of Houston(休斯顿大学);Kent State University(肯特州立大学)

Rabimba Karanjai, Lei Xu, Weidong Shi

AI总结:

针对智能合约向陌生语言翻译的研究空白,提出融合双LLM协同的SolMover框架,通过一个LLM解析新语言规范为另一个编程型LLM提供蓝图,实现Solidity到Move的合约翻译,性能优于多款主流模型,缺陷缓解策略也能普适提升代码质量。

摘要:

大语言模型(LLM)的出现是人工智能领域的一个重要里程碑,其能力在多个领域常能匹配甚至超越人类专业水平。在这些成果中,LLM在翻译任务上的出色表现尤为突出,它们能紧密模拟人类译者为确保翻译内容的保真度与质量而采用的复杂前置处理流程。尽管目前在利用LLM实现不同编程语言间的代码翻译方面已取得进展,但智能合约翻译领域,尤其是将合约翻译为LLM未接触过的语言的相关研究,仍很大程度上处于空白状态。\n本研究提出了一种开创性方法SolMover,该方法在统一框架中融合两种不同LLM的协同作用,旨在让框架掌握编程原则,并将这一理解应用于将代码翻译为陌生语言的任务。研究深入探究了LLM模拟人类学习过程的能力,对我们提出的、将Solidity编写的智能合约转换为资源稀缺语言Move的方法进行了全面评估。该框架利用一个LLM解析新语言的编码规范,为第二个具备编程专业能力但缺乏规划能力的LLM生成转换蓝图。\n实验实证结果表明,SolMover的性能较gpt-3.5-turbo-1106有大幅提升,且优于Palm2、Mixtral-8x7B-Instruct等同类模型。此外,分析还凸显了我们的缺陷缓解策略在提升所有模型的代码质量方面的有效性,即便在SolMover框架之外也能发挥作用。

英文摘要:

The advent of large language models (LLMs) has marked a significant milestone in the realm of artificial intelligence, with their capabilities often matching or surpassing human expertise in various domains. Among these achievements, their adeptness in translation tasks stands out, closely mimicking the intricate and preliminary processes undertaken by human translators to ensure the fidelity and quality of the translated content. Despite the advancements in utilizing LLMs for translating programming code across different languages, the domain of smart contract translation, particularly into languages not previously encountered by the LLM, remains largely unexplored. In our research, we present a pioneering approach, SolMover, which harnesses the synergy of two distinct LLMs within a unified framework. This framework is designed to grasp coding principles and apply this understanding to the translation of code into an unfamiliar language. Our study delves into the capacity of LLMs to mimic human learning processes, offering an in-depth evaluation of our methodology for converting smart contracts written in Solidity to Move, a language with limited resources. The framework employs one LLM to decipher coding conventions for the new language, creating a blueprint for the second LLM, which, lacking planning abilities, possesses coding expertise. The empirical evidence from our experiments suggests that SolMover substantially enhances performance compared to gpt-3.5-turbo-1106, and achieves superior results over competitors such as Palm2 and Mixtral-8x7B-Instruct. Additionally, our analysis highlights the efficacy of our bug mitigation strategy in elevating code quality across all models, even outside the SolMover framework.

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

↑