An Abstract Domain for Certifying Neural Networks Gagandeep Singh Timon Gehr Markus PΓΌschel Martin Vechev Department of Computer Science 1
Adversarial input perturbations Neural network f 8 π½ " Neural network f 7 π½ β π % (π½ ' , π) Neural network f 9 2 π½ β πππ’ππ’π(π½ ' , π , π½, πΎ)
Neural network robustness Challenges Neural network π: β 5 βΆ β 7 The size of β π½ ' , π grows exponentially Given: Perturbation region β π½ ' , π in the number of pixels: β’ cannot compute f π½ for all π½ separately π % π½ ' , π : All images π½ where Prior Work pixel values in π½ and π½ ' differ by β’ Precise but does not scale: Regions: at most π β’ SMT Solving [CAVβ17] Rotate( π½ ' , π , π½, πΎ ): All images π½ in β’ Input refinement [USENIXβ18] π % π½ ' , π rotated by π β [π½, πΎ] β’ Semidefinite relaxations [ICLRβ18] β’ Scales but imprecise β’ Linear relaxations [ICMLβ18] βπ½ β β π½ ' , π . π π > π(π) β’ Abstract interpretation [S&Pβ18, T o Prove: where c is the correct output NIPSβ18] and j is any other output 3
This work: contributions A new abstract domain combining floating First approach to certify robustness under rotation combined with linear interpolation : point Polyhedra with Intervals: β’ based on refinement of the abstract input β’ custom transformers for common functions in β’ π = 0.001, π½ = β45 I , πΎ = 65 I neural networks such as affine transforms, ReLU, sigmoid, tanh, and maxpool activations β’ scalable and precise analysis Network π NIPSβ18 DeepPoly DeepPoly: β’ complete and parallelized end-to-end Γ 6 layers 0.035 proves 21% proves 64% implementation based on ELINA Γ 3010 units 15.8 sec 4.8 sec β’ https://github.com/eth-sri/eran Γ 6 layers 0.3 proves 37% proves 43% Γ 34,688 units 17 sec 88 sec 4
Our Abstract Domain N constraint with each π¦ L M and an upper polyhedral π L Shape: associate a lower polyhedral π L Concretization of abstract element π: Domain invariant: store auxiliary concrete lower and upper bounds π L , π£ L for each π¦ L π: #neurons, π: # constraints β’ less precise than Polyhedra, restriction π₯ 5WX : max #neurons in a layer, π : # layers needed to ensure scalability β’ captures affine transformation precisely Transformer Polyhedra Our domain unlike Octagon, TVPI Ξ(ππ U ) U Affine Ξ(π₯ 5WX π) β’ custom transformers for ReLU, sigmoid, Ξ(exp (π, π)) Ξ(1) ReLU tanh, and maxpool activations 5
Example: Analysis of a Toy Neural Network Input layer Hidden layers Output layer 0 0 1 max (0, π¦ ^ ) max (0, π¦ ` ) [β1,1] 1 1 1 π¦ ] π¦ ^ π¦ _ π¦ ` π¦ a π¦ ]] 1 1 0 1 1 1 π¦ U π¦ b π¦ c π¦ d π¦ ]' π¦ ]U [β1,1] β1 β1 1 max (0, π¦ b ) max (0, π¦ d ) 0 0 0 6
0 0 1 max (0, π¦ ^ ) max (0, π¦ ` ) [β1,1] 1 1 1 π¦ ] π¦ ^ π¦ _ π¦ ` π¦ a π¦ ]] 1 1 0 1 1 1 π¦ U π¦ b π¦ c π¦ d π¦ ]' π¦ ]U [β1,1] β1 β1 1 max (0, π¦ b ) max (0, π¦ d ) 0 0 0 7
ReLU activation Pointwise transformer for π¦ g β πππ¦(0, π¦ L ) that uses π L , π£ L M = π g N = 0, π g = π£ g = 0, ππ π£ L β€ 0, π g max (0, π¦ ^ ) M = π g N = π¦ L , π g = π L , π£ g = π£ L , π¦ ^ π¦ _ ππ π L β₯ 0, π g ππ π L < 0 πππ π£ L > 0 π¦ b π¦ c max (0, π¦ b ) choose (b) or (c) depending on the area Constant runtime 8
Affine transformation after ReLU π¦ _ 1 0 π¦ ` π¦ c 1 N Imprecise upper bound π£ ` by substituting π£ _ , π£ c for π¦ _ and π¦ c in π ` 9
Backsubstitution π¦ _ 1 0 π¦ ` π¦ c 1 10
0 max (0, π¦ ^ ) 1 π¦ ] π¦ _ π¦ ^ 1 1 0 π¦ ` 1 π¦ c 1 π¦ b π¦ U β1 max (0, π¦ b ) 0 U Affine transformation with backsubstitution is pointwise, complexity: Ξ π₯ 5WX π 11
0 0 1 max (0, π¦ ^ ) max (0, π¦ ` ) [β1,1] 1 1 1 π¦ ] π¦ ^ π¦ _ π¦ ` π¦ a π¦ ]] 1 1 0 1 1 1 π¦ U π¦ b π¦ c π¦ d π¦ ]' π¦ ]U [β1,1] β1 β1 1 max (0, π¦ b ) max (0, π¦ d ) 0 0 0 12
Checking for robustness Prove π¦ ]] β π¦ ]U > 0 for all inputs in β1,1 Γ[β1,1] Computing lower bound for π¦ ]] β π¦ ]U using π ]] , π£ ]U gives - 1 which is an imprecise result With backsubstitution, one gets 1 as the lower bound for π¦ ]] β π¦ ]U , proving robustness 13
More complex perturbations: rotations Challenge: Rotate( π½ ' , π , π½, πΎ ) is non-linear and cannot be captured in our domain unlike π % π½ ' , π Solution: Over-approximate Rotate( π½ ' , π , π½, πΎ ) with boxes and use input refinement for precision Result: Prove robustness for networks under Rotate( π½ ' , 0.001 ,-45 ,65 ) 14
More in the paper Sigmoid transformer Tanh transformer Maxpool transformer Floating point soundness 15
Experimental evaluation β’ Neural network architectures: β’ fully connected feedforward (FFNN) β’ convolutional (CNN) β’ Training: β’ trained to be robust with DiffAI [ICMLβ18] and PGD [CVPRβ18] β’ without adversarial training β’ Datasets: β’ MNIST β’ CIFAR10 β’ DeepPoly vs. state-of-the-art DeepZ [NIPSβ18] and Fast-Lin [ICMLβ18] 16
Results 17
MNIST FFNN (3,010 hidden units) 18
CIFAR10 CNNs (4,852 hidden units) 19
Large Defended CNNs trained via DiffAI [ICMLβ18] π Dataset Model #hidden units %verified robustness Average runtime (s) DeepZ DeepPoly DeepZ DeepPoly MNIST ConvBig 34,688 0.1 97 97 5 50 ConvBig 34,688 0.2 79 78 7 61 ConvBig 34,688 0.3 37 43 17 88 ConvSuper 88,500 0.1 97 97 133 400 CIFAR10 ConvBig 62,464 0.006 50 52 39 322 ConvBig 62,464 0.008 33 40 46 331 20
Conclusion A new abstract domain combining floating point Polyhedra with Intervals: π: #neurons, π: # constraints π₯ 5WX : max #neurons in a layer, π : # layers Transformer Polyhedra Our domain Ξ(ππ U ) U Affine Ξ(π₯ 5WX π) Ξ(exp (π, π)) Ξ(1) ReLU DeepPoly: complete and parallelized end-to-end β’ implementation based on ELINA https://github.com/eth-sri/eran β’ 21
Recommend
More recommend