<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Beyond Test Accuracy: The Effects of Model Compression on CNNs</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Adrian Schwaiger</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Kristian Schwienbacher</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Karsten Roscher</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Fraunhofer IKS</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>ifrstname.lastname }@iks.fraunhofer.de</string-name>
        </contrib>
      </contrib-group>
      <pub-date>
        <year>2020</year>
      </pub-date>
      <volume>2019</volume>
      <fpage>639</fpage>
      <lpage>654</lpage>
      <abstract>
        <p>Model compression is widely employed to deploy convolutional neural networks on devices with limited computational resources or power limitations. For high stakes applications, such as autonomous driving, it is, however, important that compression techniques do not impair the safety of the system. In this paper, we therefore investigate the changes introduced by three compression methods - post-training quantization, global unstructured pruning, and the combination of both - that go beyond the test accuracy. To this end, we trained three image classifiers on two datasets and compared them regarding their performance on the class level and regarding their attention to different input regions. Although the deviations in test accuracy were minimal, our results show that the considered compression techniques introduce substantial changes to the models that reflect in the quality of predictions of individual classes and in the salience of input regions. While we did not observe the introduction of systematic errors or biases towards certain classes, these changes can significantly impact the failure modes of CNNs and thus are highly relevant for safety analyses. We therefore conclude that it is important to be aware of the changes caused by model compression and to already consider them in the early stages of the development process.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Deep Neural Networks (DNNs) enable many complex
applications such as autonomous vehicles or automated
manufacturing processes. Especially for perception tasks,
Convolutional Neural Networks (CNNs) have shown impressive
results and have been adopted widely. However, to achieve
a high degree of performance, these networks often have
millions of parameters that require significant computing
power for inference, impeding the deployment on edge or
low-power mobile devices
        <xref ref-type="bibr" rid="ref10">(Cheng et al. 2018)</xref>
        . One way
to approach this problem is to compress the models, e.g.,
via pruning – i.e. removing parts of the network with a
low contribution to the predictions – or quantization – i.e.
reducing the number of bits required for each parameter.
These methods allow to reduce the memory footprint,
increase computational efficiency, and in turn also decrease
the power demands, enabling the deployment of DNNs on
low-power devices. Compressing models using pruning or
quantization techniques can significantly reduce their size
without severely impacting the overall performance
regarding test accuracy. However, especially for safety-critical
applications test accuracy on its own is not sufficient and
underlying negative effects, e.g., on the long tail of data
distributions have been shown
        <xref ref-type="bibr" rid="ref20">(Hooker et al. 2021)</xref>
        . Furthermore,
since model compression is often not explicitly addressed in
development and assurance frameworks, such as Assurance
of Machine Learning for use in Autonomous Systems
(AMLAS)
        <xref ref-type="bibr" rid="ref16">(Hawkins et al. 2021)</xref>
        , an introduction of additional
failure modes by compression techniques might lead to
additional efforts required in the development if the effects are
considered too late during the process or in the worst case
might lead to failures during operations if not considered
at all. To this end, in this paper we investigate the effects of
model compression when using global unstructured pruning,
post-training quantization, and their combination. We
therefore aim to provide insights towards the question what and to
which extent changes occur on a deeper level and how that
could potentially impact efforts towards arguing the safety
of the system by making the following contributions:
• We investigate the effects of model compression on the
class and sample level regarding their predictive quality
over three different models and two datasets
• Additionally, for model pruning we investigate the
effects on the attention of the models regarding compared
to the initial models by analyzing their saliency maps
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Related Work</title>
      <p>In the following, we present the related work regarding
CNNs compression and its relevance towards arguing the
safety for ML-based systems.
2.1</p>
      <sec id="sec-2-1">
        <title>Pruning</title>
        <p>
          Model pruning is a common technique for various ML
algorithms, such as decision trees (Mingers 1989) and
inductive logic programming
          <xref ref-type="bibr" rid="ref23">(Kazmi, Sch u¨ller, and Saygin 2017)</xref>
          ,
not only for compression but also to improve
generalization capabilities. For neural networks, pruning is not a novel
idea
          <xref ref-type="bibr" rid="ref27">(LeCun, Denker, and Solla 1989)</xref>
          , but has gained
interest in recent years due to the increased popularity of neural
networks and the need to deploy them on
computationallyrestricted devices
          <xref ref-type="bibr" rid="ref10">(Cheng et al. 2018)</xref>
          . Pruning generally can
be performed either in a structured
          <xref ref-type="bibr" rid="ref18">(He et al. 2018)</xref>
          or
unstructured
          <xref ref-type="bibr" rid="ref15">(Han, Mao, and Dally 2016)</xref>
          manner. The first one
