Honey I SNARKED the GPT - EZKL Blog
This post is written in collaboration with Bianca Gănescu a Master’s student at Imperial College London (supervised by Jonathan Passerat-Palmbach) who was instrumental in making this happen, and Jason Morton. I am the lead developer on EZKL (stylized and pronounced Ezekiel), a library which enables users to convert computational graphs represented in the Open Neural Network Exchange (ONNX) format to a (Halo2-KZG) ZK-SNARK circuit. Since starting the project in August of 2022 we’ve come a long way in terms of the breadth of models we support, our proving performance, and also the community of folks building and researching on top of our tool! Bianca, as part of her Master’s thesis, wanted to get nanoGPT into a ZK-SNARK using our tooling. This post is a high level overview of the steps it took to make that happen. The sections below are somewhat technical and assume some knowledge of how the Halo2 API is structured. A question we often get is how we manage to get large models into a Halo
:first-child{mt:0!} _:where(pre){p:20;_r:8;_overflow:auto} _:where(pre,code:not(.highlight_*)){bg:fade-2;_bg:fade-92!@dark} _:where(strong,b,a,code:not(.highlight_*),mark,del){font:fade-92;_font:fade-12@dark} _:where(table){width:full;_border-spacing:0} _:where(td){v:baseline} _:where(td,th):first-child{pl:0} _:where(td,th):last-child{pr:0} _:where(td,th){bb:1;solid;fade-92/.06;_p:6;_b:fade-4/.04@dark} _:where(th){font:fade-78;_font:14;_text:left;_font:fade-12@dark} _:where(th,p_code,li_code,a,mark){font:semibold;_font:medium@dark} _:where(ul){list-style-type:disc} _:where(ul,ol,blockquote){pl
saved by
related reading
- A Mathematical Framework for Transformer Circuitstransformer-circuits.pub
- On the Biology of a Large Language Modeltransformer-circuits.pub
- ZKML Research Initiatives - HackMDhackmd.io
- Circuit Tracing: Revealing Computational Graphs in Language Modelstransformer-circuits.pub
- Let's build GPT: from scratch, in code, spelled out.youtube.com
- 0xPARC0xparc.org
- Let's reproduce GPT-2 (124M)youtube.com
- Explaining Halo 2 - Electric Coin Companyelectriccoin.co
- GitHub - karpathy/nanochat: The best ChatGPT that $100 can buy.github.com
- Planting trees on-chain - EZKL Blogblog.ezkl.xyz
- ZK Machine Learning - HackMDhackmd.io
- GPT in 60 Lines of NumPy | Jay Modyjaykmody.com