<!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>Neural Network Verification with DSE</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Benedikt Böing</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Falk Howar</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jelle Hüntelmann</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Emmanuel Müller</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Richard Stewing</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Aqua-Group, LS 14, TU Dortmund University</institution>
          ,
          <addr-line>Otto-Hahn-Straße 14, 44227 Dortmund</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Fraunhofer ISST</institution>
          ,
          <addr-line>Emil-Figge-Str. 91, 44227 Dortmund</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Research Center Trustworthy Data Science and Security, TU Dortmund</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>Neural network with Linear and ReLU nodes can be represented as sequential linear programs that are simple in structure but have many program paths: diferent combinations of ReLU activations correspond to paths in the corresponding program. Naive applications of conventional program analysis techniques for proving properties of such networks are hampered by the expontential number of activation patterns (i.e., program paths). In this paper, we explore a technique for scaling verification by decomposing the verification task into first finding feasible paths and then proving properties for individual paths, resulting in multiple small verification tasks (compared to monolithic analysis of the network). Moreover, this enables horizontal scaling, i.e., parallel execution, further decreasing analysis time. Finally, the proposed decomposition allows us to reuse a once computed set of feasible paths for the verfication of multiple properties, compounding performance gains when checking multiple properties on the same network.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Neural Network</kwd>
        <kwd>Neural Network Verification</kwd>
        <kwd>Dynamic Symbolic Execution</kwd>
        <kwd>Formal Anaylsis</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>(a) Minimal Example Network
fun id(x : Double) : Double = x
fun relu(x : Double) : Double =</p>
      <p>if(x &gt; 0) x else 0.0
val l11=id(i1*-0.64+i1*-0.02+i3*-0.63)
val l12=id(i1*0.61+i1*0.35+i3*-0.37)
val r21=relu(l11 * 0.43)
val r22=relu(l12 * 0.14)
(b) Implementation of the first and second layer in
network of Figure 1a.</p>
      <p>
        Related Work. Proving properties about neural networks is called neural network verification
[
        <xref ref-type="bibr" rid="ref2 ref3 ref4 ref5">3, 4, 5, 2</xref>
        ]. One popular type of property is robustness against adversarial attacks as introduced
