ML2SC: Deploying Machine Learning Models as Smart Contracts on the Blockchain

作者
Zhikai Li,Steve Vott,Bhaskar Krishnamachar
出处
期刊:Cornell University - arXiv [Cornell University]
被引量:1
标识
DOI:10.48550/arxiv.2404.16967
摘要

With the growing concern of AI safety, there is a need to trust the computations done by machine learning (ML) models. Blockchain technology, known for recording data and running computations transparently and in a tamper-proof manner, can offer this trust. One significant challenge in deploying ML Classifiers on-chain is that while ML models are typically written in Python using an ML library such as Pytorch, smart contracts deployed on EVM-compatible blockchains are written in Solidity. We introduce Machine Learning to Smart Contract (ML2SC), a PyTorch to Solidity translator that can automatically translate multi-layer perceptron (MLP) models written in Pytorch to Solidity smart contract versions. ML2SC uses a fixed-point math library to approximate floating-point computation. After deploying the generated smart contract, we can train our models off-chain using PyTorch and then further transfer the acquired weights and biases to the smart contract using a function call. Finally, the model inference can also be done with a function call providing the input. We mathematically model the gas costs associated with deploying, updating model parameters, and running inference on these models on-chain, showing that the gas costs increase linearly in various parameters associated with an MLP. We present empirical results matching our modeling. We also evaluate the classification accuracy showing that the outputs obtained by our transparent on-chain implementation are identical to the original off-chain implementation with Pytorch.

科研通智能强力驱动
Strongly Powered by AbleSci AI
科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
Lucas的应助被阿辉采纳,获得10
刚刚
小落发布了新的文献求助10
刚刚
风中的溪流完成签到 ,获得积分10
刚刚
pp发布了新的文献求助10
刚刚
酤贳完成签到 ,获得积分10
刚刚
派大星的应助被wu采纳,获得30
刚刚
xuhongfei完成签到,获得积分10
刚刚
tayyy完成签到 ,获得积分10
1秒前
邱邱啦完成签到 ,获得积分10
1秒前
MT发布了新的文献求助10
1秒前
虔虔完成签到,获得积分10
2秒前
漂流的云朵完成签到,获得积分10
2秒前
自觉绮发布了新的文献求助10
2秒前
3秒前
corn发布了新的文献求助10
3秒前
无极微光的应助被橘子采纳,获得20
3秒前
3秒前
xuanwo发布了新的文献求助10
3秒前
儒雅的善愁完成签到,获得积分10
3秒前
汎影发布了新的文献求助10
3秒前
Hui发布了新的文献求助10
4秒前
万能图书馆的应助被米多奇采纳,获得10
4秒前
qy发布了新的文献求助10
4秒前
夕沫完成签到,获得积分10
4秒前
十七发布了新的文献求助10
4秒前
zhang完成签到,获得积分10
5秒前
MAZE完成签到 ,获得积分10
5秒前
威武盼海完成签到,获得积分10
5秒前
5秒前
泥過发布了新的文献求助10
5秒前
5秒前
马少洋完成签到,获得积分10
6秒前
6秒前
文艺寄风完成签到 ,获得积分10
6秒前
小老贾完成签到,获得积分20
7秒前
7秒前
7秒前
激动的从霜完成签到,获得积分10
7秒前
Jasper的应助被小落采纳,获得10
7秒前
冷酷以山发布了新的文献求助10
7秒前
高分求助中
(应助此贴封号)【重要!!请各用户(尤其是新用户)详细阅读】【科研通的精品贴汇总】 10000
Essentials of Carbohydrate Chemistry and Biochemistry, 4th Edition 1000
Электротехническая система магнитожидкостной герметизации валов регулируемых электродвигателей 800
日本語と中国語及びチベット・ビルマ語の語源関連性に関する分析 800
Practical Manual of Forensic Psychophysiology: Methodology, Execution, and Fields of Application 800
Holistic Discourse Analysis, Second Edition by Robert E. Longacre 666
The Basics of Practical Optimization, Second Edition 600
热门求助领域 (近24小时)
化学 材料科学 医学 生物 计算机科学 工程类 纳米技术 有机化学 物理 生物化学 化学工程 内科学 复合材料 催化作用 心理学 人工智能 细胞生物学 光电子学 无机化学 量子力学
热门帖子
关注 科研通微信公众号,转发送积分 7971955
求助须知:如何正确求助?哪些是违规求助? 9437521
关于积分的说明 21050347
捐赠科研通 7548453
什么是DOI,文献DOI怎么找? 3373547
关于科研通互助平台的介绍 2508454
邀请新用户注册赠送积分活动 2406235