removes – based on a norm for scoring the importance of
the individual elements – connected groups of parameters,
e.g., on a per-channel or per-filter basis. The structured
approach therefore not only provides improvements regarding
memory usage, but also provides reduced inference times
on regular hardware. Compared to structured pruning,
unstructured pruning removes individual parameters, allowing
to decrease model sizes significantly more while retaining
test accuracy. Since only individual parameters are removed,
the overall network structure does not change and sparsity is
introduced. Therefore, specialized hardware is required to
benefit from inference speedups besides the improvements
in memory requirements (Luo and Wu 2020). ML
frameworks, such as PyTorch or TensorFlow, come with
implementations for the most common pruning techniques.
Beyond that, research continues in that domain, for instance,
AutoPruner (Luo and Wu 2020) improves significantly upon
the state-of-the-art by combining pruning and fine-tuning
steps, EagleEye (Li et al. 2020) proposes an efficient
evaluation strategy to identify the best performing subnetworks
as pruning candidates, and with ShrinkBench (Blalock et al.
2020) a benchmarking framework has been proposed to
facilitate the comparison of pruning techniques.
2.2
        </p>
      </sec>
      <sec id="sec-2-2">
        <title>Quantization</title>
        <p>
          Another widespread model compression technique is
quantization that aims to reduce the number of bits required to
represent the parameters of a DNN. DNNs are usually trained
on hardware accelerators, such as GPUs or TPUs, that use
lfoating points, usually 32bit or 16bit, to represent the
parameters. A common technique is to quantize the parameters
to 8-bit integers, effectively reducing the size by a factor of
4 or 2 respectively and allowing the exploitation of 8-bit
optimized computations of mobile CPUs, while having
minimal impact on the model performance (Wu et al. 2016). In
practice, post-training quantization and quantization-aware
training are common. With post-training quantization, the
parameters of a model are quantized after the training phase
without requiring any fine-tuning. In contrast,
quantizationaware training models the parameter quantization during
training and is able to achieve even lower bit-widths. As
with pruning, both variants have implementations in
common ML frameworks. Research in that domain focuses on
achieving lower bit-widths, while only minimally impacting
the performance of models
          <xref ref-type="bibr" rid="ref2 ref21">(Banner, Nahshan, and Soudry
2019; Hubara et al. 2018)</xref>
          or on further simplifying the
quantization process, e.g., by eliminating the need for calibration
data
          <xref ref-type="bibr" rid="ref9">(Cai et al. 2020)</xref>
          .
2.3
        </p>
      </sec>
      <sec id="sec-2-3">
        <title>Further Model Compression Techniques</title>
        <p>
          Besides pruning and quantization, other model compression
techniques have been proposed. For instance, N2N
learning (Ashok et al. 2018) removes parts of a network and
afterwards shrinks them using a reinforcement learning
approach. With Knowledge distillation, one or more networks
are trained to serve as teacher models which a smaller
student model is trained to mimic
          <xref ref-type="bibr" rid="ref19">(Hinton, Vinyals, and Dean
2015)</xref>
          . Approaches based on low-rank factorization such as
(Swaminathan et al. 2020) use matrix decomposition to
reconstruct linear transformations of a network into
counterparts with less redundancy and therefore fewer parameters.
Lastly, although not necessarily a compression technique,
neural architecture search can be utilized to find efficient
architectures as is done, e.g., in MnasNet (Tan et al. 2019)
that optimizes towards the real-world inference latency of
DNNs.
2.4
        </p>
      </sec>
      <sec id="sec-2-4">
        <title>Effects of Model Compression on Robustness</title>
        <p>
          Compressed models have been extensively studied
regarding their robustness against adversarial attacks. For
instance,
          <xref ref-type="bibr" rid="ref3">(Bernhard, Moellic, and Dutertre 2019)</xref>
          concluded
that post-training quantization and quantization-aware
training slightly improve the robustness of a network against
attacks. Similarly,
          <xref ref-type="bibr" rid="ref11">(Duncan et al. 2020)</xref>
          found that
quantization can reduce the transferability of adversarial examples
by up to 50%. The adversarially trained model compression
framework
          <xref ref-type="bibr" rid="ref14">(Gui et al. 2019)</xref>
          incorporates objectives
regarding adversarial robustness in the compression process to
further improve upon it. Apart from adversarial examples, some
research has been conducted regarding other aspects of
robustness. For instance,
          <xref ref-type="bibr" rid="ref12">(Ferianc et al. 2021)</xref>
          demonstrated
that a uniform quantization scheme does not considerably
impact the quality of uncertainty quantification in Bayesian
neural networks.
          <xref ref-type="bibr" rid="ref20">(Hooker et al. 2021)</xref>
          studied the effects of
model compression beyond test accuracy and found that a
small subset of the data is systematically more impacted
and that the sensitivity towards distributional shifts
correlates significantly with model sparsity.
2.5
        </p>
      </sec>
      <sec id="sec-2-5">
        <title>Safety Assurance for ML-based Systems</title>
        <p>
          Arguing the safety of ML-based systems is an emerging field
and highly relevant to enable the use of ML in safety-critical
applications. A promising direction are holistic assurance
strategies
          <xref ref-type="bibr" rid="ref5">(Burton, Gauerhof, and Heinzemann 2017)</xref>
          that
incorporate an analysis of the operational domain and the
system, as well as a sound validation and verification strategy to
design confidence arguments that provide evidence towards
the safety of the system
          <xref ref-type="bibr" rid="ref6">(Burton et al. 2019)</xref>
          . The approach
