# ZKML Intro Resources ## ZKML Projects === Projects: - Keras2Circom: https://github.com/ora-io/keras2circom * easiest to use- circom can generate solidity verifiers * leaves some performance on the table - EZKL: https://github.com/zkonduit/ezkl * Halo2 based, more performant but maybe slightly more involved to get onchain - Giza: https://www.gizatech.xyz/ * Cairo (STARK, not SNARK) based, may not do model privacy idk * Goes on the Starkware L2 which eventually rolls up to Ethereum (can be accessed from L1 but with extra steps) ## ZKML Writings - "Awesome ZKML": https://github.com/worldcoin/awesome-zkml?tab=readme-ov-file - Modulus Labs Series - How AI On Chain: https://medium.com/coinmonks/chapter-1-how-to-put-your-ai-on-chain-8af2db013c6b - Why AI On Chain: https://medium.com/@ModulusLabs/chapter-2-why-put-your-ai-on-chain-33b7625147b7 - On Chain AI Trading Bot: https://medium.com/@ModulusLabs/chapter-3-the-worlds-first-on-chain-ai-trading-bot-c387afe8316c - "Self Improving Blockchain": https://medium.com/@ModulusLabs/chapter-4-blockchains-that-self-improve-e9716c041f36 - Cost of On Chain AI: https://medium.com/@ModulusLabs/chapter-5-the-cost-of-intelligence-da26dbf93307 - Implementation Blog by Cathie So (Maybe a little technical): https://hackmd.io/@cathie/zkml - ZK implementation for MNIST: https://0xparc.org/blog/zk-mnist ## ZKML vs OPML There are ZK Rollups and Optimistic Rollups. Optimistic rollups assume honesty and anyone can recompute and check for fraud, whereas ZK rollups cannot produce valid proofs if the computation is not honest. Optimistic rollups are much quicker to post, but have long finality periods since other nodes need time to check and challenge. ZK is expensive to compute initially, but has instant finality guarantees. This analogy is similar to the novel exploration of OPML. - OPML Paper: https://arxiv.org/abs/2401.17555 - Can do 7B-LLaMa on laptop CPU reasonably - Combine with ZKML - layer input processing done in ZK while remaining layers done optimistically to get privacy for inputs (but not model weights) - Not sure the current progress- being maintained in https://github.com/ora-io/opml but not very active ## Model Training - https://medium.com/@Web3comVC/zero-knowledge-proof-and-ai-model-training-a05095496a39 - Train model verifiably without revealing the inputs - Collaboratively train a model where each participant does not reveal their data sets but builds the models - Alternatively, reveal commitments to the inputs to prove the inputs were used - ZK Proof of Training: https://eprint.iacr.org/2024/162.pdf