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.
翻译:大语言模型(LLM)的问世标志着人工智能领域的一个重要里程碑,其能力在多个领域已可与人类专家相媲美甚至超越。在众多成就中,LLM在翻译任务上的表现尤为突出,能紧密模拟人类译者为确保翻译内容的准确性和质量所采取的复杂预备流程。尽管利用LLM进行编程语言间翻译已取得进展,但智能合约翻译领域——特别是将代码翻译至LLM未曾接触过的语言——仍鲜有探索。本研究中,我们提出了一种开创性方法SolMover,该框架协同利用两个不同的LLM,旨在理解编码原理并将这种理解应用于将代码翻译至陌生语言。我们深入探究了LLM模仿人类学习过程的能力,并对将Solidity编写的智能合约转换为资源稀缺的Move语言的方法进行了深入评估。该框架利用第一个LLM解码新语言的编码规范,为缺乏规划能力但具备编程专长的第二个LLM创建蓝图。实验经验证据表明,SolMover相比gpt-3.5-turbo-1106显著提升性能,并优于Palm2和Mixtral-8x7B-Instruct等竞争模型。此外,我们的分析凸显了漏洞缓解策略在提升所有模型代码质量方面的有效性——即使在SolMover框架之外亦是如此。