itself is domain agnostic and so far has been applied to, e.g.,
the automotive
          <xref ref-type="bibr" rid="ref20 ref7">(Burton et al. 2021a)</xref>
          and medical (Picardi
et al. 2019) domain. While it provides a general framework
towards arguing the safety of ML-based systems and
frameworks such as AMLAS
          <xref ref-type="bibr" rid="ref16">(Hawkins et al. 2021)</xref>
          provide
additional guidance, further research regarding the design of safe
ML algorithms and effective testing methods is required to
provide sufficient evidence for the assurance case.
3
        </p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Evaluation</title>
      <p>In this section, we discuss our results and observed findings
regarding the changes beyond test accuracy introduced when
compressing image classifiers with pruning or quantization
techniques.
3.1</p>
      <sec id="sec-3-1">
        <title>Design of Experiments</title>
        <p>
          To analyze the influence model architecture, we considered
three different networks. A ResNet-18 (~11m parameters)
          <xref ref-type="bibr" rid="ref17">(He et al. 2016)</xref>
          for its widespread usage, a SqueezeNet
(~750k parameters)
          <xref ref-type="bibr" rid="ref22">(Iandola et al. 2016)</xref>
          for its
computational efficiency, and a LeNet-5 ( ~62k parameters)
          <xref ref-type="bibr" rid="ref25">(Lecun
et al. 1998)</xref>
          for its small size. We trained the models on
CIFAR-10
          <xref ref-type="bibr" rid="ref24">(Krizhevsky 2009)</xref>
          and the German Traffic Sign
Recognition Benchmark (GTSRB) (Stallkamp et al. 2011).
CIFAR-10 consists of 60,000 32x32px images, equally
divided into 10 classes, e.g., cat, dog, automobile, or ship.
GTSRB contains 51,839 images of 43 different German traffic
signs that we rescaled to 32x32px. The distribution of the
traffic signs thereby is imbalanced, with the most frequent
sign, Speed limit (50 km/h) occurring more than 10 times
as often as the least frequent one, Dangerous curve to the
left. The class imbalance within GTSRB allows us to study
if any negative biases towards the underrepresented classes
are introduced by the model compression techniques.
        </p>
        <p>We trained each model by minimizing the negative
loglikelihood using Adam as an optimizer. To prevent
overfitting, we stopped the training after the loss did not decrease
for 40 epochs. To improve the base accuracy on
CIFAR10, we transformed each image at each epoch by randomly
lfipping it horizontally and by randomly cropping it back to
32x32px after adding a 4px padding each side.</p>
        <p>
          To compress the models, we used the implementations for
pruning and quantization provided by the ML framework
PyTorch. We choose global unstructured pruning, using the
L1 norm to score the parameters of the model, whereby
the ones scored lowest are removed. We applied no
subsequent fine-tuning as it yielded the best results in our
experiments. Compared to structured pruning it is not as
applicable to practical applications, as without sparse tensor
computations it only affects the memory requirements of the
model. However, unstructured pruning is widely considered
in academia
          <xref ref-type="bibr" rid="ref27">(LeCun, Denker, and Solla 1989; Renda,
Frankle, and Carbin 2019)</xref>
          and with improvements in sparse
tensor support on embedded hardware might become the
predominant method for practical applications in the future.
After the training phase, we pruned each model with the target
to maximize the amount of dropped connections while
maintaining a comparable level of accuracy to the original model.
        </p>
        <p>For quantization, we chose a non-intrusive post-training
approach with per-channel bit allocation, as it gave the best
results in our experiments. We chose to quantize the weights
of all models once to 8bit and once to 4bit. The first case
enables the utilization of integer-based hardware accelerators,
while the second one would require specialized hardware to
gain additional benefits, apart from increased memory
efficiency, compared to the 8-bit variant. The activation
precision was kept at 8bit for both cases, as values below that
severely impacted the accuracy of the models. Finally, we
also combined both compression approaches by quantizing
the pruned models with 8-bit precision for weights and
activations. Table 1 lists all models and their compressed
variants, stating their test accuracy and memory footprint. We
do not provide a measure of the inference time as it greatly
depends on the execution platform, e.g., if it can exploit the
-10.0
10.0
sparseness of the pruned models or if it is optimized towards
lfoating point or integer computations.</p>
        <p>For the evaluation, we additionally generated saliency
maps by computing the gradients for each input pixel
regarding the target class and normalizing them to the range [0; 1]
following (Simonyan, Vedaldi, and Zisserman 2014). Since
PyTorch does not support gradient calculation for quantized
tensors, we only generated saliency maps for the original
and pruned variants of the models.
3.2</p>
      </sec>
      <sec id="sec-3-2">
        <title>Results and Discussion</title>
        <p>Table 1 shows the test accuracies of all configurations. Most
configurations show only a slight drop in accuracy of less
than 1 percentage point (pp), with the exception of some
networks quantized with 4-bit weight precision. These are not
considered further in the following sections as their
substantial drop in accuracy already implies significant changes.
3.3</p>
      </sec>
      <sec id="sec-3-3">
        <title>Changes at the Class Level</title>
        <p>Pruning The accuracy on the entire test dataset did not
