A UDITING AI MODELS FOR V ERIFIED D EPLOYMENT UNDER S EMANTIC S PECIFICATIONS
Anonymous authors
Paper under double-blind review
A BSTRACT
Auditing trained deep learning (DL) models prior to deployment is vital for preventing unintended consequences.
One of the biggest challenges in auditing is the lack of human-interpretable specifications for the DL models that are directly useful to the auditor.
We address this challenge through a sequence of semantically-aligned unit tests, where each unit test verifies whether a predefined specification (e.g., accuracy over 95%) is satisfied with respect to controlled and semantically aligned variations in the input space (e.g., in face recognition, the angle relative to the camera).
We enable such unit tests through variations in a semantically-interpretable latent space of a generative model.
Further, we conduct certified training for the
DL model through a shared latent space representation with the generative model.
With evaluations on four different datasets, covering images of chest X-rays, human faces, ImageNet classes, and towers, we show how AuditAI allows us to obtain controlled variations for certified training.
Thus, our framework, AuditAI , bridges the gap between semantically-aligned formal verification and scalability.
https://sites.google.com/view/audit-ai
I NTRODUCTION
Deep learning (DL) models are now ubiquitously deployed in a number of real-world applications, many of which are safety critical such as autonomous driving and healthcare (Kendall et al., 2019;
Miotto et al., 2018; Senior et al., 2020).
As these models are prone to failure, especially under domain shifts, it is important to know when and how they are likely to fail before their deployment, a process we refer to as auditing.
Inspired by the failure-mode and effects analysis (FMEA) for control systems and software systems (Teng & Ho, 1996), we propose to audit DL models through a sequence of semantically-aligned unit tests , where each unit test verifies whether a pre-defined specification (e.g., accuracy over 95%) is satisfied with respect to controlled and semantically meaningful variations in the input space (e.g., the angle relative to the camera for a face image).
Being semantically-aligned is critical for these unit tests to be useful for the auditor of the system to plan the model’s deployment.
The main challenge for auditing DL models through semantically-aligned unit tests is that the current large-scale DL models mostly lack an interpretable structure.
This makes it difficult to quantify how the output varies given controlled semantically-aligned input variations.
While there are works that aim to bring interpretable formal verification to DL models (Henriksen & Lomuscio, 2020; Liu et al., 2019), the scale is still far from the millions if not billions of parameters used in contemporary models (He et al., 2016; Iandola et al., 2014; Brown et al., 2020).
On the other hand, auditing has taken the form of verified adversarial robustness for DL models (Samangouei et al., 2018; Xiao et al., 2018a;
Cohen et al., 2019).
However, this has mostly focused on adversarial perturbations in the pixel space, for example, through Interval Bound Propagation (IBP), where the output is guaranteed to be invariant to input pixel perturbations with respect to
L p norm (Gowal et al., 2018; Zhang et al., 2019b).
While these approaches are much more scalable to modern DL architectures, the pixel space variations are not semantically-aligned, meaning they do not directly relate to semantic changes in the image, unlike in formal verification.
Consider a unit test that verifies against the angle relative to the camera for a face image.
A small variation in the angle (e.g., facing directly at the camera versus 5 ◦ to the left) can induce a large variation in the pixel space.
Current certified training methods are far from being able to provide guarantees with respect to such large variations in the pixel space with reasonable accuracy.
Our Approach.
In order to overcome the above limitations, we develop a framework for auditing,
AuditAI .
We consider a typical machine learning production pipeline (Fig. 1) with three stages, the design and training of the model, its verification, and finally deployment.
The verification is crucial in determining whether the model satisfies the necessary specifications before deployment.
We address the gap between scalability and interpretability by proposing to verify specifications for variations directly in a semantically-aligned latent space of a generative model.
For example in Fig. 1, unit test 1 verifies whether a given face classification model maintains over 95% accuracy when the face angle is within d ◦ , while unit test 2 checks under what lighting condition the model has over 86% accuracy.
Once the verification is done, the auditor can then use the verified specification to determine whether to use the trained DL model during deployment.
For semantically-aligned latent variations, we create a bridge between the generative model and the DL model such that they share the same latent space.
We incorporate a variant of IBP (Zhang et al., 2019b) for verification with respect to perturbations in the latent space.
Further this leads to a tighter and a much more practical bound in the output space compared to pixel-based certified training.
We also show that AuditAI can verify whether a unit test is satisfied by generating a proof for verification based on bound propagation.
Fig.
1 gives an overview of our auditing framework and
Fig.
2 elaborates on the generative model bridge.
Summary of Contributions:
We develop a framework, AuditAI for auditing deep learning models by creating a bridge with a generative model such that they share the same semantically-aligned latent space.
We propose unit tests as a semantically-aligned way to quantify specifications that can be audited.
We show how IBP can be applied to latent space variations, to provide certifications of semanticallyaligned specifications.
We show that AuditAI is applicable to training, verification, and deployment across diverse datasets:
ImageNet (Deng et al., 2009), Chest X-Rays (Irvin et al., 2019; Wang et al., 2017), LSUN (Yu et al., 2015), and Flicker Faces HQ (FFHQ) (Karras et al., 2019).
For ImageNet, we show that AuditAI can train verifiably robust models which can tolerate 25% larger pixel-space variations compared to pixel-based certified-training counterparts for the same overall verified accuracy of 88%.
The variations are measured as L 2 distances in the pixel-space.
The respective % increase in pixelspace variations that can be certified for Chest X-Rays, LSUN, and FFHQ are 22%, 19%, 24%.
We conclude with a human-study of the quality of the generative model for different ranges of latent-space variations revealing that pixel-space variations up to 62% of the nominal values result in realistic generated images indistinguishable from real images by humans.
A UDIT AI : A D EEP L EARNING A UDIT F RAMEWORK
In this section, we describe the details of our framework, AuditAI outlined in Fig.
1 for verifying and testing deep models before deployment.
We propose to use unit tests to verify variations of interest that are semantically-aligned.
The advantage of AuditAI is that the verified input ranges are given by several semantically aligned specifications for the end-user to follow during deployment.
In the following sub-sections, we formally define unit tests, outline the verification approach, and describe the specifics of AuditAI with a GAN-bridge shown in Fig.
2. U NIT T EST D EFINITION
Consider a machine learning model f : X → Y that predicts outputs y ∈ Y from inputs x ∈ X in dataset D .
Each of our unit test can be formulated as providing guarantees such that:
[Equation]
Here, i subscripts an unit test, encoder e i extracts the variation of interest from the input x , and S i,in denotes the set of range of variation that this unit test verifies.
If the condition is satisfied, then our unit test specifies that the output of the model f ( x ) would satisfy the constraint given by F ( · , · ) ≤ 0 .
For example, x could be an image of a human face, and f could be a classifier for whether the person is wearing eyeglasses ( f ≤ 0 means wearing eyeglasses and f > 0 means not wearing eyeglasses).
Then e i ( · ) could be extracting the angle of the face from the image, and S i,in could be the set { e i ( x ) | ∀ x | e i ( x ) | < 30 ◦ } constraining the rotation to be smaller than 30 ◦ .
And F ( x, y )
= − f ( x ) f ( x 0 ◦ ) ≤ 0 says that our classifier output would not be changed from the corresponding output of x 0 ◦ , the face image of x without any rotation.
In this case, when the end-user is going to deploy f on a face image, they can first apply e i ( · ) to see if the face angle lies within S i,in to decide whether to use the model f .
2. V ERIFICATION O UTLINE
Given a specification F ( x, y ) ≤ 0 , we need to next answer the following questions:
How do we obtain the corresponding components ( e i , S i,in ) in Eq.
What can we do to guarantee that F ( x, y ) ≤ 0 is indeed satisfied in this case?
For the sake of illustration, we first consider a scenario with a less realistic assumption.
We will then discuss how we can relax this assumption.
In this scenario, we assume that we are already given the encoder e i and a corresponding generator g i that inverts e i .
Continuing the previous example, e i can extract the face angle of a given face image.
On the other hand, g i ( x 0 ◦ , d ◦ ) would be able to synthesize arbitrary face image x d ◦ that is the same as x 0 ◦ except being rotated by d ◦ .
Given the generator g i and the encoder e i , we propose to obtain S i,in building on interval bound propagation (IBP)
(Gowal et al., 2018).
We include a treatment of IBP preliminaries in Appendix A.1.
Here, S i,in is the largest set of variations such that the specification F ( x, y ) ≤is satisfied.
Given a set of variations S i,in , IBP-based methods can be used to obtain a bound on the output of the network S i,out = { y : l y ≤ y ≤ u y } and it can be checked whether the specification F ( x, y ) ≤ 0 is satisfied for all values in S i,out .
We can start with a initial set S
i,in and apply g i to this set.
Then, we can first find out what would be the corresponding convex bound of variations of S
i,in in the image space X .
We can subsequently propagate this bound in X through f to Y to get S
i,out and check whether F ( x, y ) ≤ 0 is satisfied.
By iteratively searching for the largest set S ji,in such that F ( x, y ) ≤ 0 is still satisfied by S ji,out , we can obtain S i,in given F .
2. C ERTIFIED T RAINING THROUGH L ATENT R EPRESENTATION
In the previous section, we are able to find the set S i,in such that Eq.
(1) is satisfied given specification
F , encoder e i , generator g i .
However, there are several challenges that limit the practical application of this scenario.
First and foremost, while significant progress has been made in generative models, especially controlled generation (Brock et al., 2018; Karras et al., 2017), the assumption of having g i apriori is still unrealistic.
In addition, since the propagated bound is convex, one can imagine that the bound in X (high dimensional image-space) would be much larger than needed.
This leads to a much narrower estimate of S i,in .
While it could be true that Eq.
(1) is satisfied, we still need a non-trivial size of S i,in for the framework to be useful.
For example, if S i,in constrains face angle rotations to be within 1 ◦ then it may not be practical for the end-user.
For auditing ML models thoroughly, we require clear separation between the development and testing phases (i.e. black-box verification).
However, it might also be desirable in practice to train the model in such a way that the unit tests are likely to be satisfied in the first place.
In this case, we do have a tighter connection between the designer and the verifier.
We show that by relaxing the black-box constraint, we can simultaneously address the previously listed challenges in a white-box setting.
Now that we have access to the internal working and design of the ML model f , we propose to bypass the image generation step in our verification process through the use of latent disentangled representations.
More specifically, consider a ML model mapping f : X → Z → Y (denote by f d : Z → Y the downstream task) and a generative model mapping g : X → Z → ˆ X , such that f and g share a common latent space Z by virtue of having a common encoder e ( · ) (Fig. 2).
Since S i,in is a subset of the range of e , we have S i,in ⊆ Z .
This further implies that we do not have to apply IBP through g and the whole f .
Instead we only have to apply it through f d , which does not involve the expansion to the pixel space X .
We show in the experiment (Section 4) that this is important to have a practically useful S i,in .
In addition, AuditAI also alleviates the need of having a perfect generative model, as long as we can learn a latent space Z through an inference mechanism.
Learning the latent space.
There are three requirements for the latent space.
First, it should be semantically-aligned for us to specify unit tests in this space.
A good example is disentangled representation (Higgins et al., 2018; Tran et al., 2017), where a set of dimensions of the latent code would correspond to a semantically aligned variation of the original image.
As shown in Figure 2, a latent dimension could correspond to the pose variation, and we can select e i to be the value of this dimension, and S i,in as the proper range that the model would be verified for.
Second, our model should be verifiable , where the latent space is learned such that the corresponding S i,in is as large as possible given a specification function F .
In this case, AuditAI can be seen as doing certified training (Zhang et al., 2019b) to improve the verifiability of the model.
Finally, the latent space should be able to perform well on the downstream task through f d .
Combining these three criteria, our full training criteria:
L = L task + γL spec + δL gen combines three losses L gen , L spec , and L task that would encourage interpretability through the latent space of a generative model, verifiability, and task performance respectively.
γ and δ are relative weights (between 0 and 1) for the loss function terms.
We explain each of the losses below:
Verifiability ( L spec ).
Let f d be a feedforward model (can have fully connected / convolutional / residual layers) with K layers
z k
+
=
h k
( W k z k + b k ) , k = 0 , ..., K − 1 , where, z 0 =
e ( x ) , z K denotes the output logits, and h k is the activation function for the k th layer.
The set of variations
S i,in could be such that the l p norm for the i th latent dimension is bounded by ϵ , i.e. S i,in = { z :
||
z i − z 0 ,i || p ≤ ϵ } .
We can bound the output of the network S out =
{ z K : l K ≤ z K ≤ u K } through a variant of interval bound propagation (IBP).
Let the specification be F ( z, y ) =
c T z K + d ≤ 0 , ∀ z ∈ S
i,in , z K = f
d ( z ) .
For a classification task, this specification implies that the output logits z K should satisfy a linear relationship for each latent space variation such that the classification outcome arg max i z K,i remains equal to the true outcome y true corresponding to z 0 .
To verify the specification, IBP based methods search for a counter-example, which in our framework amounts to solving the following optimization problem, and checking whether the optimal value is ≤ 0 .
[Equation]
By following the IBP equations for bound-propagation, we can obtain upper and lower bounds [ z K , z K ] which can be used to compute the worst case logit difference
z K,y − z K,y true between the true class y true and any other class y .
We define ˆ z K =
z K,y (if y ̸ = y true ); ˆ z K
=
z K,y true (otherwise).
Then, we can define L spec as L spec =
CE (ˆ z K , y true ) .
In practice, we do not use IBP, but an improved approach CROWN-IBP (Zhang et al., 2019b) that provides tighter bounds and more stable training, based on the AutoLiRPA library (Xu et al., 2020).
We mention details about this in the Appendix.
Task Performance ( L task ).
Let, CE ( · ) denote the standard cross-entropy loss.
L task captures the overall accuracy of the downstream task and can be expressed as L task =
CE ( z K , y true ) .
Generative Model ( L gen ).
Finally, we have a loss term for the generative model, which could be a VAE, a GAN, or variants of these.
If the model is a GAN, then we would have an optimization objective for GAN inversion.
An assumption is being able to learn a disentangled latent space with semantically aligned concepts.
Let the overall loss be L gen which could also encapsulate other losses for more semantically-aligned disentanglement.
Typically we would train this generative model on a large amount of unlabelled data that is not available for training the classifier we are auditing.
2. D EPLOYMENT
Based on the perturbation radius ϵ and the nominal z 0 , we have different ranges [ z n 0 − 1 i ϵ, z n
+ 1 i ϵ ] for the verified error at the end of training the classifier.
Here, z n 0 =
e ( x n ) ∀ n = 1 , ...
N in the dataset D train and 1 i = 1 for the i th dimension (corresponding to the i th unit test) and is 0 otherwise.
We can convert this per-sample bound to a global bound for the i th latent code, [ z i , z i ] by considering an aggregate statistic of all the ranges, for example
[Equation]
} Nn =1 ) , µ ( { z n 0 ,i + 1 i ϵ } Nn =1 ) + σ ( { z n 0 ,i + 1 i ϵ }
Nn =1 )]
Here, µ ( · ) denotes the mean and σ ( · ) denotes the standard deviation.
Note that this is a global bound on the range of variations for only the latent dimension corresponding to the unit test, and does not concern the other dimensions.
During deployment, the end-user receives the model spec-sheet containing values of [ z i , z i ] for each unit test i and results with different values of perturbation radius ϵ .
Now, if the end-user wants to deploy the model on an evaluation input x eval , they can encode it to the latent Z space to get code z eval and check whether z eval ,i ∈
[ z 0 ,i , z 0 ,i ] in order to decide whether to deploy the model for this evaluation input.
T HEORETICAL R ESULTS
We show that although AuditAI considers perturbations in the latent space that allows a large range of semantic variations in the pixel-space, it retains the theoretical guarantees of provable verification analogous to IBP-based adversarial robustness (Zhang et al., 2019b; Xu et al., 2020).
Theorem 1 ( Verification.
The auditor can verify whether the trained model from the designer satisfies the specifications, by generating a proof of the same) .
Let x ∈ X be the input, z
=
e ( x ) be the latent code, f d be a feed-forward neural network with bounded derivatives, and S i,in = { z :
||
z i − z 0 ,i || p ≤ ϵ } be the set of latent perturbations.
Then, the auditor is guaranteed to be able to generate a proof for verifying whether the linear specification on output logits c T z K + d ≤ 0 ∀ z ∈ S i,in , z K =
f d ( z ) (corresponding to unit test i ) is satisfied.
Proof.
Here we provide a proof sketch and mention details in the Appendix A.2.
The verifier can generate a proof by searching for a worst-case violation max z ∈S i,in c T z
K + d s.t.
z
k +1 =
h k
( W k z k + b k ) k
= 0 , ..., K − 1 .
If the optimal value of this < 0 , then the specification is satisfied.
The verifier applies Interval-bound Propagation (IBP) to obtain an upper bound z K on the solution of this optimization problem, and checks whether the upper bound z K < 0 .
E XPERIMENTS
We perform experiments with four datasets in different application domains.
We choose the datasets
ImageNet, LSUN, FFHQ, and CheXpert where current state of the art generative models have shown strong generation results (Karras et al., 2019; 2017; Brock et al., 2018).
We show an illustration of what the generated images under latent perturbations look like in Fig 3.
Through experiments, we aim to understand the following:
How do the verified error rates vary with the magnitude of latent perturbations?
How does AuditAI compare against pixel-perturbation based verification approaches?
How does AuditAI perform during deployment under domain shift?
ImageNet contains 1000 different classes of objects.
We consider a BigBiGAN model (Donahue & Simonyan, 2019) as the base generative model such that the latent space is class conditional, and we can obtain latent codes corresponding to specific classes.
So, latent perturbations correspond to variations in different images within the same class.
The specification for verification is that the classifier outputs the correct class for all latent perturbations ϵ .
This is an unit test because we can verify with respect to each class separately.
Table 1 shows results for different ϵ on the test set.
The results confirm the intuition that increasing ϵ increases the verified error due to wider latent perturbations.
In Table 2, we compare a pixel-based robust training approach with our framework, both trained with the same underlying algorithm CROWNIBP (Zhang et al., 2019b).
For the same verified test error, we have the corresponding latent perturbation for AuditAI (call it ϵ 1 ) and the pixel perturbation for the pixel-based approach (call it ϵ 2 ).
Based on ϵ 2 we compute the bound for the intermediate latent node, ϵ 21 .
Since comparing ϵ 1 and ϵ 21 directly may not be meaningful due to different nominal values of the latent code, we consider the fraction ϵ/z nom and plot the resulting values in Table 2.
We observe that ϵ 1 /z nom 1 >> ϵ 21 /z
nomindicating tolerance to much larger latent variations.
Since a wider latent variation corresponds to a wider set of generated images, AuditAI effectively verifies over a larger range of image variations, compared to perturbations at the level of pixels.
In addition, when we translate the latent perturbations of AuditAI to the pixel space of the generative model, we obtain on average 20% , and 17% larger variations measured as L 2 distances compared to the pixel-based approach for a verified error of 0.
and 0.50 respectively.
[Table] [Table]
[Equation]
[Table]
[Equation]
CheXpert (Irvin et al., 2019) contains 200,000 chest radiograph images with 14 labeled observations corresponding to conditions like pneumonia, fracture, edema etc.
We consider a PGGAN (Karras et al., 2017) as the base generative model such that the latent space is class-conditional.
We consider three separate binary classification tasks with respect to the presence or absence of three conditions: pneumonia, fracture, and edema.
We consider the entire dataset for training the generative model, but for the classifiers we only use positive (presence of the condition) and negative (absence of the condition) data with an 80-20 train/test split.
Table 3 shows results for different ϵ on the test set for each classifier.
As a sanity check
[Table]
in order to determine whether the generative model behaves correctly with respect to class conditional generation
[Table]
we consider an off-the-shelf classifier for pneumonia detection trained on real images of pneumonia patients (Rajpurkar et al., 2017).
We randomly sample 1000 images from the generative model for each value of ϵ = 0 . 5 , 1 . 0 , 1 . 5 , 2 . 0 and evaluate the accuracy of the offthe-shelf classifier on these generated images.
We obtain respective accuracies 85% , 84% , 81% , 75% indicating highly reliable generated images.
[Table]
-shift.
In order to better understand the process of deploying the trained model on a dataset different from the one used in training, we consider the dataset NIH Chest Xrays (Wang et al., 2017).
This dataset contains (image, label) pairs for different anomalies including pneumonia and edema.
We perform certified training on CheXpert for different values of ϵ (results of this are in Table 3) and deploy the trained model to the end-user.
The end-user samples 5000 images from the NIH Chest X-rays dataset, encodes them to the latent space with trained encoder e ( · ) and uses the trained downstream task classifier f d ( · ) to predict the anomaly in the image.
In Table 4, we list the precision, recall, and overall accuracy among the 5000 images for two conditions, presence of pneumonia and edema.
We observe that the results for AuditAI are on average 5% higher than the pixel-based approach.
This intuitively makes sense because from Table 2 and section 4.1, we see that AuditAI covers about 20% larger variations in the pixel space and so the odds of the images at deployment lying in the verified range are higher for AuditAI .
4. FFHQ
Flicker Faces HQ (Karras et al., 2019) contains 70,000 unlabeled images of normal people (and not just celebrities as opposed to the CelebA (Liu et al., 2015) dataset).
We train a StyleGAN model (Karras et al., 2019) on this dataset and use existing techniques (Bau et al., 2020a; Shen &
Zhou, 2020; Shen et al., 2020) to identify directions of semantic change in the latent space.
We identify latent codes (set of dimensions of Z ) corresponding to expression (smile) , pose , and presence of eyeglasses .
We define the task for the classifier to be detection of whether eyeglasses are present and define unit tests to be variations in the latent code with respect to expression and pose (while keeping the code for eyeglasses invariant).
Table 5 shows the results of these unit tests corresponding to different latent perturbations ϵ .
We see that the verified error is up to 20% for over 50% larger variations compared to nominal values.
Based on this spec-sheet table, during deployment, the end-user can check whether the encoding of input image lies in the desired accuracy ranges for pose and expression, and then decide whether to use the model.
4. LSUN T OWER
The LSUN Tower dataset (Yu et al., 2015) contains 50,000 images of towers in multiple locations.
Similar to the FFHQ setup above, we train a StyleGAN model on this dataset and use existing techniques (Shen & Zhou, 2020; Zhu et al., 2020) to identify directions of semantic change in the latent space.
We identify latent codes corresponding to clouds , vegetation , and sunlight/brightness .
We define the task for the classifier to be detection of whether vegetation is present and define unit tests to be variations in the latent code with respect to how cloudy the sky is, and how bright the scene is (while keeping the code for vegetation invariant).
Tableshows the results of these unit tests corresponding to different latent perturbations ϵ .
We see that
the
[Table] [Table]
verified error is up to 18% for over 50% larger variations compared to nominal values.
Based on this spec-sheet table, during deployment, the end-user can check whether the encoding of input image lies in the desired accuracy ranges for clouds in the sky and brightness of the scene, and then decide whether to use the model.
4. A TTACKING IMAGES AUDITED BY A UDIT AI IN THE PIXEL - SPACE
In this section, we analyze what fraction of images audited by AuditAI can be attacked in the pixel-space through adversarial corruptions.
We create test examples with varying brightness of the scene, corresponding to the setting in Table 5.
These are real variations directly by modifying pixels to changing the brightness of the scene .
We evaluate AuditAI trained the same way as in Table 5, but evaluated on this test set after certified training.
For ϵ = 0 .
5 , 96 out of 1000 images (only 9.6%) certified by AuditAI can be attacked in the pixel-space, while for ϵ = 1 . 5 , 85 out of 1000 images (only 8.5%) certified by AuditAI can be attacked.
We use CROWN-IBP (Zhang et al., 2019b) to determine if an image is attackable in the pixel-space.
These results show that the certification provided by AuditAI is robust, and although verification is done in the latent space of a generative model, the results hold under real pixel-perturbations as well.
H UMAN S TUDY : H OW REALISTIC ARE THE GENERATED IMAGES ?
We employ Amazon Mechanical Turk (Buhrmester et al., 2016) to better understand the generative model trained for the Chest X-ray dataset and determine the limits of latent space variations for which generations are realistic .
This study is to determine the maximum value of ϵ for which generations are realistic to the human eye, such that we verify and report in the spec-sheet values of ϵ only up to the range of realistic generations.
We note that this study is to understand the generative model and not the trained classifier.
We employ a similar experimental protocol as (Isola et al., 2017; Zhang et al., 2016) and mention details in the Appendix A.4.
We generated 2000 images by sampling latent codes within each ϵ range of variation.
Alongside each ϵ we represent the % with respect to the nominal value it corresponds to (the nominal value of ϵ is 2.0, so ϵ
= 0 .
5 is 25% of 2.0) in Fig 4.
We see that the humans who participated in our study had close to 50% correct guesses for ϵ up to 1 . 0 , indicating generations indistinguishable from real images.
For ϵ ≥ 4 .
the correct guess rate is above 70% indicating that the generations in these ranges of latent variations are not realistic, and so the verified accuracy for these ranges should not be included in the spec-sheet.
Multiple prior works have studied a subset of the audit problem in terms of adversarial robustness (Raghunathan et al., 2018a; Dvijotham et al.).
Adversarial examples are small perturbations to the input (for images at the level of pixels; for text at the level of words) which mislead the deep learning model.
Generating adversarial examples has been widely studied (Xu et al., 2018; Zhang et al., 2019a) and recent approaches have devised defenses against adversarial examples (Xie et al., 2020; Zhang et al., 2019b).
Some of these approaches like (Gowal et al., 2018) and (Zhang et al., 2019b) provide provable verification bounds on an output specification based on the magnitude of perturbations in the input.
These approaches have largely showed robustness and verification to norm bounded adversarial perturbations without trying to verify with respect to more semantically aligned properties of the input.
Some papers (Mohapatra et al., 2020; Ruoss et al., 2020; Balunovi ´ c et al., 2019; Wong & Kolter, 2020) consider semantic perturbations like rotation, translation, occlusion, brightness change etc.
directly in the pixel space, so the range of semantic variations that can be considered are more limited.
This is a distinction with AuditAI, where by perturbing latent codes directly (as opposed to pixels), the range of semantic variations captured are much larger.
A related notion to auditing is expalainable AI (Gunning, 2017).
We note that auditing is different from this problem because explanations can be incorrect while remaining useful.
Whereas in auditing, our aim is not to come up with plausible explanations for why the model behaves in a certain way, but to quantify how it behaves under semantically-aligned variations of the input.
Some papers (Mandelbaum & Weinshall, 2017; Van Amersfoort et al., 2020) have used model confidence and ucnertainty estimates for rejecting out-of-distribution samples at test time, which is a form of auditing.
In (Mitchell et al., 2019) and (Gebru et al., 2018), the authors proposed a checklist of questions that should be answered while releasing DL models and datasets that relate to their motivation, intended use cases, training details, and ethical considerations.
These papers formed a part of our motivation and provided guidance in formalizing the audit problem for DL models.
We provide a detailed survey of related works in section A.6.
D ISCUSSION AND C ONCLUSION
In this paper we developed a framework for auditing of deep learning (DL) models.
There are increasingly growing concerns about innate biases in the DL models that are deployed in a wide range of settings and there have been multiple news articles about the necessity for auditing DL models prior to deployment 12 .
Our framework formalizes this audit problem which we believe is a step towards increasing safety and ethical use of DL models during deployment.
One of the limitations of AuditAI is that its interpretability is limited by that of the built-in generative model.
While exciting progress has been made for generative models, we believe it is important to incorporate domain expertise to mitigate potential dataset biases and human error in both training & deployment.
Currently, AuditAI doesn’t directly integrate human domain experts in the auditing pipeline, but indirectly uses domain expertise in the curation of the dataset used for creating the generative model.
Although we have demonstrated AuditAI primarily for auditing computer vision classification models, we hope that this would pave the way for more sophisticated domain-dependent AI-auditing tools & frameworks in language modelling and decision-making applications.
/auditors-testing-ai-hiring-algorithms-bias-bigquestions-remain/, Feb 11, 2021https://www.wired.com/story/ai-needs-to-be-audited/, Jul 10,
A A PPENDIX A. P RELIMINARIES : I NTERVAL -B OUND P ROPAGATION
In this section, we provide a preliminary treatment of Interval-Bound Propagation based robust training and verification.
Let f be a feedforward classifier model that outputs one of N classes.
The input to the network is an image x 0 , and it has a certain ground truth class y true .
The classifier is trained to minimize a certain misclassification loss.
The verification problem is to check whether there is some set S in ( x 0 ) around perturbations of x 0 such that the classification output of the model remains invariant from that of y true .
Let f have K layers
z k +1 =
h k
( W k z k + b k ) , k = 0 , ..., K − 1 , such that z 0 ∈ S
in ( x 0 ) , z K denotes the output logits, and h k is the activation function for the k th layer.
If we consider the set of variations to be S in ( x 0 ) = { x ||| x − x 0 || ∞ ≤ ϵ } , then we want to verify the specification that arg max i z K,i =
y true ∀ z 0 ∈ S in ( x 0 ) .
We can write this as a general linear specification c T z K + d ≤ 0 ∀ z 0 ∈ S in ( x 0 )
To verify the specification, IBP based methods search for a counter-example that violates the specification constraint, by solving the following optimization problem and checking whether the optimal value ≤ 0 .
[Equation]
Since solving this optimization problem exactly is NP-hard (Zhang et al., 2019b), IBP finds an upper bound on the optimal value and checks whether the upper bound ≤ 0 .
To get an upper bound on z K , we can propagate bounds for each activate z k through axis-aligned bounding boxes, z k,i ( ϵ ) ≤ z k,i ≤ z k,i ( ϵ ) , where i indexes dimension.
Based on this, the specification is upperbounded by z K,y ( ϵ ) − z K,y true ( ϵ ) .
In addition to the verification problem, IBP can be used to perform certified training such that the specification is likely to be satisfied in the first place at the end of training.
For this, the overall training loss would consist of two terms: usual classification loss like cross-entropy that maximizes log likelihood l ( z K , t true ) , and a loss term that encourages satisfiying the specification l (ˆ z K ( ϵ ) , t true ) .
Here, ˆ z K,y ( ϵ ) =
z K,y ( ϵ ) (if y ̸ = y true ) and ˆ z K,y ( ϵ ) =
z K,y true ( ϵ ) (if y = y true ) .
So, the overall loss for certified training can be represented as:
[Equation]
As reported in (Gowal et al., 2018; Zhang et al., 2019b; Xu et al., 2020), to stabilize training, χ is varied during training such that for a few initial epochs χ = 1 (normal training) and its value is slowly increased so that robust training kicks in gradually.
A. P ROOF OF THE T HEOREM
Theorem 1 ( Verification.
The verifier can verify whether the trained model from the designer satisfies the specifications, by generating a proof of the same) .
Let x ∈ X be the input, z
=
e ( x ) be the latent code, f d be a feed-forward neural network with bounded derivatives, and S i,in = { z :
||
z i − z 0 ,i || p ≤ ϵ } be the set of latent perturbations.
Then, the verifier is guaranteed to be able to generate a proof for verifying whether the linear specification on output logits c T z K + d ≤ 0 ∀ z ∈ S i,in , z K =
f d ( z ) (corresponding to unit test i ) is satisfied.
Proof.
Revisiting the notation in section 2, consider a network mapping f : X → Z → Y (denote by f d : Z → Y the downstream task) and a generative model mapping g : X → Z → ˆ X , such that f and g share a common latent space Z by virtue of having a common encoder e ( · ) (Figure 2).
Here we provide a proof based on fully-connected feed-forward network architecture for f d , an arbitrary architecture for f and using the Interval-Bound Propagation (IBP) method for obtaining output bounds.
For a general network architecture for f d , we refer the reader to a recent library
AutoLirpa (Xu et al., 2020).
Given input x ∈ X , let z
=
e ( x ) be the latent code, and S i,in = { z :
||
z i − z 0 ,i || p ≤ ϵ } be the set of latent perturbations.
Let, z be d − dimensional.
Here, z i denotes the dimensions(s) of z that are perturbed, such that z
=
z d − i ⊕ z
i .
Without loss of generality, we can assume all the dimensions in z i to be contiguous.
The verifier can generate a proof by searching for a worst-case violation
[Equation]
For the sake of simplicity, first consider the case where j = d i.e. all dimensions of z are perturbed.
So, S in = { z 0 :
|| z 0 − z
|| p ≤ ϵ .
Here, we have denoted by z 0 the latent code in Z space, and will use z k +
=
h k
( W k z k + b k ) k
= 0 , ..., K − 1 to denote the subsequent intermediate variables in f 1 : Z → Y .
Based on Holder’s inequality we can obtain linear bounds for the first variable z 1 , [ z 1 , z 1 ] as follows:
[Equation]
Here, ||·|| q denotes computation of the l q − norm for each row in the matrix and the values of W 0 , Wcan be computed with the functions described in Appendix A.1 of (Xu et al., 2020) depending on the type of non-linearity in h 0 ( · ) .
Now, when j ̸ = d i.e. only j dimensions of d are perturbed, without loss of generality, we can consider all of the j dimensions to be contiguous such that z
=
z 0 d − j ⊕ z 0 j .
We can then compute [ z 1 j , z 1 j ] as follows:
[Equation]
We can compute z 1 d − j as follows:
[Equation]
Finally, we can obtain [ z 1 , z 1 ] as follows:
[Equation]
Now, given the bound [ z 1 , z 1 ] and the relation z k +1 =
h k
( W k z k + b k ) k
= 0 , ..., K − 1 , we can obtain the bound for z K , [ z K , z K ] by recursively computing successive bounds as follows:
[Equation]
Here we have assumed that h k is an element-wise monotonic function, which is is true for for most common actions like ReLU, tanh, sigmoid etc.
Using [ z K , z K ] , the verifier can construct an upper and lower bound on the solution of max z ∈S i,in c T z K + d
[Equation]
It is important to note that the proof the verifier generates to check whether the specification holds relies on computing an upper bound z K and checking whether the upper bound z K < 0 .
If the upper bound is not tight, then there may be cases when the true solution < 0 (meaning the specification in
Theorem 1 is indeed satisfied) while the upper bound z K > 0 (implying the verifier will state that the specification is not satisfied).
This form of err on the side of caution is a natural consequence of proof by generating a worst case example, and follows directly from IBP.
A. I MPLEMENTATION D ETAILS
We use a 32-GB V100 GPU for all our experiments.
The implementation is in Python with a combination of PyTorch and Tensorflow deep learning libraries.
Details about the specific experiments are mentioned below:
ImageNet.
We use a pretrained BigBiGAN https://colab.research.google
com/ github/tensorflow/hub/blob/master/examples/colab/bigbigan
with
tf
hub.ipynb as the base
generative model,
such that
the encoder encodes images
to the
latent space.
The downstream classifier from the latent space consists of 5 fully connected layers with ReLU non-linearities.
We use ADAM optimizer with a learning rate of 0.0005.
For each value of ϵ Lperturbation in Table 1, we train for 100 epochs, using the AutoLiRPA library’s implementation of
CrownIBP https://github.com/KaidiXu/auto_LiRPA .
The first 5 epochs are standard training for warming up, and the rest of the epochs are robust training.
The training time forepochs is about 8 hours.
CheXpert.
We train a PGGAN https://github.com/tkarras/progressive_
growing_of_gans on the CheXpert dataset.
In order to learn latent embeddings from raw images, we need an inference mechanism.
For this, we perform GAN inversion of this pretrained generator, using https://github.com/davidbau/ganseeing/blob/release/run_ invert.sh to obtain an encoder for projecting images to the latent space.
The downstream classifier from the latent space consists of 5 fully connected layers with ReLU non-linearities.
We use ADAM optimizer with a learning rate of 0.0005.
For each value of ϵ L 2 perturbation in
Table 1, we train for 100 epochs, using the AutoLiRPA library’s implementation of CrownIBP https://github.com/KaidiXu/auto_LiRPA .
The first 5 epochs are standard training for warming up, and the rest of the epochs are robust training.
The training time for 100 epochs is about 7 hours.
LSUN and FFHQ.
We train StyleGAN models https://github.com/NVlabs/ stylegan2-ada-pytorch on the FFHQ and LSUN datasets, and perform GAN inversion using https://github.com/genforce/idinvert_pytorch to obtain respective encoders for a disentangled latent space.
The downstream classifier from the latent space consists of 5 fully connected layers with ReLU non-linearities.
We use ADAM optimizer with a learning rate of 0.0005.
For each value of ϵ L 2 perturbation in Table 1, we train for 100 epochs, using the AutoLiRPA library’s implementation of CrownIBP https://github.com/KaidiXu/auto_LiRPA .
The first 5 epochs are standard training for warming up, and the rest of the epochs are robust training.
The training time for 100 epochs is about 7 hours each.
[Table]
A. D ETAILS ABOUT THE A MAZON MT URK STUDY
Here we provide more details about the setup for the Amazon MTurk study whose results we presented in Fig.
We designed each Human Intelligence Task (HIT) to be comprised of 10 pairs of images sequentially presented, such that each pair consists of a real and a generated image.
For different values of ϵ we show examples of images from each of the categories presented in the HITs through
Fig.
We recruited participants only from the “Master Worker” category.
As defined in https://www.
mturk.com/worker/help , “a Master Worker is a top Worker of the MTurk marketplace that has been granted the Mechanical Turk Masters Qualification.”
These Workers have consistently demonstrated a high degree of success in performing a wide range of HITs across a large number of
Requesters.
The participants were paid 0 .
5 dollars for each HIT (i.e. for 10 pairs of images).
Each pair was shown to the participants for 2 seconds, after which the images disappeared from the screen, but they could take as much time as they wanted to decide and form a response.
We restricted the number of HITs per participant to 20.
The participants were shown the exact text below: Choose the more realistic image between options
A and B. For each pair, you have 5 seconds to view the image and unlimited time to make the decision.
Each task consists of 10 image pairs.
A. R ESULTS OF VERIFICATION WITH PRE - TRAINED CLASSIFIER
In this experiment, we pre-train the classifier through certified training with ϵ = 1 . 0 and perform verification for different values of ϵ .
A. E XTENDED R ELATED W ORKS
Adversarial robustness.
Multiple prior works have studied a subset of the audit problem in terms of adversarial robustness (Carlini et al., 2019;
Jia et al., 2019; Gowal et al., 2018; Zhang et al., 2018;
Singh et al., 2019; Weng et al., 2018; Singh et al., 2018; Wang et al., 2018; Raghunathan et al., 2018a;b; Dvijotham et al.).
Adversarial examples are small perturbations to the input (for images at the level of pixels; for text at the level of words) which mislead the deep learning model.
Generating adversarial examples has been widely studied (Zhao et al., 2017; Athalye et al., 2018; Carlini &
Wagner, 2017a;b; Goodfellow et al., 2015; Madry et al., 2018; Papernot et al., 2016; Xiao et al., 2019b; 2018b;c; Eykholt et al., 2018; Chen et al., 2018; Xu et al., 2018; Zhang et al., 2019a) and recent approaches have devised defenses against adversarial examples (Guo et al., 2018;
Song et al., 2017; Buckman et al., 2018; Ma et al., 2018;
Samangouei et al., 2018; Xiao et al., 2018a; 2019a; Xie et al., 2020; Cohen et al., 2019; Gowal et al., 2018; Zhang et al., 2019b).
Some of these approaches like (Gowal et al., 2018) and (Zhang et al., 2019b) provide provable verification bounds on an output specification based on the magnitude of perturbations in the input.
These approaches have largely showed robustness and verification to norm bounded adversarial perturbations without trying to verify with respect to more semantically aligned properties of the input.
Some papers (Mohapatra et al., 2020; Ruoss et al., 2020; Balunovi´c et al., 2019) consider semantic perturbations like rotation, translation, occlusion, brightness change etc.
directly in the pixel space, so the range of semantic variations that can be considered are more limited.
This is a distinction with AuditAI , where by perturbing latent codes directly (as opposed to pixels), the range of semantic variations captured are much larger.
In (Wong & Kolter, 2020), the authors model perturbation sets for images with perturbations (like adversarial corruptions) explicitly such that a conditional VAE can be trained.
While, for AuditAI , we identify directions of latent variations that are present in pre-trained GANs, and as such do not require explicit supervision for training the generative model, and can scale to datasets like ImageNet and CheXpert, and high dimensional images like that in FFHQ.
Neural network interpretability.
With the rapid rise of highly reliable generative models, many recent works have sought to analyze the latent space of such models and how the latent space can be manipulated to obtain semantic variations in the output image.
(Bau et al., 2021) use text embeddings from CLIP (Radford et al., 2021) to perform directed semantic changes in the generated images, for example introduction of a particular artifact in the room or change in the color of a bird.
(Bau et al., 2020a; Shen & Zhou, 2020;
Shen et al., 2020) identify latent code dimensions corresponding to pose of the body/face, expression of the face, orientation of beds/cars in the latent space of generative models like PGGAN (Karras et al., 2017) and StyleGAN (Karras et al., 2019).
By manipulating these latent dimensions, the output images can be controllably varied.
In addition, there have been other papers that sought to understand what the neural network weights are learning in the first place (Bau et al., 2020b; Yeh et al., 2020) in an attempt to explain the predictions of the networks.
Auditing.
While we proposed a framework for auditing of DL models, a complimentary problem is to audit datasets that are used for training DL models.
In (Gebru et al., 2018), the authors proposed a checklist of questions to be answered while releasing datasets that relate to the motivation, composition, collection process, processing, and distribution of the dataset.
In (Mitchell et al., 2019), the authors proposed a checklist of questions that should be answered while releasing DL models that relate to their motivation, intended use cases, training details, and ethical considerations.
These papers formed a part of our motivation and provided guidance in formalizing the audit problem for
DL models.