Customers
/
RISC Zero

How Spice AI is Helping Advance Trustless Machine Learning for All

Executive Summary

RISC Zero is on a mission to provide trustless compute to the internet by creating infrastructure and tooling to enable Web3 developers to build zero-knowledge software. Through its Bonsai computing platform, RISC Zero provides the tools and computation to bring massively parallel ZK-proving functionality to any developer, in any language, on any chain.

RISC Zero partnered with Spice AI to help enable a full-stack zkML solution for developers.  It was mission-critical for RISC Zero to be able to easily and quickly build, train, retrain, and share models. By using Spice AI’s low latency and real-time data access, RISC Zero was able to develop a framework that enables developers to build ML models and seamlessly deploy them to the RISC Zero zero knowledge virtual machine (zkVM). This case study will explore the partnership between Spice AI and RISC Zero and how RISC Zero is leveraging Spice AI's enterprise-grade data and infrastructure to achieve their goals.

RISC Zero’s Story & Mission

RISC Zero was started by co-founders Brian Retford, Frank Laub, and Jeremy Bruestle to tackle the biggest challenge to the software industry, and potentially to society: increased centralization and consolidation of not just the applications used but the infrastructure used to build and manage them. Therefore, RISC Zero is bringing general-purpose computing to the zero-knowledge ecosystem, enabling users to trust programs run anywhere while allowing developers to use the tools they already know and love.

The team is dedicated to making the internet the place everyone deserves. RISC Zero has already built the world's first zero-knowledge virtual machine capable of running arbitrary code as a zero-knowledge proof and is now creating an ecosystem on top of it.

RISC Zero is on a mission to empower web3 developers to create and implement ZK technology, enabling individuals worldwide to leverage its benefits. By providing open-source tools and resources, RISC Zero strives to democratize ZK and machine learning technology and make it available to developers and users everywhere. Spice AI shares this mission of supporting rapid application development and deployment with immediate and scalable utility.

Partnering with Spice AI

RISC Zero partnered with Spice AI to create a full-stack zkML solution for developers. Our joint challenge was to enable and showcase trustless machine learning alongside existing capabilities of trustless compute, generating cryptographic proofs attesting to the correct execution of any arbitrary Rust program.

The primary application of RISC Zero is scaling blockchain by offloading expensive logic and privacy-sensitive applications to its Bonsai proving service, enabling applications ranging from proving the correct calculation of Fibonacci numbers to proving the correct construction of entire Ethereum blocks.

However, to create a full-stack zkML solution where developers can query data, train ML models, and enable provable inference, RISC Zero leveraged Spice AI for an enterprise-grade data querying solution for blockchain data and model training, so they can focus on delivering best-in-class trustless compute service via Bonsai.

“We leveraged Spice AI’s enterprise-grade data querying solution for blockchain data to create a frictionless framework to enable developers to build zkML applications.” <div class="author_name">Roy Rotstein</div><div class="author_title">Software Engineer, RISC Zero</div>

RISC Zero’s Unique & Mission-Critical Challenge & Solution

RISC Zero recognizes that the demand for machine learning will increase as blockchain use cases continue to expand into new domains. In order to build robust models, it's not enough just to provide a service that generates zero knowledge proofs. Developers need high quality data.

The privacy-preserving aspect of zero-knowledge proofs allows model developers to keep model parameters private while generating verifiable, trustless inference. Developers can use RISC Zero to host their trained models to enable ML-as-a-service.

The workflow illustrated in this case study showcases how an XGBoost regression model can be trained on data obtained from Spice AI to create a gas fee prediction model. Such a model could be licensed to arbitrage traders and other DeFi users who may not have access to enterprise-grade data to create their own models. By computing the gas fee prediction inside the RISC Zero zkVM, developers have a means of attesting to the integrity of the gas fee prediction without having to reveal any information about the model parameters.

The ability to quickly query data from Spice AI's infrastructure allows model developers and deployers not only to rapidly get their models out in the ecosystem but also to retrain, adjust, and update models as needed. In the case of the gas fee prediction model, the developer needs real-time data as fast as possible to make that gas fee prediction for the next block. If the latency is too high, then the developer will not retrieve any output that will yield any meaningful benefit to the end user.

Proving Locally with RISC Zero & Spice AI

RISC Zero and Spice AI enable a workflow for generating proofs of inference and are aiming to deliver the industry's lowest latency and real-time data access to enable robust zkML applications.

Data collection and model training is done in Python. The model parameters are exported to the RISC Zero zkVM. The only bit of Rust code that developers need to modify will be adding input data.

Another key differentiator leveraging RISC Zero for zkML is that developers do NOT need to quantize model weights and input values, whereas most SNARK based solutions require all parameters to be quantized. The RISC Zero zkVM is equipped to handle f32 and f64 values.

Steps for Proving Locally with Risc Zero

  1. All querying can be done in Python using Spice AI’s Python SDK. Learn more here.
  2. Complete the ML training and create output datasets in Python using Spice Functions. Learn more here.
    a. Spice Functions is a hosted compute experience that enables developers to write code in their preferred language, such as Python, and run it on the Spice platform, co-located with Spice data.
    b. Spice Functions enables new use cases for developers building intelligent applications with time-series and blockchain data, including flexible data transformation and aggregations, AI/ML data preparation, alerting, filtering, and integrations with other services.
  3. The XGBoost model from the Forust-ml package is compatible with the RISC Zero zkVM. Using the XGBoost template, developers have the option to prove inference on their local device or through Bonsai.
XGBoost template
Learn more about the XGBoost template here.
github.com
XGBoost

Where We Are Now & Where We Are Going Next

Following the initial stage of the partnership, Spice AI and RISC Zero will continue to build tooling to enable a new wave of zkML use cases.

Supporting Emerging zkML Use Cases

Risk assessment:

Within the risk assessment category, Spice AI and RISC Zero are currently working on supporting a range of use cases that will reduce complexity and arm users with greater insight. For example, these include the ability to generate credit scores for blockchain and DeFi, providing a safe and easy means to assess risk. Similarly, the partnership can enable developers to to build assessment solutions that will allow lending pools to determine whether they should action a transaction based on information regarding a user's history, such as whether they have been liquidated.

Prediction and recommendation:

Price prediction and regression are essential tools for those working in computing and asset management. Developers can create zkML solutions that allow users to make better decisions with confidence, including enabling gas fee prediction and price predictions in other assets and verticals. For NFT-related builders and users, zkML solutions like recommender systems will allow them to make predictions relating to new tokens, protocols, and more.

Other Emerging Use Cases

Spice AI and RISC Zero will continue partnering to expand support for emerging zkML use cases beyond predictions, recommendations and risk assessment like criteria-based DAO member admittance, verification for accurately rewarding creators on a decentralized prompt marketplace for generative AI, and trustless auditing of ML-powered applications to prove no copyrighted images were used in a training dataset.

Use Cases
Transaction privacy & authentication
Risk assessment
Price prediction
Decentralized identity & data ownership
Industry
zkML
Trustless compute
Blockchain infrastructure
Cryptography
Customer’s website
https://www.risczero.com/

Work with Spice AI

Interested in working with Spice AI or looking to learn a little more about the work we do? We are always looking for our next big challenge. Book an introductory call via our Calendly. Take a deeper look at our enterprise offerings by visiting Spice.ai.

Visit Spice.ai
Author
Luke Kim
Founder and CEO
Share

spice.ai/cases/risc-zero

Join Our Newsletter
Thank you!
Your submission has been received.
Oops! Something went wrong while submitting the form.