reduce significantly after applying pruning for most
conifgurations as Table 1 shows. However, we observe
significant changes at the class level for many configurations,
especially for GTSRB. For instance, Figure 1 shows the
difference between the confusion matrices for the original
and pruned ResNet-18 on GTSRB. While the test accuracy</p>
        <sec id="sec-3-3-1">
          <title>LeNet</title>
        </sec>
        <sec id="sec-3-3-2">
          <title>SqueezeNet</title>
        </sec>
        <sec id="sec-3-3-3">
          <title>ResNet-18</title>
          <p>GTSRB
CIFAR-10</p>
        </sec>
        <sec id="sec-3-3-4">
          <title>GTSRB CIFAR-10</title>
        </sec>
        <sec id="sec-3-3-5">
          <title>GTSRB</title>
          <p>CIFAR-10
stayed the same, the accuracies and confusions of a few
individual classes change significantly. As an example, class
0 (Speed limit 20km/h) is confused ~8pp more often with
class 1 (Speed limit 30km/h) but on the other hand, class 40
(Roundabout mandatory) is mistaken ~11pp less often as
class 37 (Go straight or left). Furthermore, class 40 is
predicted more accurately by ~11pp whereas the accuracy of
class 0 drops by ~10pp. Many more classes have changes in
the accuracy or confusion in the range of up to 4pp that –
depending on the concrete application – might also be
relevant. Upon closer inspection, we find that for class 40 the
correct predictions of the uncompressed model are a proper
subset for the ones of the pruned network. For the
remaining samples that were only predicted correctly by the pruned
model, we find that the confidence is between 18pp and 24pp
higher for the pruned model. This means, that for these
particular samples there is a significant difference in how much
support each of the networks generates for them and the
increase in the correct predictions for this class by the pruned
model is not just based on slight differences. Figure 2
summarizes the difference in confidence for the predicted class
between the uncompressed and pruned ResNet-18. While
the vast majority of predictions show a similar (≤ 2.5pp)
confidence, for some samples the confidence changes
significantly, up to 27.5pp. Although this only affects a small
subset of all samples and the overall number of samples that
are predicted differently is small with 0.6%, it is something
to be aware of since it might have been caused by the
introduction of additional failure modes. Depending at which
stage of the system development model compression is
considered this might have several implications. In the worst
case, if model compression is performed immediately prior
to the deployment without an extensive verification phase
afterwards, these failure modes are not addressed, potentially
leading to system failures during operations. But even in
cases, where it is considered before the model verification
it can significantly impact the development. As additional
failure modes must be met with proper mitigation measures
– e.g., in the form of safety monitors or considerations
regarding the operational domain –, the development process
can be prolonged if model compression is not considered as
integral part of the system development.</p>
          <p>For GTSRB, the overall effects regarding pruning are
similar but more pronounced for LeNet and SqueezeNet
compared to the ResNet-18. Here, for some classes the change
in confusion or accuracy is a bit more noticeable with up
to 15pp and the proportion of samples that are predicted
differently is higher with 3.5% and 3% respectively. Also
the mean difference in the confidence for each sample is
significantly increased, even to the extent where a small
fraction of samples for one variant generates full support
for the target class and for the other one none, as Figure
3 highlights. The increase in the observed effects is likely
due to the smaller initial sizes of LeNet and SqueezeNet
compared to the ResNet-18. Although 72% of the
ResNet18’s connections were pruned, it still has more than 7 times
(SqueezeNet) and 89 times (LeNet) the number of
parameters, potentially still containing redundant features.</p>
          <p>One important finding on the imbalanced GTSRB is that
pruning did not introduce significant biases against the
infrequent classes for any of the networks. This also is evident
when considering the diagonal in Figure 1, where no
correlation between the change in accuracy and the frequency of
the class is present. It is to mention, that the significant drop
in accuracy for the most infrequent class 0 is only present
for ResNet-18, for the other networks it is not present.</p>
          <p>On CIFAR-10, the overall effects of pruning are similar to
GTSRB but significantly less pronounced as Figure 4 shows.
For SqueezeNet and LeNet the change in class-wise
accuracies does not exceed 2.5pp or 4pp respectively. However, for
these two networks it is to note that the overall number of
samples that are predicted differently by the uncompressed
and pruned variant is increased with 4.2% and 7.2%
respectively. Referring to Figure 4 this effect can be explained as
a result of previously wrong predictions that after
applying pruning to the network are still predicted incorrectly but
towards another class. Here, it is to highlight that for the
classes airplane and horse this effect is the most prominent,
with the first one being overall predicted less and the
latter one being predicted more often by the pruned network,
therefore introducing a slight bias respectively against or
towards these classes. Overall, the increase in the intra-class
confusion compared to GTSRB likely can be attributed to
the different complexity of the tasks. While GTSRB has only
very limited inter-class variance – a Speed limit (20km/h)
sign always has the same shape and surface, the differences
in the images stem from different lighting, viewing angles,
etc. – for CIFAR-10 samples from the same class can vary
greatly, increasing the likelihood of confusion.</p>
          <p>Lastly, considering ResNet-18 on CIFAR-10, virtually
