Bitget App
Trade smarter
Buy cryptoMarketsTradeFuturesCopyBotsEarn

Axonum: Adding precompiled inference contracts to bring AI into the EVM

BlockBeats2024/05/01 03:10
By:BlockBeats
Original title: "Enshrine AI into EVM"
Original author: axonon
Original translation: Lucy, BlockBeats

Editor's note:
In the evolving field of blockchain technology, the integration of artificial intelligence marks a major leap forward. Axonum, known as the "brain of Ethereum", has become a pioneering platform that combines artificial intelligence capabilities with blockchain infrastructure. This article takes an in-depth look at Axonum's complex architecture, highlighting its innovative features and its far-reaching impact on the decentralized ecosystem. BlockBeats translated the original text as follows:


Axonum integrates artificial intelligence into the blockchain to create a decentralized supercomputer driven by the collective wisdom of the world.


The AI EVM is here


We are developing Axonum, an AI platform powered by optimistic rollup, with the world’s first AI EVM.


Our goal is to make AI applications accessible to everyone, making AI model inference more accessible and user-friendly.


Axonum is a platform powered by optimistic rollup and built-in AI, powered by opML and AI EVM. It allows users to easily use AI models natively in smart contracts without worrying about the complexity of the underlying technology.


Overview


AI EVM: Built-in AI


In order to implement local machine learning inference in smart contracts, we need to modify the execution layer of L2. Specifically, we built the AI EVM by adding a precompiled inference contract to the EVM.


AI EVM will perform machine learning inference in local execution and then return deterministic execution results. When users want to use AI models to process data, they only need to call the precompiled inference contract, provide the model address and input data, and then users can get the model output and use it natively in smart contracts.


Full code can be viewed in the original text


Models are stored in the model data availability layer (DA layer). All models can be retrieved from the DA layer by the model address, and we assume that the data of all models is available.


The core design principle of precompiled contract reasoning follows the design principle of opML, that is, we separate execution from verification. We provide two implementations of precompiled contract reasoning, one compiled for native execution, which is faster; the other compiled for fraud-proof virtual machines, which helps to prove the correctness of opML results.


For the implementation of execution, we reused the ML engine in opML. We will first get the model from the model center using the model address, and then load the model into the ML engine. The ML engine will take the user input in the precompiled contract as the model input, and then perform the ML inference task. The ML engine ensures the consistency and determinism of the ML inference results through quantization and soft floating point.


In addition to the current AI EVM design, another way to implement AI in the EVM is to add more machine learning specific opcodes to the EVM and change the resource and pricing model of the virtual machine and the implementation accordingly.


Optimistic Rollup


Both opML (Optimistic Machine Learning) and Optimistic Rollup (opRollup) are based on a similar fraud proof system, which makes it possible to integrate opML in the Layer 2 chain together with the opRollup system, which in turn will enable machine learning inside smart contracts on the L2 chain.


Similar to existing Rollup systems, Axonum is responsible for "Rolling" transactions for batch processing and then publishing them to the L1 chain, usually through a network of serializers. This mechanism can include thousands of transactions in a single Rollup, thereby increasing the throughput of the entire L1 and L2 system.


As one of the optimistic Rollups, Axonum is an interactive way to scale L1 blockchains. We optimistically assume that each proposed transaction is valid by default. Unlike traditional L2Optimistic Rollup systems, transactions in Axonum can contain AI model reasoning, which can make smart contracts on Axonum more intelligent.


Similar to optimistic Rollup, while mitigating potential invalid transactions, Axonum introduces a dispute period during which participants can challenge suspicious Rollups. There is a fraud proof scheme that allows multiple fraud proofs to be submitted. These proofs may make the Rollup valid or invalid. During the dispute period, if no challenge is raised (and the required proofs are in place), the state change may be argued, resolved, or directly included.


Workflow



This is the basic workflow of Axonum, not considering mechanisms such as pre-confirmation or forced exit:


· The basic workflow starts with a user sending an L2 transaction to a batching node (we allow local AI inference in smart contracts), usually a serializer.


· Once the serializer receives a certain number of transactions, it publishes them as a batch to the L1 smart contract.


· The validator will read these transactions from the L1 smart contract and execute them on its copy of the local L2 state. As for the execution of AI inference, the validator needs to download the model from the model DA and perform AI inference in the opML engine.


· Once processed, a new L2 state will be generated locally and this new state root will be published to the L1 smart contract. (Note that this validator can also be a serializer.)


· All other validators will then process the same transaction on their local copies.


· They will compare their generated L2 state root with the original state root published to the L1 smart contract.


· If the L2 state root of one of the validators is different from the state root published to L1, it can start a challenge on L1.


· The challenge will require the challenger and the validator that published the original state root to take turns proving what the correct state root should be. This challenge process is also called a fraud proof. Axonum's fraud proofs include fraud proofs of L2 state transitions and fraud proofs of opML.


· Whichever user loses the challenge will have their initial deposit (stake) slashed. If the original L2 state root published is invalid, it will be destroyed by future validators and will not be included in the L2 chain.


Fraud Proof Design


A core design principle of Axonum’s fraud proof system is that we separate the fraud proof process of Geth (the Golang implementation of the Ethereum client) and opML. This design ensures a strong and efficient fraud proof mechanism. Here is a detailed introduction to the fraud proof system and our separation design:


Fraud Proof System Overview:


· The fraud proof system is a key component to ensure the security and integrity of transactions on Axonum optimistic Rollup L2.


· It involves verifying transactions and computations to ensure that any malicious behavior or inaccuracies are detected and resolved.


Fraud Proof Process Separation:


Geth Fraud Proof Process:


· Geth, the Ethereum client responsible for L2, handles the initial stages of fraud proofs related to transaction verification and basic protocol compliance.


· It verifies the correctness of transactions and ensures that they comply with the rules and protocols of the L2 system.


opML Fraud Proof Process:


· opML, the Optimistic Machine Learning system integrated with Axonum, is responsible for handling the more complex aspects of fraud proofs related to the execution of machine learning models.


· It verifies the correctness of machine learning computations and ensures the integrity of AI-related processes within the L2 framework.


Benefits of Separate Design:


Enhanced Efficiency: By distributing the responsibility for fraud proofs, we optimize the efficiency of the entire system. Geth focuses on the transaction aspects, while opML handles ML-specific fraud proofs.


Scalability: The separate design allows for scalability, allowing each component to scale independently based on its specific processing requirements.


Flexibility: This separation provides flexibility, allowing upgrades and improvements to either Geth or opML components without compromising the overall fraud proof system.


Axonum: The Brain of Ethereum


Axonum is the first Optimistic Rollup that can natively, trustlessly and verifiably enable AI on Ethereum. Axonum leverages optimisticML and optimisticRollup, and introduces innovations in AI EVM to add intelligence to Ethereum's Layer 2. We engrave AI into the blockchain to build a decentralized supercomputer powered by the collective wisdom of the world.


「 Original link 」


欢迎加入律动 BlockBeats 官方社群:

Telegram 订阅群: https://t.me/theblockbeats

Telegram 交流群: https://t.me/BlockBeats_App

Twitter 官方账号: https://twitter.com/BlockBeatsAsia

0

Disclaimer: The content of this article solely reflects the author's opinion and does not represent the platform in any capacity. This article is not intended to serve as a reference for making investment decisions.

PoolX: Stake to earn
APR up to 10%. Always on, always earning.
Stake now!