ETHGlobal Brussels 🛠️ Explore zkML with Nethermind
ETHGlobal·Wed, Oct 9, 2024, 12:00 AM
Join Albert Garreta, from the Nethermind team, on this workshop and learn what’s expected from the Best zkML prize track contenders at ETHGlobal Brussels, a 3-day hackathon happening from July 12 to 14, 2024. This event brings together the most skilled web3 developers, designers and product builders from all around the globe for a weekend-long adventure to advance the Ethereum ecosystem!
Transcript
[Music] the main task of this project is very broad it it it asks you to build a project that combines ZK technology and machine learning this is a very broad description it is very open-ended so um the goal of this short presentation is to give you some ideas of how you can tackle this this project so you might want to start focusing on a sub branch of zkm so there are several sub branches there's one of the sub branches is proving correct in inference of a machine learning model this means that you prove that you execute a machine learning model that's maybe signed by a trusted Authority and then you create a proof that this model produce such an outcome on a public date on a public input and you also prove that the model that produce this output is signed has a has a correct signature but by this trusted Authority this is a very hot application of zkl it basically allows someone who run the a model to provide a very suxing proof that the model was executed correctly and also you can prove that your model is signed by some trusted Authority so for example maybe the model is signed by the government and suddenly you have a proof that is succeed very easy to verify and this proof says that you pass some some CR criteria and and uh you you are you're also proving that the model that the government signed this model so you are providing a proof that the government thinks that you pass this this criteria and yeah and there's there are several aspects in here there's the sness so the proof is very short it it can be very easy to verify as compared to just running the model you may also want to explore the ZK part of ZK ml for this application maybe you want to hide the input as well or or part of the model who knows um surprise us there's a another sub bran of zkl which is a bit it is a bit less explored less developed because it is significantly more complicated to in in practice to achieve then correct inference and it is proving the correct training of a model so there's some data set and you want to prove that a model was trained on the data set that's quite complicated because the training of a model is as you know the most expensive part of ml it um so training a large language model can cost billions of dollars or millions and yeah so proving such a computation with onas Nar is is looks very out of our reach right now but it is certainly an area that is being researched and and there are certainly teams that are tackling this problem so you might want to also take a look at this there's another branch of zkl called Federated learning in Federated learning there are several uh parties that have data and they don't want to share the their data because it's private maybe let's think of let's think um uh a network of hospitals each hospital has its own data they don't they don't want to share the data with the other hospitals because they just cannot legally so but but the hospitals want to train or run some machine learning model on on all this data and they want to merge all the data together so they they have a a more um a more uh deep data set so Federated learning aims to solve this problem because they cannot just share the DAT databases and merge them together because of legal reasons they would be uh disclosing patient information to to third parties uh so Federated learning is a branch of of machine learning or gkl it that um focuses on allowing this set of parties that have their own private data set to train or run models on this on this set without revealing the data sets to each other and yeah so these are some suggestions we strongly encourage you to to think of your own projects and and to surprise us with with your cre creativity in fact creativity is one of the judging criteria of this of this bounty we we want to see so of course we want to see projects that deal with zero knowledge machine learning but we will value in high we will have in high regard projects that are very creative that that are built upon an idea that is surprising and and interesting so yeah and to finish the this uh short introduction to the bounty let me give you some suggestions and recommendation so it might be easy to start at by looking at the problem of proving zkl inference that rather than for example proving training because as I said proving training is a much much harder problem in terms of efficiency than zkl inference and also there's much less research done there however as I said we we value creativity highly so if you are interested in um in exploring exploring the training problem we will we will also be happy with that and we will take into account that the training problem is is harder than the ckl inference we also recommend you to try to look and use existing Frameworks for zkl or uh existing uh domain specific languages you one way to start a project might be to look for some existing application or project and try to optimize some part of it for example one part I believe needs some some attention in zkl is how the floating Point arithmetic is treated right now so I think that many projects uh prove operations with floating Point arithmetics in ways that are a bit more expensive than they could be I think this could these operations could be improved with uh some look up operations for example some yeah basically look up look up operations maybe lass of source decomposability Etc so you might want to go to some existing project in ckl and identify some some some part of it that's non optimal and and try to come up with a a small Improvement there that would be a great a great great way to tackle this this bounty and also please feel free to appro approach us and ask us what what are these uh pain points in ckl that you could focus on we will give you more examples like the one of the like the floating Point arithmetic exam example yeah so also don't be super ambitious like always remember that the hackaton lasts what it last a couple days this this can be a hard problem getting into a very big project might be might sound great but there might not be time to to do that in a couple days and yeah please look at some um at some possible useful links that we added in the in the description destion of the bounty good luck and let us know any questions you may have we will be around hey I'm CAC I'm from the GS team nether mine which does security research and Audits and I'm here to talk about the security-driven development Bounty for the eth global event so just a quick primer on what the point of this bounty is we're looking to encourage teams at this hackathon to consider security during development particularly we're looking to see use of security tooling and Frameworks in addition to the standard test Suites that we would typically expect so what we have prepared is a list of some tools and Frameworks to give you some direction and some hints on what you might want to use you don't have to use all of them you can just use some or any that you think suit you in particular um and we just got a list of some sample ones for you we're going to weigh these differently because some are harder to implement and some are easier and I'll let you know which ones they are as we go through so starting with the one we're going to be weighing the highest this is fora um and fora is a realtime monitoring system so what you can do is you can watch for unexpected behaviors on your protocol you can set it to what monitor whatever you like really certain admin actions withdraws over a certain time the way it actually works is it analyzes traces in the call data and you can write you know you you can write your bots in typescript very very straightforward you can also consider some important parts of your protocol when monitoring such as deposits or withdraw flow assets that's quite important or things like anyone interacting with your protocol using a flash loan and then once you've monitoring these after these activities you'll get alerted if this does happen if you're interested in the for Bots we've actually got some links below which you can work through so that's the first one next up we have fuzzing now fuzzing we've actually split into two c atories because one is a lot easier to do and one is a bit harder so you've got stateless and stateful fuzzing but before we jump into that I'll give you a quick primer on what they are so fuzzing involves automatically generating a wide range of inputs to test a smart contracts Behavior you can set expectations such as the function shouldn't revert or it should return a particular type of value or something like that and if these expectations are broken after giving R these random inputs the fuzzer will tell you what the input was so now you know what's causing a problem in code and then you can fix it so that's a general breakdown of what fuzzing is so now we can jump into the particular versions so we'll start with stateless stateless fuzzing is fantastic for individual functions right so making sure that you know math or calculation heavy functions work correctly so you you focus on a particular function and it'll test random inputs to make sure it works correctly now this one we've got it weighed reasonably well but it is easier than State full fuzzing so we''ve got we're taking that in mind um and you can actually add stateless fuzzing into Foundry very easily because it's natively supported so I've got a little link down there how you can add fuzzing into your standard test Suite with very very little effort next up we have state full fuzzing this one is much more advanced than stateless and the way it works is instead of trying random inputs on one function state for fuzzing focuses on the contract as a whole so it helps to test contract Behavior through various State Transitions and SE es of transactions so as in the name State full fuzzing the contract state so storage and stuff is taken into account the same general concept or idea exists though you set your invariance and the fuzz is going to try a series of transactions interactions from different addresses different call data different functions in order to find a way to break your invariance you've said so an example of an invariant in this case could be a lending protocol where no more than 50% of the assets can be loaned out at any given time and if this invariant is broken the stateful fuzz will tell you what sequence of calls is needed and then you can figure out a way to fix it as well so for here we've got a list to Aida which is a fantastic tool for State for fuzzing the final one we've got listed as a suggestion here is symbolic execution so symbolic execution is similar quote unquote to fuzzing but there's some important differences to note so unlike fuzzing input values are not concrete so with fuzzing it'll choose random values and then it'll run them through but instead for symbolic execution it'll explore paths in the code and then you will have a constraint solver that will see if there's any feasible inputs that will satisfy the path conditions to what you want so let's say an example is we've got a function add which adds two numbers and we set a constraint it should not be possible to return 10 what will happen is symbolic execution we'll turn that function into a series of paths and then it will find some given input in a more mathematical sense instead of randomly guessing values it'll find these inputs two inputs that will result in the path we don't want which is 10 so for example that could be five and five the benefit of symbolic execution over standard fuzzing is you're not relying on random values instead you're exploring all possible paths ensuring really comprehensive coverage keep in mind though it is pretty computationally demanding for like multiple functions that have got a lot going on so typically you want to apply this to specific functions with core logic you know quite math heavy things that you want to make sure they behave correctly we've listed here resource to Halos which can actually Connect into Foundry in quite a simple way so it gives you easy access to symbolic execution and you don't have to worry about the the headaches of doing much of the behind the scenes stuff yourself so these examples should be a pretty good primer um and it should give you a good idea what you want to get started on um one thing I want to note is we're looking for quality of coverage as well so just adding these tools and putting them on you know an erc20 decimals thing which never changes obviously that's a relatively unimportant area so if you manage to apply some of these security tools in the more important critical aspects of your code then that's what obviously going to wait and consider that a lot stronger and other thing we want to note is if you have any other ideas on security tools which we haven't mentioned here you can feel free to use them as well this list wasn't meant to be comprehensive by any means so good luck and have fun hello I'm swapel I'm the head of inovation at nethermind and I also work on the switchboard team in nethermind switchboard team is focused on pre confirmations research and and development and we currently implementing some proof of concepts for some new types of pre confirmations on ethereum and for base rollups so pre confirmations stand to bring subsec sequencing to etherum and base rollups pre confirmations work by users communicating their transactions to the Future proposers directly or through a Gateway uh where the where the future proposer would sign on their users transactions ahead of time confirming that they would include the transaction when the block comes about the confirmations can break the best of experiences to Bas rups because currently Bas rups only produce blocks in every L1 block which is every 12 seconds pre confirmations would let Bas rups produce blocks between those 12 seconds and give users very fast confirmations it's quite a few R&D questions open in the pr confirmations world one of the big ones is pricing of free confirmations how should the user and validator come to agree on the pricing of pre confirmations mechanisms like e559 would bring the most transparency and most ease of use to prec confirmations there's a lot of infrastructure to be built for execution reconfirmations execution reconfirmations are where the user says Hey I want to execute this transaction and get these results as a result of executing these transactions think of things like intents uh as being similar and there needs to be bu there needs to be built some infrastructure to enable these confirmations we also need some dat dashboards bring some transparency into the world of pre confirmations the current pre-confirmation pipeline can be quite complex uh if you include gateways and whatnot and get data dashboards to bring some transparency here are much needed uh I'll be at the ne mind booth at e Russel so if you have any more questions or ideas about reconfirmations come talk to me hey my name is yor and I am the co- CTO at nethermind uh my CTO ship covers all of the Stark net related activities in the company which involves writing full nodes consensus algorithms uh zero knowledge proof systems block explorers apis sdks and so on the whole stack um the entire L2 narrative was around scaling ethereum and this is the reason that we got involved and uh from there most people have been focusing on cheaper fees let's do the same thing but just keep the fees as low as possible and people can then uh not pay $10 for doing one swap right while this is incredibly useful work this is not why we build bigger computers it's never has been we didn't build Doom to like you know show that you can't play games build Doom to show what the next game could look like everything is about like what can you do with more and more compute uh take other examples like AI is a simple simple algorithm from the 1970s 1980s with a lot of complexities to make it work but it only works because of things like black well absolutely gigantic machines um so it's not exciting to deploy a or Unis swap on on Stark net or on on bass and have cheaper fees this is cool but it's not like the the mind-blowing thing what's interesting is can we use larger programs in higher complexity classes for problems that haven't been solved yet right the the traditional Finance like systems use much more complicated simulation and uh like rooting algorithms than than crypto does so to understand what this problem like problem is about if you're a computer scientist think of all of the high complexity classes think about like NP problems think about like large scale compute challenges that you could possibly leverage to solve problems and think like would it be different if this thing was hosted on a blockchain like would it be different if it was triggered automatically every time you took an action so that's one way of thinking about it if you're not familiar with that then go read up on like high complexity class problems for the first like couple hours of the hackathon and like try to see where they fit I'll give you some examples um you if you're trying to do some sort of map based thing then like you have the traveling salesman's problem as a way of doing efficient routing that is mp uh I've forgotten exactly which NP subass it is but uh you can't really solve that for larger numbers but there are definitely lots of fistic algorithms that can that are still very very high like in the orders of n cubed n squar and so on um so these kind of issues just Maps think about like order routing which is like flow-based problems how do I pump as much like liquidity through different like channels in order to get the maximum value at the end um this is not done on chain and could totally be done so like an example of something that you could hack on is what if I did a trade on Stark net like through Avenue or some other like aggregate protocol at the end I actually try to burn a bunch of gas to compute um any like post trade Arbitrage opportunities so no one can back run you your algorithm back runs yourself like you never lose the value there uh it's not actually possible because that would require a lot more compute but it's already tangible so you can already start doing it like more efficiently because of this or say you're a protocol and you need to do some housekeeping um you can do this by aggregating across all the users so instead of your user just doing like a swap or setting a position in LP or or doing some basic action they do this and they do the house keeping for everyone else and they don't care because it costs like a cent right so this is where this becomes interesting is now that the protocols can do the housekeeping by leveraging the protocol users uh so that's a whole set of problems that you could look at um let's see is there more things that you could do with this uh absolutely and this is kind of where I want you to be the creatives and figure out what can you do now that you've got more compute and more stories and you ever did before you can also think like how does this look like in in future world you've got l2s they've got uh well the l1s are bounded basically by amount of storage they can put into memory how much data can you access quickly and cheaply right um so they try to keep it within this memory constraint and then distribute it over thousands of valat the l2s are not going to have this problem they're going to be Max 100 machines distributed or maybe 50 or maybe a thousand but we'll be able to say all of these are top-of-the line sort of like Enterprise grade machines right with 160 terab of ram right that that exists like not even sure that that's the upper bound I'm pretty sure it's much higher so if you have all these machines then storage is actually pretty cheap so make a completely onchain application where like all of the data is stored there that's feasible now in LTS uh yeah anyway you get the idea don't do the same thing do something more uh you know with what we have um that's where the interesting things are uh yeah if you're interested in more ideas along the space you can DM me on Discord or ask any of the people from nethermind um to be honest uh it's really hard to look at the state of play that currently is and imagine what the feature is but that's the whole fun of a hackathon so do something absolutely nuts and uh see what you come up with [Music]
Automatic transcript — names and jargon may be misspelled.