no difference is observable between the uncompressed and
pruned network. Only two samples are predicted differently
and neither the uncompressed nor the pruned variant arrive
at the correct prediction. Additionally, the confidence
difference regarding the predicted class between both variants in
all cases is ≤ 2.5pp. The likely reason for this similarity is
that although 72.4% of the network have been pruned, the
pruned network still contains enough redundancy to mimic
the initial model and further pruning would be required to
elicit any effects. In turn this also highlights that if pruning
is performed conservatively and not to the absolute limit, i.e.
until even slight changes in the overall accuracy are
noticeable, a compressed variant might be achievable that virtually
mimics the initial network.</p>
          <p>
            Quantization Referring to Table 1, 8-bit quantization
shows very limited impact on the overall accuracy while
4bit quantization (with 8-bit activation precision) in half of
the experiments shows a significant drop in accuracy, a
common observation regarding the low precision in combination
with the static post-training quantization scheme
            <xref ref-type="bibr" rid="ref2">(Banner,
Nahshan, and Soudry 2019)</xref>
            . For GTSRB, we again observe
changes on the class level introduced by the quantization
– but to a slightly lesser extent compared to pruning,
although in most cases also reducing the test accuracy lesser
– as Figure 5 depicts. The same observation can be made
for SqueezeNet and LeNet, where the maximum extent of
the change in confusion or accuracy is up to 6pp or 12pp
respectively. Comparing the differences in the confusion
matrices for pruned and quantized networks, it is also evident
that classes are not necessarily affected in the same way by
both compression methods. This hints towards the finding
that not only samples that are challenging for the
uncompressed model are affected but that the compression
techniques can potentially affect any sample. Regarding
CIFAR10, we again report the overall similar but significantly
reduced effects compared to GTSRB, as we already observed
for pruning, with the exception that the ResNet-18 also is
slightly affected with changes in confusion and accuracy, up
to 0.6pp.
          </p>
          <p>Comparing 4-bit (with 8-bit activation precision)
quantization to 8-bit quantization for the configurations without a
significant drop in accuracy, we find that the observed effects
are the same but more pronounced for 4-bit quantization. As
already observed when comparing pruning and 8-bit
quantization, 4-bit quantization and 8-bit quantization show no
consistent patterns regarding the impacted samples, further
supporting the hypothesis that any sample or class can be
affected.</p>
          <p>Difference in accuracy to uncompressed model [pp]
-4.0 -3.0 -2.0 -1.0 0.0 1.0 2.0 3.0
-4.0 Difference in accuracy to uncompressed model [pp]
-2.0 0.0 2.0
4.0
6.0
Combined Pruning and Quantization Lastly, we
combine pruning and quantization, by applying 8-bit
quantization to the pruned models. As Table 1 shows, this has a
slightly higher impact on the overall drop in accuracy than if
the compression techniques would be applied individually,
which is to be expected. Overall, the same general effects
are observable as if pruning or quantization are applied
individually as Figure 6 shows. Regarding the effect on
individual classes, patterns present in both compression techniques
are combined, sometimes amplifying, other times canceling
out the effects. Potentially this could lead to drastic effects,
however, in our experiments we did not observe any. Also, it
is noticeable that generally the number of samples where the
uncompressed and the compressed model disagree is slightly
higher than for any of the single compression variants.
Generally speaking, the combination of both compression
techniques, however, shows no peculiarities and does not
introduce significant additional effects.
3.4</p>
        </sec>
      </sec>
      <sec id="sec-3-4">
        <title>Differences in the Relevance of Input Regions</title>
        <p>In addition to the quantitative analysis performed in the
previous section, we also qualitatively investigated the changes
introduced by model compressing. For this, we generated
saliency maps that highlight the salient input regions for a
model’s decision regarding the target class. Since statically
quantized models in PyTorch don’t support gradient
calculation, we only analyze the changes between uncompressed
and pruned model variants. In order to keep the number of
images to analyze manageable, for each configuration we
selected the 20 samples where the biggest difference in the
saliency maps was present. To compare two saliency maps,
we first performed a 3x3 average pooling with stride 3 over
the saliency maps – to reduce the sensitivity towards
pixellevel changes in the attention, putting a stronger emphasis on
higher-level features – and afterwards computed the Mean
Absolute Deviation (MAD) between the reduced saliency
maps of the uncompressed and pruned model.</p>
        <p>Figure 7 shows vfie selected saliency maps that
summarize the observed findings. Overall, we did not observe any
systematic changes between any model and its pruned
variant. For example, in some instances, the pruned model
focuses better on the foreground, giving the correct prediction,
while the original model focuses on the background,
classifying incorrectly, as Figure 7a representatively shows.
However, this is not a consistent behavior, and the opposite effect
can be observed as well, e.g., in Figure 7b, where the pruned
model puts too much attention on the sky, classifying the
image as an airplane. Furthermore, even for samples where
both networks predict the same class, we can observe
significant changes in the salience of different input regions,
i.e, the models weight features differently or even rely on
different ones. While in the previous sections we found
virtually no differences between the uncompressed and pruned
ResNet-18 on CIFAR-10, regarding their attention we could
ifnd noticeable differences as Figures 7d and 7e show. This
effect is also not limited to our selected samples, as Figure 8
shows. With an average MAD of 7.7% between the saliency
maps of the uncompressed and pruned ResNet-18, it
highlights that although the effects of model compression might
-4.0Difference in accuracy to uncompressed model [pp]
-2.0 0.0 2.0 4.0
6.0
horse
horse
not be noticeable at the level of dataset or even class-wise
accuracy, it is definitely important to consider them in safety
analyses, as it might, for example, introduce additional
failures in corner cases where a model bases its decision on the
wrong features.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4 Conclusions and Future Work</title>
      <p>In this paper, we investigated changes in the predictions
