This is a simple Machine Learning graph writing in Cairo for verifiable inference.
Ensure you have the following installed:
- Rust
- Scarb 2.6.4
Here is a visual representation of the ML model graph:
The repository is organized as follows:
- ONNX Model File: Located here.
- Cairo Programs: Source code for the Cairo programs is in the model/cairo_programs directory.
- Program Arguments: Arguments for each Cairo program are found in model/program_args.
- VM Results: Generated trace and memory files are stored in model/vm_results
To generate the traces and memory files, follow these steps:
Navigate to each program directory and compile:
cd model/cairo_programs/node0
scarb build
cd model/cairo_programs/node1
scarb build
From the root of the repository, execute:
cargo run
The trace and memory files are generated in the vm_result directory.
We have chosen to represent each node of the network (Gemm and Relu operations) by separate Cairo programs. As the idea is to reduce the computational complexity of a Cairo program into small programs, and to prove all the nodes of the graph in parallel. Then we want to use recursive proving to merge the proofs and assert that the output of a node is equal to the input of the correlated node.