by Szehedy et al. [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Some verifiers trade precision for eficiency by over-approximating
the behavior of a system. Approximating parts of the network, e.g. its output [
        <xref ref-type="bibr" rid="ref7 ref8 ref9">7, 8, 9</xref>
        ], makes
the verification problem easier and faster to solve. On the other hand, these approaches may
reject networks that factually satisfy a given property. Other works attempt to develop precise
techniques [
        <xref ref-type="bibr" rid="ref10 ref11 ref4">10, 4, 11</xref>
        ], often at the cost of limited scalability: these methods, implicitly or
explicitly, enumerate all ReLU configurations corresponding to paths in the linear program of
neural network. The exponential number of these configuration made them an attractive target
for reducing the underlying complexity. Diferent approaches include adding constraints to
particular ReLUs [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] or considering dependencies between diferent nodes [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ].
      </p>
      <p>In this work, we apply precise software verification techniques to neural networks.
Concrretely, we use dynamic symbolic execution [13] to enumerate a network’s paths. The same
technique is used to analyze the taint flow of programs [ 14, 15] or to enhance static analyses
[16, 17] and has been shown to scale well to complex programs [18]. Schlüter et al. used symbolic
execution to generate TADS to check network equivalence and explainability [19]. A unique
benefit of this approach is that we produce an intermediate result that can be re-used and is
much less complex than the original network (from the perspective of a verifier).</p>
    </sec>
    <sec id="sec-2">
      <title>2. From Networks to Programs</title>
      <p>The size and concurrent activation pattern of neural networks can make them hard to understand.
This computation model is not well suited for classical program analysis. We show this by
example and transform a small neural network into a program’s linear representation. Figure
1a shows the ReLU network. It consists of four layers (including the output layer): three linear
layers and a single ReLU layer. We assume, but without loss of generality, that ReLU neurons
only have a single input.</p>
      <p>We transform ReLU networks into a program that uses only multiplication, addition and
function calls. For the above network’s layers one and two and their activation functions result
in the code from Figure 1b: We multiply the vector of weights with the input and pass the result
to the activation function. The name of every neuron consists of its activation function, its
layer, and its position in this layer.</p>
      <p>We can now apply dynamic symbolic execution (DSE) to the network. Symbolic execution
replaces concrete values with symbolic values. The branching operators (if, while, etc.)
decide which paths to follow by checking satisfiability of path constraints collected during
execution. This may result in multiple branches being feasable and hence being followed. DSE
consequently enumerates all feasible (i.e., satisfiable) paths through a program, filtering paths
as soon as they become unsatisfiable (each unsatisfiable path prefix leads to the root of an
unsatisfiable sub-tree of paths), and resulting in few additional queries to a constraint solver for
many unsatisfiable paths. Figure 2 shows all paths through the code in Figure 1b. Notice that
all combinations of assignments for the two ReLUs are possible1 and on diferent paths. A path
becomes unsatisfiable if no input can fulfill the path constraints. Take for example a network
with a single input  and two ReLU nodes with weights  and − . Only one of those nodes
can be positive at a time and hence, the path where both activate positively is unsatisfiable.
Whenever we talk about the paths of a neural network, we refer to the paths of the program
into which we translated a neural network.</p>
      <p>Algorithm 1 Enumerating all satisfiable paths
and checking satisfiability after a layer is added.</p>
      <p>← the paths including the first layer 1.
for every  ∈ 2 · · ·  do
 ← ∅
for every satisfiable  ∈  ×  do</p>
      <p>Add  to 
end for
 ← 
end for
return</p>
    </sec>
    <sec id="sec-3">
      <title>3. Decomposing Verification</title>
      <p>Algorithm 2 Verification of  over all
satisfiable paths  - Safety
 ← ⊤
for Every path  ∈  do</p>
      <p>←  ∧  ∧ ¬ is unsatisfiable
end for
return 
A neural network  corresponds to a set of program paths  , divided into satisfiable ( ) and
unsatisfiable (  ) paths:  ∪  =  with  ∩  = ∅. We decompose the verification of some
property  on  , i.e., checking if  |=  , into checking  on all paths, i.e.,  |=  for ∀ ∈ 
1When we say “possible”, we are not saying they are all executable at runtime. Some paths may have an unsatisfiable
path constraint. “Possible” here refers to the syntactic category. When we try to restrict this set to executable paths,
we refer to them as satifiable.
(Algorithm 2). To this end, we have to first compute . Here, we optimize the runtime by
varying when we check for satisfiability of path prefixes in a breath-first exploration of all
paths. Assume paths , 1, 2 with path constraints , 1, 2 respectively, such that  = 12,
and  = 1 ∧ 2. If 1 is unsatisfiable,  is also unsatisfiable and need not be explored. Thus,
checking path constraints sooner, e.g. after 1 instead of after , reduces the number of path
constraints to check for satisfiability. Checking path constraints after each layer (Algorithm 1)
resulted in the best trade-of between runtime and potential for parallelization in our tests.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Preliminary Results and Conclusion</title>
      <p>We demonstrate our approach by analyzing properties of two networks: we use neural network
N1 (19 ReLUs) to analyze performance of mutiple path enumeration strategies and network N2
(38 ReLUs) to compare verification against two monolithic approaches. 2</p>
      <p>Table 1 summarizes all results: Filtering unsatisfiable paths makes the approach tractable.
Enumerating all paths and checking their path constraints afterward, was infeasible for 524 288 =
219 paths. Parallel layer-wise path enumeration was the optimal strategy. For the verification
of a simple assertion on outputs  , we use monolithic verification with MathSAT and Z3 as
a baseline comparisons. MathSAT, a solver optimized for linear arithmetics, can solve the
verification task in 43 minutes. The popular 3 SMT solver needs more than five days. Our
approach needs (in a very unoptimized implementation) 15 hours for enumerating all satisfiable
paths and 5 minutes and 25 seconds for checking the property on these paths. This makes us
confident, that with further optimization of the implementation, the approach will pay of when
multiple properties have to be checked.</p>
      <p>As next steps, we plan to thoroughly evaluate and compare scalability to diferent sizes
of networks and types of properties. We also plan to explore extending the technique to
back-feeding neural networks and more activation functions. Ultimately, we are interested in
definitions of properties that are of interest for neural networks.
2The hardware was a research server: Common KVM processor with 72 processors and 135 GB memory running
Linux 5.4.0-125-generic. The SMT-Solver was z3 (https://github.com/Z3Prover/z3) in Version 4.11.0.</p>
    </sec>
    <sec id="sec-5">
      <title>Acknowledgments</title>
      <p>This research is partially funded by the German Federal Ministry of Education and Research
(BMBF) within the Data Trust Models Funding Action (16DTM106A). The authors are responsible
for the content of this publication. This work was also supported by the Research Center
Trustworthy Data Science and Security, an institution of the University Alliance Ruhr.
ence on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of
Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational
Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020,
2020.
[13] J. C. King, Symbolic execution and program testing, Commun. ACM 19 (1976) 385–394.</p>
      <p>doi:10.1145/360248.360252.
[14] M. Mues, T. Schallau, F. Howar, Jaint: A framework for user-denfied dynamic taint-analyses
based on dynamic symbolic execution of java programs, in: B. Dongol, E. Troubitsyna
(Eds.), Integrated Formal Methods, Springer International Publishing, Cham, 2020, pp.
123–140.
[15] E. J. Schwartz, T. Avgerinos, D. Brumley, All you ever wanted to know about dynamic
taint analysis and forward symbolic execution (but might have been afraid to ask), in:
Proceedings of the 2010 IEEE Symposium on Security and Privacy, SP ’10, IEEE Computer
Society, USA, 2010, p. 317–331. doi:10.1109/SP.2010.26.
[16] T. Avgerinos, A. Rebert, S. K. Cha, D. Brumley, Enhancing symbolic execution with
veritesting, in: Proceedings of the 36th International Conference on Software Engineering,
ICSE 2014, Association for Computing Machinery, New York, NY, USA, 2014, p. 1083–1094.
doi:10.1145/2568225.2568293.
[17] Y. P. Khoo, B.-Y. E. Chang, J. S. Foster, Mixing type checking and symbolic execution,</p>
      <p>SIGPLAN Not. 45 (2010) 436–447. doi:10.1145/1809028.1806645.
[18] P. Godefroid, M. Y. Levin, D. A. Molnar, SAGE: whitebox fuzzing for security testing,
Commun. ACM 55 (2012) 40–44. URL: https://doi.org/10.1145/2093548.2093564. doi:10.
1145/2093548.2093564.
[19] M. Schlüter, G. Nolte, A. Murtovi, S. Bernhard, Towards rigorous understanding of neural
networks via semantics-preserving transformations, International Journal on Software
Tools for Technology Transfer (2022). To appear.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>K.</given-names>
            <surname>Scheibler</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Neubauer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Mahdi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Fränzle</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Teige</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Bienmüller</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Fehrer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Becker</surname>
          </string-name>
          ,
          <article-title>Accurate icp-based floating-point reasoning</article-title>
          , in: 2016 Formal Methods in Computer-Aided
          <string-name>
            <surname>Design</surname>
          </string-name>
          (FMCAD),
          <year>2016</year>
          , pp.
          <fpage>177</fpage>
          -
          <lpage>184</lpage>
          . doi:
          <volume>10</volume>
          .1109/FMCAD.
          <year>2016</year>
          .
          <volume>7886677</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>A.</given-names>
            <surname>Irfan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K. D.</given-names>
            <surname>Julian</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Wu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Barrett</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. J.</given-names>
            <surname>Kochenderfer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Meng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Lopez</surname>
          </string-name>
          ,
          <article-title>Towards verification of neural networks for small unmanned aircraft collision avoidance</article-title>
          ,
          <source>in: 2020 AIAA/IEEE 39th Digital Avionics Systems Conference (DASC)</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>K. Y.</given-names>
            <surname>Xiao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Tjeng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N. M. M.</given-names>
            <surname>Shafiullah</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Madry</surname>
          </string-name>
          ,
          <article-title>Training for faster adversarial robustness verification via inducing relu stability</article-title>
          ,
          <source>in: 7th International Conference on Learning Representations, ICLR</source>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>R.</given-names>
            <surname>Ehlers</surname>
          </string-name>
          ,
          <article-title>Formal verification of piece-wise linear feed-forward neural networks</article-title>
          ,
          <source>in: Automated Technology for Verification and Analysis - 15th International Symposium</source>
          , ATVA,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>B.</given-names>
            <surname>Böing</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Roy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Müller</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Neider</surname>
          </string-name>
          ,
          <article-title>Quality guarantees for autoencoders via unsupervised adversarial attacks</article-title>
          ,
          <source>in: Machine Learning and Knowledge Discovery in Databases - European Conference, ECML PKDD</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>C.</given-names>
            <surname>Szegedy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Zaremba</surname>
          </string-name>
          ,
          <string-name>
            <surname>I. Sutskever</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Bruna</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Erhan</surname>
          </string-name>
          ,
          <string-name>
            <surname>I. Goodfellow</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Fergus</surname>
          </string-name>
          ,
          <article-title>Intriguing properties of neural networks</article-title>
          ,
          <source>in: International Conference on Learning Representations, ICLR</source>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>G.</given-names>
            <surname>Singh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Gehr</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Mirman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Püschel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. T.</given-names>
            <surname>Vechev</surname>
          </string-name>
          ,
          <article-title>Fast and efective robustness certification</article-title>
          ,
          <source>in: Advances in Neural Information Processing Systems</source>
          <volume>31</volume>
          , NeurIPS,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>H.</given-names>
            <surname>Zhang</surname>
          </string-name>
          , T.-W. Weng, P.-Y. Chen,
          <string-name>
            <surname>C.-J. Hsieh</surname>
          </string-name>
          , L. Daniel,
          <article-title>Eficient neural network robustness certification with general activation functions</article-title>
          ,
          <source>in: Advances in Neural Information Processing Systems</source>
          , NeurIPS,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>T.</given-names>
            <surname>Weng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Song</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Hsieh</surname>
          </string-name>
          , L. Daniel,
          <string-name>
            <given-names>D. S.</given-names>
            <surname>Boning</surname>
          </string-name>
          ,
          <string-name>
            <given-names>I. S.</given-names>
            <surname>Dhillon</surname>
          </string-name>
          ,
          <article-title>Towards fast computation of certified robustness for relu networks</article-title>
          ,
          <source>in: Proceedings of the 35th International Conference on Machine Learning</source>
          , ICML,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>G.</given-names>
            <surname>Katz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C. W.</given-names>
            <surname>Barrett</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. L.</given-names>
            <surname>Dill</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Julian</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. J.</given-names>
            <surname>Kochenderfer</surname>
          </string-name>
          ,
          <string-name>
            <surname>Reluplex:</surname>
          </string-name>
          <article-title>An eficient SMT solver for verifying deep neural networks</article-title>
          , in: Computer Aided Verification - 29th International Conference, CAV,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>V.</given-names>
            <surname>Tjeng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K. Y.</given-names>
            <surname>Xiao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Tedrake</surname>
          </string-name>
          ,
          <article-title>Evaluating robustness of neural networks with mixed integer programming</article-title>
          ,
          <source>in: International Conference on Learning Representations, ICLR</source>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>E.</given-names>
            <surname>Botoeva</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Kouvaros</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Kronqvist</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Lomuscio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Misener</surname>
          </string-name>
          ,
          <article-title>Eficient verification of relu-based neural networks via dependency analysis</article-title>
          ,
          <source>in: The Thirty-Fourth AAAI Confer-</source>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>