of networks compressed with either post-training
quantization, global unstructured pruning, or a combination of both.
While the deviations from the test accuracy of the
uncompressed model were minimal, we observed that the
compression techniques still caused significant changes in the
predictions. For one thing, we found that the accuracy of individual
classes can change greatly – in our experiments up to 15pp –
and that the confusion between classes can vary to the same
extent. For another thing, our investigation showed that also
the confidence regarding the target class can change
significantly, with extreme cases were the uncompressed model
has zero confidence in the target class while the compressed
variant has full confidence, and vice versa. Lastly, our
comparison of saliency maps for uncompressed and pruned
models revealed the presence of significant differences, hinting
towards the two variants relying on or weighting features
differently. It is to mention, however, that we did not
observe the introduction of systematic errors, e.g., in the form
of biases against infrequent classes. Nonetheless, based on
the effects we observed, we strongly suggest to view model
ship
frog
frog
(a) LeNet trained on CIFAR-10 (MAD=13%)
ship
frog
(c) LeNet trained on CIFAR-10 (MAD=12%)
frog
frog
(d) ResNet-18 trained on CIFAR-10 (MAD=16%)
automobile
automobile
compression as integral part of any ML development cycle
and to consider it in early development stages. Model
compression can cause substantial changes in the predictions of
a network and with that bears the potential to introduce
additional failure modes. These must be addressed in the
system development and the earlier they are known, the better
mitigation measures can be integrated in the system, overall
facilitating the development process.</p>
      <p>
        Regarding future work, we suggest to expand our
experiments also to other model architectures, datasets, and
tasks and to investigate other compression techniques, e.g.,
quantization-aware training, structured pruning, or
knowledge distillation, as these are also highly relevant in practice.
Furthermore, we deem it as highly important to further
develop methods for systematically and rigorously analyzing
machine learning systems that go beyond averaging metrics,
as these hide many peculiarities that bear the potential for
failures. Lastly, we deem it equally as important to continue
research into the direction of continuous safety assurance
        <xref ref-type="bibr" rid="ref7">(Burton et al. 2021b)</xref>
        in order to consider safety as integral
part of the development of ML-based systems, addressing
issues such as potentially negative effects due to model
compression early on.
      </p>
      <p>Luo, J.-H.; and Wu, J. 2020. AutoPruner: An End-to-End
Trainable Filter Pruning Method for Efficient Deep Model
Inference. Pattern Recognition, 107: 107461.</p>
      <p>Mingers, J. 1989. An Empirical Comparison of Pruning
Methods for Decision Tree Induction. Machine Learning,
4(2): 227–243.</p>
      <p>Picardi, C.; Hawkins, R.; Paterson, C.; and Habli, I. 2019. A
Pattern for Arguing the Assurance of Machine Learning in
Medical Diagnosis Systems. In Computer Safety,
Reliability, and Security, LNCS, 165–179. Cham: Springer
International Publishing.</p>
      <p>Renda, A.; Frankle, J.; and Carbin, M. 2019. Comparing
Rewinding and Fine-Tuning in Neural Network Pruning. In
ICLR 2019.</p>
      <p>Simonyan, K.; Vedaldi, A.; and Zisserman, A. 2014. Deep
inside Convolutional Networks: Visualising Image
Classification Models and Saliency Maps. In Proc. ICLR.</p>
      <p>5</p>
    </sec>
    <sec id="sec-5">
      <title>Acknowledgments</title>
      <p>This work was funded by the Bavarian Ministry for
