Verified-Intelligence / auto_LiRPA

auto_LiRPA: An Automatic Linear Relaxation based Perturbation Analysis Library for Neural Networks and General Computational Graphs
https://arxiv.org/pdf/2002.12920
Other
282 stars 69 forks source link

verification of models with customized 'forward' function wrapping pre-trained networks and nonlinear functions #74

Closed JianqiangDing closed 1 month ago

JianqiangDing commented 3 months ago

Hi,

I am trying to use alpha-beta CROWN to verify compositions of trained models and nonlinear functions by wrapping the trained model into a new model with customized forward function, such as NN(f(x)), where NN represents a neural network and f denotes some given nonlinear funcitons. I have two questions regarding this setup,

  1. Based on my understand of the methods in alpha-beta CROWN, the bounds computation should relies on detecting the structure of the network. Does the alpha-beta CROWN supports the verification for such models that wrap pre-trained models and involve nonlinear functions of the output of trained models? Will this affect the precision of the bounds computation?
  2. I have used an online demo to perform verification in the aforementioned settings, and it seems it works for NN(f(x)) . However, it fails when involving the computation jacobian of trained networks within the customize forward function, could you please provide some advice on why the second case failed and how to proceed if I want to use alpha-beta CROWN to verify some functions including jacobian of a trained network?

Any suggestions would be greatly appreciated, thank you for your time and consideration on these questions, and I look forward to your guidance!

Best regards

shizhouxing commented 1 month ago
  1. You can have a model wrapper, but the pre-trained model has to contain supported operators only.
  2. I don't have access to the demo you linked. But to use jacobian, you may need to use our JacobianOP for our library to detect it. See example https://github.com/Verified-Intelligence/auto_LiRPA/blob/master/examples/vision/jacobian.py and paper https://openreview.net/pdf?id=NSWNgQgoF71.