arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.06203cs.ETcs.LG
收藏

使用LLM为机器学习模型生成优化后的Solidity代码

Generation of Optimized Solidity Code for Machine Learning Models using LLMs

Indian Institute of Technology Kharagpur(印度理工学院卡拉格普尔分校)

Nikumbh Sarthak Sham, Sandip Chakraborty, Shamik Sural

AI总结:

本文提出LMST方法,利用LLM将ML模型推理路径和链下权重自动转换为优化gas成本的Solidity代码,并通过概念验证DApp和实验证明在区块链上部署ML模型的可行性。

摘要:

尽管当前有大量机器学习(ML)模型可用,并且它们已在不同的平台上实现,但几乎没有可验证的ML代码能够在公共区块链上执行。我们提出了一种名为LMST的新方法,该方法能够利用大型语言模型(LLMs)将ML模型的推理路径及其在链下训练的权重转换为Solidity代码。我们进行了广泛的提示工程,以在考虑以太坊虚拟机(Ethereum Virtual Machine)的能力和限制的同时,实现超越单纯代码正确性的gas成本优化。我们还利用由此生成的代码开发了一个概念验证的去中心化应用,用于验证底层ML模型的准确性声明。大量实验证明了通过使用LLMs进行自动化代码翻译,在区块链上部署ML模型的可行性。

英文摘要:

While a plethora of machine learning (ML) models are currently available, along with their implementation on disparate platforms, there is hardly any verifiable ML code which can be executed on public blockchains. We propose a novel approach named LMST that enables conversion of the inferencing path of an ML model as well as its weights trained off-chain into Solidity code using Large Language Models (LLMs). Extensive prompt engineering is done to achieve gas cost optimization beyond mere correctness of the produced code, while taking into consideration the capabilities and limitations of the Ethereum Virtual Machine. We have also developed a proof of concept decentralized application using the code so generated for verifying the accuracy claims of the underlying ML model. An extensive set of experiments demonstrate the feasibility of deploying ML models on blockchains through automated code translation using LLMs.

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

↑