Economic Affairs, Regional Development and Energy as part of
a project to support the thematic development of the Institute
for Cognitive Systems.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          2018.
          <article-title>N2N Learning: Network to Network Compression via Policy Gradient Reinforcement Learning</article-title>
          .
          <source>In Proc. ICLR</source>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <string-name>
            <surname>Banner</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ; Nahshan,
          <string-name>
            <given-names>Y.</given-names>
            ; and
            <surname>Soudry</surname>
          </string-name>
          ,
          <string-name>
            <surname>D.</surname>
          </string-name>
          <year>2019</year>
          .
          <article-title>Post Training 4-Bit Quantization of Convolutional Networks for RapidDeployment</article-title>
          .
          <source>In Proc. NeurIPS</source>
          ,
          <volume>714</volume>
          ,
          <fpage>7950</fpage>
          -
          <lpage>7958</lpage>
          . Red Hook,
          <string-name>
            <surname>NY</surname>
          </string-name>
          , USA: Curran Associates Inc.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <string-name>
            <surname>Bernhard</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ; Moellic, P.-A.; and
          <string-name>
            <surname>Dutertre</surname>
            ,
            <given-names>J.-M.</given-names>
          </string-name>
          <year>2019</year>
          .
          <article-title>Impact of Low-Bitwidth Quantization on the Adversarial Robustness for Embedded Neural Networks</article-title>
          .
          <source>In 2019 International Conference on Cyberworlds (CW)</source>
          ,
          <fpage>308</fpage>
          -
          <lpage>315</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          2020.
          <article-title>What Is the State of Neural Network Pruning?</article-title>
          <source>In Proc. MLSys</source>
          . mlsys.org.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <string-name>
            <surname>Burton</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Gauerhof</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ; and
          <string-name>
            <surname>Heinzemann</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          <year>2017</year>
          .
          <article-title>Making the Case for Safety of Machine Learning in Highly Automated Driving</article-title>
          . In Computer Safety, Reliability, and Security, LNCS,
          <fpage>5</fpage>
          -
          <lpage>16</lpage>
          . Cham: Springer International Publishing.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <string-name>
            <surname>Burton</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Gauerhof</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Sethy</surname>
            ,
            <given-names>B. B.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Habli</surname>
            ,
            <given-names>I.;</given-names>
          </string-name>
          and Hawkins,
          <string-name>
            <surname>R.</surname>
          </string-name>
          <year>2019</year>
          .
          <article-title>Confidence Arguments for Evidence of Performance in Machine Learning for Highly Automated Driving Functions</article-title>
          . In Computer Safety, Reliability, and Security, LNCS,
          <fpage>365</fpage>
          -
          <lpage>377</lpage>
          . Cham: Springer International Publishing.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          <string-name>
            <surname>Burton</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Kurzidem</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Schwaiger</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Schleiß</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Unterreiner</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Graeber</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ; and Becker,
          <string-name>
            <surname>P.</surname>
          </string-name>
          2021a.
          <article-title>Safety Assurance of Machine Learning for Chassis Control Functions</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          2021b.
          <string-name>
            <surname>Safety</surname>
          </string-name>
          , Complexity, and
          <source>Automated Driving: Holistic Perspectives on Safety Assurance. Computer</source>
          ,
          <volume>54</volume>
          (
          <issue>8</issue>
          ):
          <fpage>22</fpage>
          -
          <lpage>32</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          <string-name>
            <surname>Cai</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Yao</surname>
            ,
            <given-names>Z.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Dong</surname>
            ,
            <given-names>Z.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Gholami</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Mahoney</surname>
            ,
            <given-names>M. W.</given-names>
          </string-name>
          ; and
          <string-name>
            <surname>Keutzer</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          <year>2020</year>
          .
          <article-title>ZeroQ: A Novel Zero Shot Quantization Framework</article-title>
          .
          <source>In Proc. CVPR</source>
          ,
          <fpage>13169</fpage>
          -
          <lpage>13178</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          <string-name>
            <surname>Cheng</surname>
          </string-name>
          , Y.;
          <string-name>
            <surname>Wang</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Zhou</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ; and Zhang, T.
          <year>2018</year>
          .
          <article-title>Model Compression and Acceleration for Deep Neural Networks: The Principles, Progress, and</article-title>
          <string-name>
            <given-names>Challenges. IEEE Signal</given-names>
            <surname>Process</surname>
          </string-name>
          . Mag.,
          <volume>35</volume>
          (
          <issue>1</issue>
          ):
          <fpage>126</fpage>
          -
          <lpage>136</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          <string-name>
            <surname>Duncan</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Komendantskaya</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Stewart</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ; and Lones,
          <string-name>
            <surname>M.</surname>
          </string-name>
          <year>2020</year>
          .
          <article-title>Relative Robustness of Quantized Neural Networks Against Adversarial Attacks</article-title>
          .
          <source>In Proc. IJCNN</source>
          , 1-
          <fpage>8</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          <string-name>
            <surname>Ferianc</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Maji</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Mattina</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ; and Rodrigues,
          <string-name>
            <surname>M.</surname>
          </string-name>
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          <article-title>On the Effects of Quantisation on Model Uncertainty in Bayesian Neural Networks</article-title>
          .
          <source>arXiv:2102</source>
          .11062 [cs, stat].
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          <string-name>
            <surname>Gui</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Wang</surname>
            ,
            <given-names>H. N.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Yang</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Yu</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Wang</surname>
            ,
            <given-names>Z.</given-names>
          </string-name>
          ; and Liu,
          <string-name>
            <surname>J.</surname>
          </string-name>
          <year>2019</year>
          .
          <article-title>Model Compression with Adversarial Robustness: A Unified Optimization Framework</article-title>
          .
          <source>In Proc. NeurIPS</source>
          , volume
          <volume>32</volume>
          . Curran Associates, Inc.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          <string-name>
            <surname>Han</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ; Mao, H.; and
          <string-name>
            <surname>Dally</surname>
            ,
            <given-names>W. J.</given-names>
          </string-name>
          <year>2016</year>
          .
          <article-title>Deep Compression: Compressing Deep Neural Network with Pruning, Trained Quantization and Huffman Coding</article-title>
          .
          <source>In Proc. ICLR</source>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          <string-name>
            <surname>Hawkins</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ; Paterson,
          <string-name>
            <given-names>C.</given-names>
            ;
            <surname>Picardi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            ;
            <surname>Jia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            ;
            <surname>Calinescu</surname>
          </string-name>
          , R.; and
          <string-name>
            <surname>Habli</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          <year>2021</year>
          .
          <article-title>Guidance on the Assurance of Machine Learning in Autonomous Systems (AMLAS)</article-title>
          .
          <source>CoRR, abs/2102</source>
          .01564.
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          <string-name>
            <surname>He</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Zhang</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Ren</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ; and
          <string-name>
            <surname>Sun</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          <year>2016</year>
          .
          <article-title>Deep Residual Learning for Image Recognition</article-title>
          .
          <source>In Proc. CVPR</source>
          ,
          <fpage>770</fpage>
          -
          <lpage>778</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          <string-name>
            <surname>He</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Kang</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Dong</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Fu</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ; and
          <string-name>
            <surname>Yang</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          <year>2018</year>
          .
          <article-title>Soft Filter Pruning for Accelerating Deep Convolutional Neural Networks</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          <string-name>
            <surname>Hinton</surname>
          </string-name>
          , G.;
          <string-name>
            <surname>Vinyals</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          ; and
          <string-name>
            <surname>Dean</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          <year>2015</year>
          .
          <article-title>Distilling the Knowledge in a Neural Network</article-title>
          . arXiv:
          <volume>1503</volume>
          .02531 [cs, stat].
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          <string-name>
            <surname>Hooker</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Courville</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Clark</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ; Dauphin,
          <string-name>
            <given-names>Y.</given-names>
            ; and
            <surname>Frome</surname>
          </string-name>
          ,
          <string-name>
            <surname>A.</surname>
          </string-name>
          <year>2021</year>
          .
          <article-title>What Do Compressed Deep Neural Networks Forget</article-title>
          ? arXiv:
          <year>1911</year>
          .05248 [cs, stat].
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          <string-name>
            <surname>Hubara</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          ; Courbariaux,
          <string-name>
            <given-names>M.</given-names>
            ;
            <surname>Soudry</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            ;
            <surname>El-Yaniv</surname>
          </string-name>
          , R.; and Bengio,
          <string-name>
            <surname>Y.</surname>
          </string-name>
          <year>2018</year>
          .
          <article-title>Quantized Neural Networks: Training Neural Networks with Low Precision Weights and Activations</article-title>
          .
          <source>Journal of Machine Learning Research</source>
          ,
          <volume>18</volume>
          (
          <issue>187</issue>
          ):
          <fpage>1</fpage>
          -
          <lpage>30</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          <string-name>
            <surname>Iandola</surname>
            ,
            <given-names>F. N.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Moskewicz</surname>
            ,
            <given-names>M. W.</given-names>
          </string-name>
          ; Ashraf, K.; Han,
          <string-name>
            <given-names>S.</given-names>
            ;
            <surname>Dally</surname>
          </string-name>
          , W. J.; and
          <string-name>
            <surname>Keutzer</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          <year>2016</year>
          .
          <article-title>SqueezeNet: AlexNetLevel Accuracy with 50x Fewer Parameters and &lt;1MB Model Size</article-title>
          . CoRR, abs/1602.07360.
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          <string-name>
            <surname>Kazmi</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ; Schu¨ller, P.; and Saygin,
          <string-name>
            <surname>Y.</surname>
          </string-name>
          <year>2017</year>
          .
          <article-title>Improving Scalability of Inductive Logic Programming via Pruning and Best-Effort Optimisation</article-title>
          .
          <source>Expert Systems With Applications</source>
          ,
          <volume>87</volume>
          :
          <fpage>291</fpage>
          -
          <lpage>303</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          <string-name>
            <surname>Krizhevsky</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <year>2009</year>
          .
          <article-title>Learning Multiple Layers of Features from Tiny Images</article-title>
          .
          <volume>60</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          <string-name>
            <surname>Lecun</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Bottou</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Bengio</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ; and Haffner,
          <string-name>
            <surname>P.</surname>
          </string-name>
          <year>1998</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref26">
        <mixed-citation>
          <article-title>Gradient-Based Learning Applied to Document Recognition</article-title>
          .
          <source>Proc. IEEE</source>
          ,
          <volume>86</volume>
          (
          <issue>11</issue>
          ):
          <fpage>2278</fpage>
          -
          <lpage>2324</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref27">
        <mixed-citation>
          <string-name>
            <surname>LeCun</surname>
          </string-name>
          , Y.;
          <string-name>
            <surname>Denker</surname>
            ,
            <given-names>J. S.</given-names>
          </string-name>
          ; and
          <string-name>
            <surname>Solla</surname>
            ,
            <given-names>S. A.</given-names>
          </string-name>
          <year>1989</year>
          .
          <article-title>Optimal Brain Damage</article-title>
          . In Touretzky, D. S., ed.,
          <source>Proc. NIPS</source>
          ,
          <fpage>598</fpage>
          -
          <lpage>605</lpage>
          . Morgan Kaufmann.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>