Today we are launching OAO, an onchain AI oracle, complementary to our zkOracle offering. The OAO is powered by opML (optimistic machine learning) on Ethereum and brings ML models onchain.
Currently, OAO supports LlaMA 2 and Stable Diffusion. Users can use these onchain models onchain.
The future of onchain machine learning is optimistic with opML.
Machine Learning and Artificial Intelligence, the trendiest and most talked-about computing paradigms today, have led to an acceleration of innovation.
Implementing ML or AI onchain can give machine learning computation the advantages of current onchain computing, including:
Verifiability
Computational Validity
Transparency
However, the convergence of AI x Crypto is facing challenges. Taking Ethereum as an example, running ML/AI model inference on the blockchain faces the following challenges:
Network resource: In order to ensure decentralization, it is not reasonable to have all nodes running complex ML computations in 12 seconds.
Computation limitation: Ethereum's EVM is a domain-specific environment for smart contracts, and does not take into account ML and AI-related computational adaptations.
Some pioneers are trying to implement onchain ML using zkML. The idea is to generate a cryptographic proof for ML computations that is succinct enough to be verified on the blockchain.
However, this approach is not really practical given the restraints of current computing power, here are some examples:
The zkML framework EZKL takes around 80 minutes to generate a proof of a 1M-nanoGPT model.
According to Modulus Labs, zkML has >>1000 times overhead than pure computation, with the latest report being 1000 times.
According to EZKL’s benchmark, the average proving time of RISC Zero is of 173 seconds for Random Forest Classification.
In the blockchain field, there is another commonly used form of proof: the fault/fraud proof, that is commonly deployed in optimistic rollups, and that can be serve as a more practical solution to realize onchain ML.
As the inventor of opML and the first open source implementation, we are thrilled to see the growing adoption of opML. opML can run Stable Diffusion and LLaMA 2 directly on Ethereum. You can find the latest and most complete information about opML in the whitepaper.
Compared to zkML or other onchain ML methods, opML is all you need.
zkML can run some small ML models onchain” & ”opML can run any ML model onchain”
⚠️ PLEASE ALWAYS CHECK docs.ora.io FOR LATEST UPDATES ⚠️
We are thrilled to announce the deployment of opML on the Ethereum network.
OAO, with opML at its core, allows anyone to use onchain ML inference on the blockchain.
OAO is a set of smart contracts including:
opML contract, for fault proofs and challenges to ensure ML is onchain and verifiable
AIOracle contract, for connecting the opML node with onchain callers to process ML request and introducing any ML model
User contract, to initiate and receive AI results from OAO. This can be any contract customized by developers
The specific architecture of the OAO is as follows. The user's contract can initiate an AI request by calling the OAO, the OAO will publish the request to the opML node for processing, and then the OAO will return the AI result to the user.
Usage process:
The user contract sends the AI request to the OAO on chain, by calling the requestCallback
function on the OAO contract.
Each AI request will initiate an opML request.
The OAO will emit a requestCallback
event which will be collected by the opML node.
The opML node will run the AI inference, and then upload the result onchain.
Challenge process:
The challenge window starts right after step 4 in the previous section.
During the challenge period, the opML validators (or anyone) will be able to check the result and challenge it if the submitted result is incorrect.
If the submitted result is successfully challenged by one of the validators, the submitted result will be updated onchain.
After the challenge period, the submitted result onchain is finalized (results can not be mutated).
When the result is uploaded or updated onchain, the provided result in opML will be dispatched to the user's smart contract via its specific callback function.
Here’s the annotated detailed workflow:
Here are the OAO contracts deployed onchain:
AIOracle: https://sepolia.etherscan.io/address/0xb880D47D3894D99157B52A7F869aB3B1E2D4349d
Prompt (example user contract attached to AIOracle): https://sepolia.etherscan.io/address/0x5d6963003Ad172Fd1D2A2fD18bB3967eA7Aef1a2
Currently, you can use the onchain ML model by initiating an onchain transaction by interacting with the prompt contract. We have uploaded two models to the OAO: LlaMA 2 (LLM model) and Stable Diffusion (Image Generation Model).
Interact on ora.io
You can directly interact with OAO at: https://www.ora.io/app/opml/sd.
Interact on Etherscan
Here’s the usage guide if you want to play with it directly on Etherscan. You can also check out the video guide with all the steps:
Go to the write contract tab, set modelId as 0 (LlaMA 2), and enter your prompt in human-readable text.
Go to the read contract tab, set modelId as 0 (LlaMA 2), and enter your previous prompt.
At this stage, we are experimenting with OAO and opML together with several projects:
7007.studio: The next generation marketplace to secure and govern AI models.
MyShell: A decentralized and comprehensive platform for discovering, creating, and staking AI-native apps.
Space Runners: A design tool built for fashion designers, powered by Stable Diffusion.
We are actively exploring the following use cases and directions:
AIGC NFT (ERC-7007), 7007 Studio won the Story Protocol Hackathon
zkKYC using facial recognition based on ML
Onchain AI Games (e.g. Dungeon and Dragons)
Prediction Market with ML
Content Authenticity (deepfake verifier)
Compliant programmable privacy
Prompt Marketplace
Reputation/Credit Scoring
With an OAO, anyone and any contract can experience the magic of onchain ML. An OAO is decentralized and verifiable with the help of opML and its optimistic mechanism.
For our OAO, we'll onboard more ML models. With our opML framework, you can Bring Your Own Model. Anyone is welcome to integrate with the OAO. And we have many more exciting releases coming in the future!
Optimistic machine learning will be the future of onchain machine learning. The future of onchain machine learning is optimistic!
Ora, formerly Hyper Oracle, is a verifiable oracle protocol that developers need to bring AI and any-size compute onchain. Ora breaks down the limitation of smart contracts, offering richer data sources and arbitrary compute. Ora’s work has been trusted by Compound, Ethereum Foundation, Uniswap, and more.
www.ora.io | twitter.com/oraprotocol | discord.gg/MgyYbW9dQj