sisl / NeuralVerification.jl

Methods to soundly verify deep neural networks
MIT License
224 stars 50 forks source link

which pkg Ai2 rely on ? #85

Closed Student2Pro closed 4 years ago

Student2Pro commented 4 years ago

I'm a university student studying math and I'm trying to find a way to improve Ai2, and I could really use some help with this pkg. I'd like to know which Pkg I don't need when I focus on Ai2. 图片

Student2Pro commented 4 years ago

I delete unnecessary part of this pkg because PicoSAT(if I remember it right) dosen't work on windows and I hope that by doing it the code would run faster. 图片

tomerarnon commented 4 years ago

Hi @Student2Pro, I'm not sure why exactly your original error was happening. It's probably because our package hasn't kept up with changes in our dependencies. If you'd like help tracking down which dependency needs downgrading, and to which version, I'm happy to help.

If you're hacking up NV.jl for the purposes of focusing only on Ai2, you can throw out JuMP, GLPK, SCS, and PicoSAT. You can also comment out all of the include blocks in the topmost NeuralVerification.jl file except the reachability block.

I should note that our implementation of Ai2 really does not do the original algorithm justice. The original paper describes the algorithm using zonotopes rather than h-polytopes (which ostensibly makes a huge difference). At the time that we implemented Ai2 here, we did not have methods for handling zonotope intersect/union operations (the authors of LazySets have since kindly implemented that functionality for us!). At some point we intend to revisit the algorithm and implement the original authors' actual method.

mforets commented 4 years ago

Hi @Student2Pro and @tomerarnon,

I'm interested to help implementing AI2 using zonotopes. I'm beginning to work with student @SebastianGuadalupe in this regard, who has been doing Zonotope and Parallelotope related stuff with us in LazySets lately. He will also possibly apply for GSOC. There are several things to do. I would suggest at some point to coordinate so we don't step over each other; JuliaReach gitter channel is the usual communication channel we use, but you can also reach me by email.

@Student2Pro some comments:

julia> ] add LazySets#mforets/nverif
tomerarnon commented 4 years ago

The precompilation time of the package may be faster, but that is just a couple of seconds anyways and only once when you load the package

True. If you're making edits incrementally and reloading the package each time (and therefore paying the price of precomplication each time), look into using Revise.jl instead!

I'm interested to help implementing AI2 using zonotopes.

Awesome to hear! From 0 to 2 interested parties within a day 😄 The idea is relatively straightforward. Right now Ai2 relies on two core methods, forward_partition and convex_hull.

I'm not sure whether both of these (overapproximate intersection and overapproximate convex-hull) are already implemented in LazySets, but if so, the extension of those two functions should be rather easy!

Student2Pro commented 4 years ago

Glad to hear from you @tomerarnon @mforets and thanks for your advices.

Hi @Student2Pro, I'm not sure why exactly your original error was happening. It's probably because our package hasn't kept up with changes in our dependencies. If you'd like help tracking down which dependency needs downgrading, and to which version, I'm happy to help.

I change the input from [-1.0, 1.0] to [-0.9, 0.9] and it worked and I got the correct result. Although I don't understand why. Maybe I made mistakes that I didn't realize. As for zonotopes, honestly I only know it's better than polytopes.

If you're hacking up NV.jl for the purposes of focusing only on Ai2, you can throw out JuMP, GLPK, SCS, and PicoSAT. You can also comment out all of the include blocks in the topmost NeuralVerification.jl file except the reachability block.

This is really helpful, appreciate it.

I'm interested to help implementing AI2 using zonotopes. I'm beginning to work with student @SebastianGuadalupe in this regard, who has been doing Zonotope and Parallelotope related stuff with us in LazySets lately. He will also possibly apply for GSOC. There are several things to do. I would suggest at some point to coordinate so we don't step over each other; JuliaReach gitter channel is the usual communication channel we use, but you can also reach me by email.

I haven't complete my code yet, but I can tell the idea. I'm combing ExactReach and Ai2, join sets before activation, so I only care 'abstract domian', and also because I know little about zonotopes. I misunderstood those packages and thank you for pointing it out.

I'll let you guys know once I finishing my code, you are also welcome check it in my repository called 'NVtest'.

mforets commented 4 years ago

The idea is relatively straightforward. Right now Ai2 relies on two core methods, forward_partition and convex_hull.

Thanks for your write-up! I have outsourced them to a separate issue (#87).

As for zonotopes, honestly I only know it's better than polytopes.

Affine transformations for polytopes in constraint representation are efficient only if the matrix is invertible; otherwise, the computational complexity is exponential in the dimension n, while for zonotopes, that operation is cheap (cheap as matrix-vector multiplications). On the other hand, computing the intersection of in H-representation can be easily done by concatenating the constraints (and removing redundant inequalities), while for zonotopes, they are not closed under intersection and overapproximations are often used -- in the case of the AI2 paper, the authors cite the method from this paper.