ZKML integrates ZK technology to open the future of verifiable AI. What new application scenarios will it unlock?

ChainCatcher Selection
2023-06-01 16:36:10
Collection
Zero-Knowledge Machine Learning (ZKML) has the potential to change the landscape of the cryptocurrency world by adding artificial intelligence capabilities to smart contracts, unlocking more complex on-chain applications.

Original Title: 《 ZKML --- Towards a Future of Verifiable AI

Author: Avant Blockchain Capital

*Compiled by: Qianwen, * ChainCatcher

Background Introduction

In the past few months, the artificial intelligence industry has seen numerous breakthrough advancements. Models like GPT-4 and stable diffusion are changing the way people produce software, interact with the internet, and engage with it.

Despite the outstanding performance of these new AI models, some are concerned about the unpredictability of AI and alignment issues. For instance, the lack of transparency in the world of online services, where most backend operations are run by AI models, poses a significant challenge in verifying whether these models behave as expected. Additionally, user privacy is a concern, as all data provided to model APIs can be used to improve AI or exploited by hackers.

ZKML may be a brand new solution to these problems. By inputting verifiable and untrusted attributes into machine learning models, blockchain and ZK technology can form a framework capable of achieving AI alignment.

What is ZKML?

In this article, Zero-Knowledge Machine Learning (ZKML) refers to the use of zkSNARK (a type of zero-knowledge proof) to prove the correctness of machine learning inference without revealing the model's inputs or parameters. Depending on whether the information is private, the use cases of ZKML can be divided into the following types:

Public Model + Private Data:

  • Privacy-Preserving Machine Learning: ZKML can be used to train and evaluate machine learning models on sensitive data without disclosing the data to others. This is crucial for applications such as medical diagnosis and financial fraud detection. We have also seen some companies using ZKML for biometric data authentication to establish proof of humanity services.
  • Proof: In a world where most online content is generated by AI, cryptography can serve as a source guarantee for content authenticity. People are attempting to use ZKML to combat the issue of deepfakes.

Private Model + Public Data

  • Model Authenticity: ZKML can be used to ensure the consistency of machine learning models. This is important for users, as it ensures that model providers are not cutting corners by using lower-cost models or being hacked.
  • Decentralized Kaggle: ZKML allows participants in data science competitions to prove the accuracy of their models on public test data without disclosing the model weights used during training.

Public Model + Public Data

  • Decentralized Inference: This approach primarily leverages the simplicity of ZKML to compress complex AI computations into on-chain proofs similar to ZK rollups. This method can distribute the cost of model services across multiple nodes.

As zkSNARK becomes a very important technology in the cryptocurrency world, ZKML also has the potential to change the landscape of the cryptocurrency world. By adding AI capabilities to smart contracts, ZKML can unlock more complex on-chain applications. This integration is described within the ZKML community as "giving blockchain eyes."

Technical Bottlenecks

However, ZK-ML also faces several technical challenges that urgently need to be addressed.

  • Quantization: ZKP works in the field, but neural networks are trained in floating-point. This means that to make neural network models friendly to zk/blockchain, they need to be converted into fixed-point arithmetic representations with complete computational traces. This may sacrifice model performance due to lower precision of parameters.
  • Cross-Language Translation: Neural network AI models are written in Python and C++, while ZKP circuits use Rust. Therefore, we need a translation layer to convert models into ZKP-based runtime. Typically, this type of translation layer needs to be model-specific, making it difficult to design a universal translation layer.
  • Computational Cost of ZKP: Essentially, the cost of ZKP is much higher than the original ML computation. According to ++an experiment by Modulus Labs++, generating proofs for a model with 20 million parameters takes over 1-5 minutes, with memory consumption around 20-60GB, depending on the ZK proof system.

Current Development

Even in the face of the above challenges, we have seen ZKML gaining attention in the cryptocurrency community, with some great teams exploring this field.

Infrastructure

Model Compilers

As the main bottleneck of ZKML is converting AI models into ZK circuits, some teams are researching infrastructure layers such as ZK model compilers. Starting from simple models like logistic regression or CNN models a year ago, the field has rapidly evolved to more complex models.

  • ++EZKL++ project now supports models with up to 100 million parameters. It uses ONNX format and the halo2 ZKP system. The library also supports submitting only part of the model.
  • ++ZKML++ library has already supported ZKP for GPT2, Bert, and diffusion models.

ZKVM

ZKML compilers also fall within the general category of zero-knowledge virtual machines.

  • Risc Zero is a zkVM that uses the open-source RiscV instruction set, so it can support ZKP in C++ and Rust. The ++zkDTP++ project demonstrates how to convert decision tree ML models into Rust and run them on Risc Zero.
  • We have also seen some teams trying to bring AI models on-chain with Startnet (++Giza++) and Aleo (++zero gravity++).

Applications

In addition to infrastructure initiatives, other teams are also beginning to explore applications of ZKML.

DeFi:

  • One use case in DeFi is AI-driven vaults, where mechanisms are determined by AI models rather than fixed strategies. These strategies can absorb on-chain and off-chain data to predict market trends and execute trades. ZKML ensures the consistency of on-chain models, allowing the entire process to be automated and trustless. Mondulus Labs is building ++RockyBot++. The team has trained an on-chain AI model to predict ETH prices and established a smart contract to trade automatically with that model.
  • Other potential DeFi use cases include AI-driven DEX and lending protocols. Oracles can also leverage ZKML to provide new types of data sources generated from off-chain data.

Gaming:

  • Modulus Labs has launched a ZKML-based chess game LeeLa, where all users play against a ZK-verified, AI-driven robot. AI can bring more interactive features to existing fully on-chain games.

NFT/Creator Economy:

  • ++EIP-7007++: This EIP provides an interface to verify whether AI-generated content for NFTs indeed comes from a model using certain inputs (prompts) via ZKML. This standard can empower AI-generated NFT collections and even inject momentum into new types of creator economies.

Identity:

  • The ++Wordcoin++ project is providing a proof of humanity solution based on user biometric information. The team is exploring the use of ZKML to allow users to generate IRIS (International Repair Information System) codes in a permissionless manner. When the algorithm for generating IRIS codes is upgraded, users can download the model and generate proofs themselves without needing to go to an object request agency.

Key to Adoption

Considering the high costs of zero-knowledge proofs for AI models, we believe the adoption of ZKML can start from some cryptocurrency-native use cases with high trust costs.

Another market worth considering is industries where data privacy is crucial, such as healthcare. Although there are other solutions like federated learning and secure MPC, ZKML has the advantage of a blockchain-scalable incentive network.

More broadly, the large-scale adoption of ZKML may occur due to a loss of trust in existing large AI providers. Will some events happen that raise awareness across the industry and prompt users to consider verifiable AI technologies?

Conclusion

ZKML is still in its early stages, and many challenges remain to be overcome. However, as ZK technology improves, we believe people will soon discover several ZKML use cases with strong product-market fit. These use cases may initially seem niche. But as centralized AI continues to develop and permeate every industry and even human life, people may find greater value in ZKML.

If you are building ZKML applications or infrastructure, please reach out on Twitter to ++@alanwwu++. We would be happy to talk with you.

Website: ++https://avant.fund++

Twitter: ++https://twitter.com/avantfund++

ChainCatcher reminds readers to view blockchain rationally, enhance risk awareness, and be cautious of various virtual token issuances and speculations. All content on this site is solely market information or related party opinions, and does not constitute any form of investment advice. If you find sensitive information in the content, please click "Report", and we will handle it promptly.
ChainCatcher Building the Web3 world with innovators