Giza CLI: A Gateway to Giza
Oct 12, 2023
Software development loves abstractions. Thanks to this, developers can implement complex algorithms and libraries without requiring domain specific expertise. Consider how many use hashing algorithms or Fast Fourier Transform libraries: while beneficial, a deep understanding of their internal mechanics simply isn’t necessary to build something useful.
In recent years, however, zero-knowledge cryptography has enabled us to prove substantial computations on blockchains such as transaction rollups, virtual machine traces, and (you guessed it) machine learning models. However, as the realm of machine learning intersects with blockchain and cryptography, engineers must have the tools to remain competitive. In the age of ‘verify, don’t trust,’ the question becomes: how can model predictions be assured in an untrusted environment? How can the verifiability of a model be guaranteed while preserving a focus on the model’s predictive capabilities? What’s needed to facilitate a machine learning engineer in utilizing cryptography to integrate machine learning outcomes into smart contract systems?
Today, we’re unveiling the Giza CLI (Command Line Interface) which is the latest addition to our developer toolkit. It’s designed to abstract away the complexities of proof-based cryptography, enabling the rapid creation of verifiable programs like Cairo from a simple ONNX model.
Let’s look into the capabilities of the CLI.
Why Giza CLI?
The CLI serves as the primary entry point into the Giza Ecosystem, streamlining resource management and interaction with the Giza stack. In a domain as continually evolving as Verifiable Machine Learning, the technology may be intricate, but interfacing with it as a developer should be intuitive.
The CLI empowers users to manage and deploy verifiable models with just a few simplecommands. You bring your ideas, we provide the tools. As Giza evolves, so does the CLI. Every new feature finds its counterpart here, ensuring developers always have an intuitive interface to interact with.
The Giza CLI currently supports user management, model management, transpilation – a process by which any ONNX-compatible model is converted into a provable program in a language such as Cairo – and proof generation.
As a final step, users can verify a proof generated from a .casm file using the prover of choice (currently Stark Platinum prover). A reference example for our proving process can be accessed through this link.
Now let’s move on to succinct descriptions of our current capabilities:
Streamlined account handling
Secure email verification and password recovery
User-friendly experience enabled by simple commands
Effortless conversion from ONNX models to Cairo and other provable languages
Manage all your models, regardless of how they’re transpiled, in one place
Once your model is transpiled, you can proceed to generate an inference along with a proof
Coming soon: future versions will allow native proof verification directly within the CLI
Getting Started with Giza CLI
Let’s look at the Giza CLI with a basic example. Here's a quick walkthrough on creating a user account, logging in, retrieving user information, and transpiling a model:
Create and Verify User
Begin by creating your Giza user account. Follow up by verifying your email to enable login. It's as simple as:
After creation and verification, we can login:
Retrieve User Information
Once logged in, connect with Giza and retrieve your user details:
Transpile your Model
If you have an ONNX model, Giza can transpile it to Cairo (other proving languages coming soon) with the following command:
Prove your model
With `your_model.cairo`ready, use `scarb build` to compile your program and generate a .casm.json file. Subsequently, generate a proof of the model using following command:
The resulting output is a proof named `zk.proof` which can be employed for verification using a Cairo STARK Verifier.
For a full transpilation example, see here.
The Giza CLI is open-sourced under the MIT license, reflecting our commitment to an open AI future. Check out the LICENSEand source code for more details. If you are interested in contributing, visit our contributors page.
Giza CLI is more than just a tool: it represents an important step towards our shared vision of the future of Verifiable Machine Learning. Per our roadmap, we set foundations with key collaborations in the ecosystem including Yearn, Circles, and Kleros. The CLI marks the beginning of our move from the foundational phase to the public release phase, where the community takes the center stage. As a developer you are at the heart of our mission. Using the CLI, we'll unlock a trustworthy future for AI together.
Your insights and feedback during this journey are going to be critical. Upon interacting with the CLI, please share your thoughts and feedback by joining our Discord channel. Alternatively, you can reach out to us via firstname.lastname@example.org