project screenshot 1
project screenshot 2
project screenshot 3

BlockchainLLM

Integrating PETALS, a system for efficient fine-tuning or inference of large AI models, with Gnosis Chain/Polygon/ZkSync or Filecoin for improved incentives, privacy, and security. Blockchain-based incentives, zk-proofs for data privacy, smart contracts for security.

BlockchainLLM

Created At

ETHGlobal Paris

Project Description

PETALS (Peer-to-Peer Transfer and Layer Sharing) is a unique system developed to facilitate the inference and fine-tuning of large AI models collaboratively by combining the resources of multiple parties. This project is centered around enhancing PETALS by integrating it with Gnosis Chain, Filecoin, and privacy-preserving technologies such as zk-SNARKs.

In a typical application of PETALS, peers serve as servers or clients. Servers dedicate computational resources (like GPUs) to execute portions of large AI models, whereas clients submit input data and retrieve computed outputs from servers. However, as it stands, there are limitations concerning incentives for peers to serve as servers, and privacy concerns for clients.

To solve these challenges, this project leverages blockchain and zero-knowledge proof technologies.

  1. Incentives for peers to contribute:

One key element of this integration involves the use of blockchain technology to incentivize peers to contribute their resources as servers. By utilizing the Gnosis Chain or similar layer 2 solutions like Polygon or zkSync, we plan to introduce a system of rewards that encourages more peers to participate as servers.

For each unit of computation they serve, peers would earn tokens native to the chosen blockchain. These tokens could be used within the network to pay for services or traded for other currencies. This provides a monetary incentive for peers to contribute their computational resources to the PETALS network.

  1. Privacy for Clients:

A critical concern with the PETALS system lies in the privacy of input data. In the current model, peers serving the initial layers of the AI model could potentially recover input tokens, compromising the data privacy of clients. This is a considerable risk for clients dealing with sensitive data.

To address this issue, we propose integrating zk-SNARKs, a type of zero-knowledge proof technology. With zk-SNARKs, a client can prove to a server that they possess certain information (like input tokens) without revealing the information itself. This could ensure that although peers may serve the initial layers of a model, they won't be able to glean any meaningful information from the input tokens, thereby preserving the data privacy of clients.

In summary, this project seeks to create a robust, privacy-preserving, and incentivized network for the collaborative fine-tuning of large AI models using the PETALS system. This would allow more effective use of distributed resources, protect sensitive data, and offer rewards for those contributing to the network, ultimately making large-scale AI modeling more accessible, efficient, and secure.

How it's Made

This project was built using a combination of technologies to facilitate distributed machine learning, blockchain-based incentivization, and privacy-preserving computations. Here is a detailed breakdown:

  1. Python:

Python was the primary programming language used for this project due to its widespread adoption in both the machine learning and blockchain communities.

  1. Scaffold-Eth:

I used Scaffold-Eth, a development stack for Ethereum, as a foundation for building the smart contracts required for server incentivization and output verification. The Scaffold-Eth stack provided a rapid development environment, including a smart contract template, local Ethereum network for testing, and front-end React components. It also ensured compatibility with Ethereum-based layer 2 solutions like Polygon, Gnosis Chain, and zkSync, which we used for scaling and gas-fee reduction.

  1. Polygon/Gnosis/zkSync:

These Ethereum-compatible layer 2 solutions were used to provide scalability and lower transaction fees for the reward and dispute resolution systems. This allowed us to design a microtransaction system where peers could be rewarded for each unit of computation served, without incurring high transaction costs.

  1. zk-proofs (ezkl, zkml):

To address privacy concerns, I incorporated zk-proof technologies into the system. I used libraries like ezkl and zkml to construct zk-SNARKs or similar zero-knowledge proofs. These proofs ensured that clients could interact with servers without revealing sensitive input data.

  1. Docker:

Docker was used to containerize the various components of the project, including the Python machine learning application, the Ethereum nodes for Polygon/Gnosis/zkSync, and the zk-proof generator. This enabled easy deployment, scaling, and management of the system.

The overall structure of the system involved clients sending requests to servers via the blockchain, with transactions including zk-proofs for data privacy. Servers would then process these requests, provide the computation service, and submit the results back to the clients. Throughout this process, incentives were handled by smart contracts on the blockchain, providing a transparent and automated system for rewarding servers. Meanwhile, privacy was maintained through the use of zk-proofs, ensuring sensitive data was never exposed.

As a "hacky" solution, I developed a mechanism for "staking" a server's computational accuracy using the blockchain. Servers would put up a certain number of tokens as collateral, promising correct computations. If a server's computations were found to be incorrect via a dispute resolution process, the server would lose their staked tokens, providing an economic disincentive against incorrect or malicious computations. This staking mechanism utilized the smart contract capabilities of our chosen blockchain technologies, turning potential security threats into opportunities for enhancing network integrity.

background image mobile

Join the mailing list

Get the latest news and updates