## Specification-Guided Safety Verification for Feedforward Neural Networks
Weiming Xiang ∗ , Hoang-Dung Tran ∗ , Taylor T. Johnson ∗
December 18, 2018
tions or properties of neural networks. Verifying neural networks is a hard problem, even simple properties about them have been proven NP-complete problems [2]. The difficulties mainly come from the presence of activation functions and the complex structures, making neural networks large-scale, nonlinear, non-convex and thus incomprehensible to humans.
The importance of methods of formal guarantees for neural networks has been well-recognized in literature. There exist a number of results for verification of feedforward neural networks, especially for Rectifier Linear Unit (ReLU) neural networks, and a few results are devoted to neural networks with broad classes of activation functions. Motivated to general class of neural networks such as those considered in [3], our key contribution in this paper is to develop a specificationguided method for safety verification of feedforward neural network. First, we formulate the safety verification problem in the framework of interval arithmetic, and provide a computationally efficient formula to compute output interval sets. The developed formula is able to calculate the output intervals in a fast manner. Then, analogous to other state-of-the-art verification methods, such as counterexample-guided abstraction refinement (CEGAR) [4] and property directed reachability (PDR) [5], and inspired by the Moore-Skelboe algorithm [6], a specification-guided algorithm is developed. Briefly speaking, the safety specification is utilized to examine the existence of intersections between output intervals and unsafe regions and then determine the bisection actions in the verification algorithm. By making use of the information of safety specification, the computation cost can be reduced significantly. We provide experimental evidences to show the advantages of specification-guided approach, which shows that our approach only needs about 3%-7% computational cost of the method proposed in [3] to solve the same safety verification problem.
## 2 Related Work
Many recent works are focusing on ReLU neural networks. In [2], an SMT solver named Reluplex is proposed for a special class of neural networks with ReLU activation functions. The Reluplex extends the well-known Simplex algorithm from linear functions to ReLU functions by making use of the piecewise linear feature of ReLU functions. In [7], A layer-bylayer approach is developed for the output reachable set com-
## Abstract
This paper presents a specification-guided safety verification method for feedforward neural networks with general activation functions. As such feedforward networks are memoryless, they can be abstractly represented as mathematical functions, and the reachability analysis of the neural network amounts to interval analysis problems. In the framework of interval analysis, a computationally efficient formula which can quickly compute the output interval sets of a neural network is developed. Then, a specification-guided reachability algorithm is developed. Specifically, the bisection process in the verification algorithm is completely guided by a given safety specification. Due to the employment of the safety specification, unnecessary computations are avoided and thus computational cost can be reduced significantly. Experiments show that the proposed method enjoys much more efficiency in safety verification with significantly less computational cost.
## 1 Introduction
Artificial neural networks have been widely used in machine learning systems. Though neural networks have been showing effectiveness and powerful ability in resolving complex problems, they are confined to systems which comply only to the lowest safety integrity levels since, in most of time, a neural network is viewed as a black box without effective methods to assure safety specifications for its outputs. Neural networks are trained over a finite number of input and output data, and are expected to be able to generalize to produce desirable outputs for given inputs even including previously unseen inputs. However, in many practical applications, the number of inputs is essentially infinite, this means it is impossible to check all the possible inputs only by performing experiments and moreover, it has been observed that neural networks can react in unexpected and incorrect ways to even slight perturbations of their inputs [1], which could result in unsafe systems. Hence, methods that are able to provide formal guarantees are in a great demand for verifying specifica-
∗ Authors are with the Department of Electrical Engineering and Computer Science, Vanderbilt University, Nashville, Tennessee 37212, USA. Email: xiangwming@gmail.com (Weiming Xiang); Hoang-Dung Tran (trhoangdung@gmail.com); taylor.johnson@gmail.com (Taylor T. Johnson).
putation of ReLU neural networks. The computation is formulated in the form of a set of manipulations for a union of polyhedra. A verification engine for ReLU neural networks called AI 2 was proposed in [8]. In their approach, the authors abstract perturbed inputs and safety specifications as zonotopes, and reason about their behavior using operations for zonotopes. An Linear Programming (LP)-based method is proposed [9], and in [10] authors encoded the constraints of ReLU functions as a Mixed-Integer Linear Programming (MILP). Combining output specifications that are expressed in terms of LP, the verification problem for output set eventually turns to a feasibility problem of MILP. In [11, 12], an MILP based verification engine called Sherlock that performs an output range analysis of ReLU feedforward neural networks is proposed, in which a combined local and global search is developed to more efficiently solve MILP.
Besides the results for ReLU neural networks, there are a few other results for neural networks with general activation functions. In [13, 14], a piecewise-linearization of the nonlinear activation functions is used to reason about their behaviors. In this framework, the authors replace the activation functions with piecewise constant approximations and use the bounded model checker hybrid satisfiability (HySAT) [15] to analyze various properties. In their papers, the authors highlight the difficulty of scaling this technique and, currently, are only able to tackle small networks with at most 20 hidden nodes. In [16], the authors proposed a framework for verifying the safety of network image classification decisions by searching for adversarial examples within a specified region. A adaptive nested optimization framework is proposed for reachability problem of neural networks in [17]. In [3], a simulation-based approach was developed, which used a finite number of simulations/computations to estimate the reachable set of multi-layer neural networks in a general form. Despite this success, the approach lacks the ability to resolve the reachable set computation problem for neural networks that are large-scale, non-convex, and nonlinear. Still, simulation-based approaches, like the one developed in [3], present a plausibly practical and efficient way of reasoning about neural network behaviors. The critical step in improving simulation-based approaches is bridging the gap between finitely many simulations and the essentially infinite number of inputs that exist in the continuity set. Sometimes, the simulation-based approach requires a large number of simulations to obtain a tight reachable set estimation, which is computationally costly in practice. In this paper, our aim is to reduce the computational cost by avoiding unnecessary computations with the aid of a specification-guided method.
## 3 Background
## 3.1 Feedforward Neural Networks
Generally speaking, a neural network consists of a number of interconnected neurons and each neuron is a simple processing element that responds to the weighted inputs it received from other neurons. In this paper, we consider feed-forward neural networks, which generally consist of one input layer, multiple hidden layers and one output layer. The action of a neuron depends on its activation function, which is in the form of
$$y _ { i } = \phi \left ( \sum \nolimits _ { j = 1 } ^ { n } \omega _ { i j } x _ { j } + \theta _ { i } \right ) \quad \ \ ( 1 )$$
where x j is the j th input of the i th neuron, ω ij is the weight from the j th input to the i th neuron, θ i is called the bias of the i th neuron, y i is the output of the i th neuron, φ ( · ) is the activation function. The activation function is generally a nonlinear continuous function describing the reaction of i th neuron with inputs x j , j = 1 , · · · , n . Typical activation functions include ReLU, logistic, tanh, exponential linear unit, linear functions, for instance. In this work, our approach aims at being capable of dealing with activation functions regardless of their specific forms.
Afeedforward neural network has multiple layers, and each layer , 1 ≤ ≤ L , has n { } neurons. In particular, layer = 0 is used to denote the input layer and n { 0 } stands for the number of inputs in the rest of this paper. For the layer , the corresponding input vector is denoted by x { } and the weight matrix is
$$W ^ { \{ \ell \} } = \left [ \omega _ { 1 } ^ { \{ \ell \} } , \dots , \omega _ { n ^ { \{ \ell \} } } ^ { \{ \ell \} } \right ] ^ { \top } \quad ( 2 )$$
where ω { } i is the weight vector. The bias vector for layer is
$$\pm b { \theta } ^ { \{ \ell \} } = \left [ \theta _ { 1 } ^ { \{ \ell \} } , \dots , \theta _ { n ^ { \{ \ell \} } } ^ { \{ \ell \} } \right ] ^ { \top } . \quad ( 3 )$$
The output vector of layer can be expressed as
$$y ^ { \{ \ell \} } = \phi _ { \ell } ( W ^ { \{ \ell \} } x ^ { \{ \ell \} } + \theta ^ { \{ \ell \} } ) \quad ( 4 )$$
where φ ( · ) is the activation function of layer .
The output of -1 layer is the input of layer, and the mapping from the input of input layer, that is x [0] , to the output of output layer, namely y [ L ] , stands for the input-output relation of the neural network, denoted by
$$y ^ { \{ L \} } = \Phi ( x ^ { \{ 0 \} } ) \quad ( 5 )$$
where Φ( · ) φ L ◦ φ L -1 ◦ · · · ◦ φ 1 ( · ) .
## 3.2 Problem Formulation
We start by defining the neural network output set that will become of interest all through the rest of this paper.
Definition 3.1 Given a feedforward neural network in the form of (5) and an input set X ⊆ R n { 0 } , the following set
$$\mathcal { Y } = \left \{ y ^ { \{ L \} } \in \mathbb { R } ^ { n ^ { \{ L \} } } | y ^ { \{ L \} } = \Phi ( x ^ { \{ 0 \} } ) , \, x ^ { \{ 0 \} } \in \mathcal { X } \right \}$$
is called the output set of neural network (5).
The safety specification of a neural network is expressed by a set defined in the output space, describing the safety requirement.
Definition 3.2 Safety specification S formalizes the safety requirements for output y [ L ] of neural network (5), and is a predicate over output y [ L ] of neural network (5). The neural network (5) is safe if and only if the following condition is satisfied:
$$\mathcal { Y } \cap \neg \mathcal { S } = \emptyset \quad ( 7 ) \quad [ \phi ] \colon$$
where Y is the output set defined by (6), and ¬ is the symbol for logical negation.
The safety verification problem for the neural network (5) is stated as follows.
Problem 3.1 How does one verify the safety requirement described by (7), given a neural network (5) with a compact input set X and a safety specification S ?
The key for solving the safety verification Problem 3.1 is computing output set Y . However, since neural networks are often nonlinear and non-convex, it is extremely difficult to compute the exact output set Y . Rather than directly computing the exact output set for a neural network, a more practical and feasible way for safety verification is to derive an overapproximation of Y .
Definition 3.3 A set Y o is an over-approximation of Y if Y ⊆ Y o holds.
The following lemma implies that it is sufficient to use the over-approximated output set for the safety verification of a neural network.
Lemma 3.1 Consider a neural network in the form of (5) and a safety specification S , the neural network is safe if the following condition is satisfied
$$\mathcal { Y } _ { o } \cap \neg \mathcal { S } = \emptyset \quad ( 8 ) \underset { e v b i } { \overset { l m } { s h i } }$$
where Y ⊆ Y o .
$$\text {Proof. Due to } \mathcal { Y } \subseteq \mathcal { Y } _ { o } , ( 8 ) \, \text {implies} \, \mathcal { Y } \cap \neg \mathcal { S } = \emptyset . \quad \Box \quad t h e n \ t h e$$
From Lemma 3.1, the problem turns to how to construct an appropriate over-approximation Y o . One natural way, as the method developed in [3], is to find a set Y o as small as possible to tightly over-approximate output set Y and further perform safety verification. However, this idea sometimes could be computationally expensive, and actually most of computations are unnecessary for safety verification. In the following, a specification-guided approach will be developed, and the over-approximation of output set is computed in an adaptive way with respect to a given safety specification.
## 4 Safety Verification
## 4.1 Preliminaries and Notation
Let [ x ] = [ x, x ] , [ y ] = [ y, y ] be real compact intervals and ◦ be one of the basic operations addition, subtraction, multiplication and division, respectively, for real numbers, that is
◦ ∈ { + , -, · , / } , where it is assumed that 0 / ∈ [ b ] in case of division. We define these operations for intervals [ x ] and [ y ] by [ x ] ◦ [ y ] = { x ◦ y | x ∈ [ y ] , x ∈ [ y ] } . The width of an interval [ x ] is defined and denoted by w ([ x ]) = x -x . The set of compact intervals in R is denoted by IR . We say [ φ ] : IR → IR is an interval extension of function φ : R → R , if for any degenerate interval arguments, [ φ ] agrees with φ such that [ φ ]([ x, x ]) = φ ( x ) . In order to consider multidimensional problems where x ∈ R n is taken into account, we denote [ x ] = [ x 1 , x 1 ] × · · · × [ x n , x n ] ∈ IR n , where IR n denotes the set of compact interval in R n . The width of an interval vector x is the largest of the widths of any of its component intervals w ([ x ]) = max i =1 ,...,n ( x i -x i ) . A mapping [Φ] : IR n → IR m denotes the interval extension of a function Φ : R n → R m . An interval extension is inclusion monotonic if, for any [ x 1 ] , [ x 2 ] ∈ IR n , [ x 1 ] ⊆ [ x 2 ] implies [Φ]([ x 1 ]) ⊆ [Φ]([ x 2 ]) . Afundamental property of inclusion monotonic interval extensions is that x ∈ [ x ] ⇒ Φ( x ) ∈ [Φ]([ x ]) , which means the value of Φ is contained in the interval [Φ]([ x ]) for every x in [ x ] .
Several useful definitions and lemmas are presented.
Definition 4.1 [18] Piece-wise monotone functions, including exponential, logarithm, rational power, absolute value, and trigonometric functions, constitute the set of standard functions.
Lemma 4.1 [18] A function Φ which is composed by finitely many elementary operations { + , -, · , / } and standard functions is inclusion monotone.
Definition 4.2 [18] An interval extension [Φ]([ x ]) is said to be Lipschitz in [ x 0 ] if there is a constant ξ such that w ([Φ]([ x ])) ≤ ξw ([ x ]) for every [ x ] ⊆ [ x 0 ] .
Lemma 4.2 [18] If a function Φ( x ) satisfies an ordinary Lipschitz condition in [ x 0 ] ,
$$\left \| \Phi ( x _ { 2 } ) - \Phi ( x _ { 1 } ) \right \| \leq \xi \, \left \| x _ { 2 } - x _ { 1 } \right \| , \, x _ { 1 } , x _ { 2 } \in [ x _ { 0 } ] \quad ( 9 )$$
then the interval extension [Φ]([ x ]) is a Lipschitz interval extension in [ x 0 ] ,
$$w ( [ \Phi ] ( [ x ] ) ) \leq \xi w ( [ x ] ) , \, [ x ] \subseteq [ x _ { 0 } ] . \quad ( 1 0 )$$
The following trivial assumption is given for activation functions.
Assumption 4.1 The activation function φ considered in this paper is composed by finitely many elementary operations and standard functions.
Based on Assumption 4.1, the following result can be obtained for a feedforward neural network.
Theorem 4.1 The interval extension [Φ] of neural network Φ composed by activation functions satisfying Assumption 4.1 is inclusion monotonic and Lipschitz such that
$$\text { and } \quad w ( [ \Phi ] ( [ x ] ) ) \leq \xi ^ { L } \prod _ { \ell = 1 } ^ { L } \left \| W ^ { \{ \ell \} } \right \| w ( [ x ] ) , \, [ x ] \subseteq \mathbb { R } ^ { n ^ { \{ 0 \} } }
w ( [ x ] ) = \left | \text {and} \right | w ( [ x ] ) = \left \| W ^ { \{ \ell \} } \right \| w ( [ x ] ) , \, [ x ] \subseteq \mathbb { R } ^ { n ^ { \{ 0 \} } } \\ \text {and} \quad w ( [ x ] ) = \left | \text {and} \right | w ( [ x ] ) = \left \| W ^ { \{ \ell \} } \right \| w ( [ x ] ) , \, [ x ] \subseteq \mathbb { R } ^ { n ^ { \{ 0 \} } } \\ \text {and} \quad w ( [ x ] ) = \left | \text {and} \right | w ( [ x ] ) = \left \| W ^ { \{ \ell \} } \right \| w ( [ x ] ) , \, [ x ] \subseteq \mathbb { R } ^ { n ^ { \{ 0 \} } } \\ \text {and} \quad w ( [ x ] ) = \left | \text {and} \right | w ( [ x ] ) = \left \| W ^ { \{ \ell \} } \right \| w ( [ x ] ) , \, [ x ] \subseteq \mathbb { R } ^ { n ^ { \{ 0 \} } } \\ \text {and} \quad w ( [ x ] ) = \left | \text {and} \right | w ( [ x ] ) = \left \| W ^ { \{ \ell \} } \right \| w ( [ x ] ) , \, [ x ] \subseteq \mathbb { R } ^ { n ^ { \{ 0 \} } }$$
where ξ is a Lipschitz constant for all activation functions in Φ .
Proof . Under Assumption 4.1, the inclusion monotonicity can be obtained directly based on Lemma 4.1. Then, for the layer , we denote ˆ φ ( x { } ) = φ ( W { } x { } + θ { } ) . For any x 1 , x 2 , it has
$$\left \| \hat { \phi } _ { \ell } ( x _ { 2 } ^ { \{ \ell \} } ) - \hat { \phi } _ { \ell } ( x _ { 1 } ^ { \{ \ell \} } ) \right \| & \leq \xi \left \| W ^ { \{ \ell \} } x _ { 2 } ^ { \{ \ell \} } - W x _ { 1 } ^ { \{ \ell \} } \right \| & i n p \\ & \leq \xi \left \| W ^ { \{ \ell \} } \right \| \left \| x _ { 2 } ^ { \{ \ell \} } - x _ { 1 } ^ { \{ \ell \} } \right \| .$$
Due to x { } = ˆ φ -1 ( x { -1 } ) , = 1 , . . . , L , we have ξ L ∏ L =1 ∥ ∥ W { } ∥ ∥ the Lipschitz constant for Φ , and (11) can be established by Lemma 4.2.
## 4.2 Interval Analysis
First, we consider a single layer y = φ ( Wx + θ ) . Given an interval input [ x ] , the interval extension is [ φ ]( W [ x ] + θ ) = [ y 1 , y 1 ] ×··· × [ y n , y n ] = [ y ] , where
$$\underline { y } _ { i } = \min _ { x \in [ x ] } \phi \left ( \sum \nolimits _ { j = 1 } ^ { n } \omega _ { i j } x _ { j } + \theta _ { i } \right ) \quad ( 1 2 )$$
$$\overline { y } _ { i } = \max _ { x \in [ x ] } \phi \left ( \sum \nolimits _ { j = 1 } ^ { n } \omega _ { i j } x _ { j } + \theta _ { i } \right ) . \quad ( 1 3 )$$
To compute the interval extension [ φ ] , we need to compute the minimum and maximum values of the output of nonlinear function φ . For general nonlinear functions, the optimization problems are still challenging. Typical activation functions include ReLU, logistic, tanh, exponential linear unit, linear functions, for instance, satisfy the following monotonic assumption.
Assumption 4.2 For any two scalars z 1 ≤ z 2 , the activation function satisfies φ ( z 1 ) ≤ φ ( z 2 ) .
Assumption 4.2 is a common property that can be satisfied by a variety of activation functions. For example, it is easy to verify that the most commonly used such as logistic, tanh, ReLU, all satisfy Assumption 4.2. Taking advantage of the monotonic property of φ , the interval extension [ φ ]([ z ]) = [ φ ( z ) , φ ( z )] . Therefore, y i and y i in (12) and (13) can be explicitly written out as
$$\underline { y } _ { i } = \sum \nolimits _ { j = 1 } ^ { n } p _ { i j } + \theta _ { i } \quad ( 1 4 ) \quad w ( [ \Phi ]$$
$$\bar { y } _ { i } = \sum \nolimits _ { j = 1 } ^ { n } \bar { p } _ { i j } + \theta _ { i } \quad ( 1 5 ) \quad D e f i n t a l s$$
with p ij and p ij defined by
$$\underline { p } _ { - i j } = \left \{ \begin{array} { l l } { \omega _ { i j } \underline { x } _ { j } , } & { \omega _ { i j } \geq 0 } \\ { \omega _ { i j } \overline { x } _ { j } , } & { \omega _ { i j } < 0 } \end{array} ( 1 6 ) \quad o f i n t e q u a l$$
$$\bar { p } _ { i j } = \left \{ \begin{array} { l l } { \omega _ { i j } \overline { x } _ { j } , } & { \omega _ { i j } \geq 0 } \\ { \omega _ { i j } \underline { x } _ { j } , } & { \omega _ { i j } < 0 } \end{array} .$$
From (14)-(17), the output interval of a single layer can be efficiently computed with these explicit expressions. Then, we consider the feedforward neural network y { L } = Φ( x { 0 } ) with multiple layers, the interval extension [Φ]([ x { 0 } ]) can be computed by the following layer-by-layer computation.
Theorem 4.2 Consider feedforward neural network (5) with activation function satisfying Assumption 4.2 and an interval input [ x { 0 } ] , an interval extension can be determined by
$$[ \Phi ] ( [ x ^ { \{ 0 \} } ] ) = [ \hat { \phi } _ { L } ] \circ \cdots \circ [ \hat { \phi } _ { 1 } ] \circ [ \hat { \phi } _ { 0 } ] ( [ x ^ { \{ 0 \} } ] ) \quad ( 1 8 )$$
where [ ˆ φ ]([ x { } ]) = [ φ ]( W { } [ x { } ] + θ { } ) = [ y { } ] in which
$$\underline { y } _ { i } ^ { \{ \ell \} } = \sum \nolimits _ { j = 1 } ^ { n ^ { \{ \ell \} } } \underline { p } _ { i j } ^ { \{ \ell \} } + \theta _ { i } ^ { \{ \ell \} } \quad ( 1 9 )$$
$$\overline { y } _ { i } ^ { \{ \ell \} } = \sum \nolimits _ { j = 1 } ^ { n ^ { \{ \ell \} } } \overline { p } _ { i j } ^ { \{ \ell \} } + \theta _ { i } ^ { \{ \ell \} } \quad ( 2 0 )$$
with p { } ij and p { } ij defined by
$$\underline { p } _ { i j } ^ { \{ \ell \} } = \left \{ \begin{array} { l l } { \omega _ { i j } ^ { \{ \ell \} } \underline { x } _ { j } ^ { \{ \ell \} } , } & { \omega _ { i j } ^ { \{ \ell \} } \geq 0 } \\ { \omega _ { i j } ^ { \{ \ell \} } \overline { x } _ { j } ^ { \{ \ell \} } , } & { \omega _ { i j } ^ { \{ \ell \} } < 0 } \end{array} ( 2 1 )$$
$$\begin{array} { r } { \overline { p } _ { i j } ^ { \{ \ell \} } = \left \{ \begin{array} { l l } { \omega _ { i j } ^ { \{ \ell \} } \overline { x } _ { j } ^ { \{ \ell \} } , } & { \omega _ { i j } ^ { \{ \ell \} } \geq 0 } \\ { \omega _ { i j } ^ { \{ \ell \} } \underline { x } _ { j } ^ { \{ \ell \} } , } & { \omega _ { i j } ^ { \{ \ell \} } < 0 } \end{array} . ( 2 2 ) } \end{array}$$
Proof . We denote ˆ φ ( x { } ) = φ ( W { } x { } + θ { } ) . For a feedforward neural network, it essentially has x { } = ˆ φ -1 ( x { -1 } ) , = 1 , . . . , L which leads to (18). Then, for each layer, the interval extension [ y { } ] computed by (19)(22) can be obtained directly from (14)-(17).
We denote the set image for neural network Φ as follows
$$\Phi ( [ x ^ { \{ 0 \} } ] ) = \{ \Phi ( x ^ { \{ 0 \} } ) \colon x ^ { \{ 0 \} } \in [ x ^ { \{ 0 \} } ] \} . \quad ( 2 3 )$$
Since [Φ] is inclusion monotonic according to Theorem 4.1, one has Φ([ x { 0 } ]) ⊆ [Φ]([ x { 0 } ]) . Thus, it is sufficient to claim the neural network is safe if [Φ]([ x { 0 } ]) ∩¬S = ∅ holds by Lemma 3.1.
According to the explicit expressions (18)-(22), the computation on interval extension [Φ] is fast. In the next step, we should discuss the conservativeness for the computation outcome of (18). We have [Φ]([ x { 0 } ]) = Φ([ x { 0 } ]) + E ([ x { 0 } ]) for some interval-valued function E ([ x { 0 } ]) with w ([Φ]([ x { 0 } ])) = w (Φ([ x { 0 } ])) + w ( E ([ x { 0 } ])) .
Definition 4.3 We call w ( E ([ x { 0 } ])) = w ([Φ]([ x { 0 } ])) -w (Φ([ x { 0 } ])) the excess width of interval extension of neural network Φ([ x { 0 } ]) .
Explicitly, the excess width measures the conservativeness of interval extension [Φ] regarding its corresponding function Φ . The following theorem gives the upper bound of the excess width w ( E ([ x { 0 } ])) .
Theorem 4.3 Consider feedforward neural network (5) with an interval input [ x { 0 } ] , the excess width w ( E ([ x { 0 } ])) satisfies
$$w ( E ( [ x ^ { \{ 0 \} } ] ) ) \leq \gamma w ( [ x ^ { \{ 0 \} } ] ) \quad ( 2 4 )$$
where γ = ξ L ∏ L =1 ∥ ∥ W { } ∥ ∥ .
Proof . We have [Φ]([ x { 0 } ]) = Φ([ x { 0 } ]) + E ([ x { 0 } ]) for some E ([ x { 0 } ]) and
$$\begin{array} { r l } & { w ( E ( [ x ^ { \{ 0 \} } ] ) ) = w ( [ \Phi ] ( [ x ^ { \{ 0 \} } ] ) ) - w ( \Phi ( [ x ^ { \{ 0 \} } ] ) ) } \\ & { \leq w ( [ \Phi ] ( [ x ^ { \{ 0 \} } ] ) ) } \\ & { \leq \xi ^ { L } \prod _ { \ell = 1 } ^ { L } \left \| W ^ { \{ \ell \} } \right \| w ( [ x ^ { \{ 0 \} } ] ) } \end{array}$$
which means (24) holds.
Given a neural network Φ which means W { } and ξ are fixed, Theorem 4.3 implies that a less conservative result can be only obtained by reducing the width of input interval [ x { 0 } ] . On the other hand, a smaller w ([ x { 0 } ]) means more subdivisions of an input interval which will bring more computational cost. Therefore, how to generate appropriate subdivisions of an input interval is the key for safety verification of neural networks in the framework of interval analysis. In the next section, an efficient specification-guided method is proposed to address this problem.
## 4.3 Specification-Guided Safety Verification
Inspired by the Moore-Skelboe algorithm [6], we propose a specification-guided algorithm, which generates fine subdivisions particularly with respect to specification, and also avoid unnecessary subdivisions on the input interval for safety verification, see Algorithm 1.
The implementation of the specification-guided algorithm shown in Algorithm 1 checks that the intersection between output set and unsafe region is empty, within a pre-defined tolerance ε . This is accomplished by dividing and checking the initial input interval into increasingly smaller sub-intervals.
- Initialization. Set a tolerance ε > 0 . Since our approach is based on interval analysis, convert input set X to an interval [ x ] such that X ⊆ [ x ] . Compute the initial output interval [ y ] = [Φ]([ x ]) . Initialize set M = { ([ x ] , [ y ]) } .
- Specification-guided bisection. This is the key in the algorithm. Select an element ([ x ] , [ y ]) for specificationguided bisection. If the output interval [ y ] of sub-interval [ x ] has no intersection with the unsafe region, we can discard this sub-interval for the subsequent dividing and checking since it has been proven safe. Otherwise, the bisection action will be activated to produce finer subdivisions to be added to M for subsequent checking. The bisection process is guided by the given safety specification, since the activations of bisection actions are totally determined by the non-emptiness of the intersection between output interval sets and the given unsafe
Algorithm 1 Specification-Guided Safety Verification
```
Algorithm 1 Specification-Guided Safety Verification
Input: A feedforward neural network F : R n {0} -> R n {L} ,
an input set X ⊆ R n {0} , a safety specification S ⊆
R n {L} , a tolerance ε > 0
Output: Safe or Uncertain
1: x$_i ← min$_x ∈X (x$_i) , x$_i ← max$_x ∈X (x$_i)
2: [x] ← [x$_1, x$_1] × . . . , ×[x$_n {0} , x$_n {0}]
3: [y] ← [F]([x])
4: M ← {([x], [y])] }
5: while M # 0 do
6: Select and remove an element ([x] , [y]) from M
7: if [y] ∩ ¬S = 0 then
8: Continue
9: else
10: if w (x) > ε then
11: Bisect [x] to obtain [x$_1] and [x$_2]
12: for i = 1 : 1 : 2 do
13: if [x$_i] ∩ X # 0 then
14: [y$_i] ← [F]([x$_i])
15: M ← M ∪ {([x$_i], [y$_i])] }
16: end if
17: end for
18: else
19: return Uncertain
20: end if
21: Safety Verification
22: end if
23: end while
```
region. This distinguishing feature leads to finer subdivisions when the output set is getting close to the unsafe region, and on the other hand coarse subdivisions are sufficient for safety verification when the output set is far wary from the unsafe area. Therefore, unnecessary computational cost can be avoided. In the experiments section, it will be clearly observed how the bisection actions are guided by safety specification in a numeral example.
- Termination. The specification-guided bisection procedure continues until M = ∅ which means all subintervals have been proven safe, or the width of subdivisions becomes less than the pre-defined tolerance ε which leads to an uncertain conclusion for the safety. Finally, when Algorithm 1 outputs an uncertain verification result, we can select a smaller tolerance ε to perform the safety verification.
## 5 Experiments
## 5.1 Random Neural Network
To demonstrate how the specification-guided idea works in safety verification, a neural network with two inputs and two outputs is proposed. The neural network has 5 hidden layers, and each layer contains 10 neurons. The weight matrices and
Table 1: Comparison on number of intervals and computational time to existing approach
| | Intervals | Computational Time |
|-------------------|-------------|----------------------|
| Algorithm 1 | 4095 | 21.45 s |
| Xiang et al. 2018 | 111556 | 294.37 s |
bias vectors are randomly generated. The input set is assumed to be [ x { 0 } ] = [ -5 , 5] × [ -5 , 5] and the unsafe region is ¬S = [1 , ∞ ) × [1 , ∞ ) .
We execute Algorithm 1 with termination parameter ε = 0 . 01 , the safety can be guaranteed by partitioning [ x { 0 } ] into 4095 interval sets. The specification-guided partition of the input space is shown in Figure 1. A non-uniform input space partition is generated based on the specificationguided scheme. An obvious specification-guided effect can be observed in Figure 1. The specification-guided method requires much less computational complexity compared to the approach in [3] which utilizes a uniform partition of input space, and a comparison is listed in Table 1. The computation is carried out using Matlab 2017 on a personal computer with Windows 7, Intel Core i5-4200U, 1.6GHz, 4 GB RAM. It can be seen that the number of interval sets and computational time have been significantly reduced to 3.67% and 7.28%, respectively, compared to those needed in [3]. Figure 2 illustrates the union of 4095 output interval sets, which has no intersection with the unsafe region, illustrating the safety specification is verified. Figure 2 shows that the output interval estimation is guided to be tight when it comes close to unsafe region, and when it is far way from the unsafe area, a coarse estimation is sufficient to verify safety.
Figure 1: Specification-guided bisections of input interval by Algorithm 1. Guided by safety specification, finer partitions are generated when the output intervals are close to the unsafe region, and coarse partitions are generated when the output intervals are far wary.
<details>
<summary>Image 1 Details</summary>

### Visual Description
\n
## Partition Diagram: Partition of Input Space
### Overview
The image depicts a partition of a two-dimensional input space, likely representing the decision boundaries of a classification or regression model. The space is defined by two variables, x₁ and x₂, both ranging from approximately -5 to 5. The partition is visualized as a grid of rectangular regions, with some regions colored blue, indicating a specific classification or value assignment. The density of the blue regions suggests areas of higher concentration or importance.
### Components/Axes
* **Title:** "Partition of input space" (centered at the top)
* **X-axis Label:** "x₁ < 5" (bottom-center)
* **Y-axis Label:** "x₂ < 5" (left-center)
* **X-axis Range:** Approximately -5 to 5
* **Y-axis Range:** Approximately -5 to 5
* **Grid:** A rectangular grid covering the entire space.
* **Colored Regions:** Rectangular regions within the grid, with blue indicating a specific state.
### Detailed Analysis
The diagram shows a partitioning of the space into rectangular regions. The blue regions are not uniformly distributed. They appear to form two distinct, elongated clusters.
* **Cluster 1:** Located in the lower-left quadrant, extending from approximately x₁ = -4 to x₁ = 1 and x₂ = -2.5 to x₂ = 0. This cluster has a higher density of blue regions in the area around x₁ = -2 and x₂ = -1.5.
* **Cluster 2:** Located in the upper-right quadrant, extending from approximately x₁ = 0 to x₁ = 4 and x₂ = 1 to x₂ = 4. This cluster has a higher density of blue regions in the area around x₁ = 2 and x₂ = 2.5.
The remaining regions are not colored blue, suggesting they represent a different classification or value. The grid size appears to be relatively uniform, with rectangles approximately 0.5 x 0.5 units in size. The blue regions are composed of many small squares, indicating a fine-grained partitioning.
### Key Observations
* The blue regions are concentrated in two distinct areas, suggesting two primary classes or value ranges.
* The boundaries between the blue and non-blue regions are not smooth; they follow the grid lines, indicating a discrete partitioning scheme.
* The density of blue regions varies within each cluster, suggesting varying degrees of confidence or importance.
* There is a clear separation between the two clusters, with a relatively large region of non-blue rectangles in the center.
### Interpretation
This diagram likely represents the decision boundaries of a machine learning model, such as a decision tree or a random forest, applied to a two-dimensional dataset. The blue regions represent the areas where the model predicts a specific class or value. The partitioning into rectangular regions suggests that the model makes decisions based on simple thresholds for x₁ and x₂.
The two clusters indicate that the dataset contains two distinct groups of data points. The separation between the clusters suggests that the model is able to effectively discriminate between these groups. The varying density of blue regions within each cluster could indicate that some data points are more confidently classified than others.
The discrete nature of the partitioning suggests that the model may be prone to overfitting or that the input space has been discretized for simplification. The diagram provides a visual representation of the model's decision-making process, allowing for a qualitative assessment of its performance and behavior. The model appears to be sensitive to the values of x₁ and x₂ and makes decisions based on their relative magnitudes.
</details>
Figure 2: Output set estimation of neural networks. Blue boxes are output intervals, red area is unsafe region, black dots are 5000 random outputs.
<details>
<summary>Image 2 Details</summary>

### Visual Description
\n
## Scatter Plot: Output Set Estimation and Unsafe Region
### Overview
The image displays a scatter plot visualizing an output set estimation alongside an identified "unsafe region". The plot uses two axes, y1 and y2, to represent the data points. The majority of the plot area is filled with a dense cluster of black points, while a significant portion of the top-right quadrant is colored red, indicating the unsafe region. A blue background fills the remaining area.
### Components/Axes
* **Title:** "Output set estimation and unsafe region" (positioned at the top-center)
* **X-axis:** Labeled "y1", ranging approximately from -10 to 6. The scale appears linear.
* **Y-axis:** Labeled "y2", ranging approximately from -10 to 1. The scale appears linear.
* **Data Points:** A dense collection of black points scattered primarily in the lower-left portion of the plot.
* **Unsafe Region:** A rectangular area colored red, located in the top-right quadrant.
* **Background:** The remaining area is filled with a solid blue color.
### Detailed Analysis
The scatter plot shows a concentration of data points clustered around the origin, with a more complex distribution extending towards negative values of y1 and a limited range of y2 values.
* **Data Point Distribution:** The black points are densely packed between y1 = -8 and y1 = 0, and y2 = -10 and y2 = 0. There is a noticeable gap in data points in the upper-left quadrant.
* **Unsafe Region:** The red rectangle spans approximately from y1 = 1 to y1 = 6, and y2 = 0 to y2 = 1. This region is devoid of black data points.
* **Data Density:** The density of black points decreases as y1 increases beyond -2 and as y2 approaches 0.
* **Vertical Lines:** There are several vertical lines of points at y1 = 0, y1 = 1, y1 = 2, y1 = 3, and y1 = 4.
### Key Observations
* The data points are largely confined to the lower-left portion of the plot.
* The "unsafe region" (red rectangle) is clearly demarcated and contains no data points.
* The vertical lines of points suggest a discrete or quantized behavior in the data generation process.
* The data distribution appears non-uniform, with higher density in certain areas and gaps in others.
### Interpretation
This plot likely represents the output space of a system or model, where each point corresponds to a possible output. The "unsafe region" indicates a set of outputs that are undesirable or unacceptable. The concentration of data points in the lower-left quadrant suggests that the system tends to produce outputs within that range. The absence of data points in the unsafe region implies that the system is designed or constrained to avoid those outputs. The vertical lines could indicate specific operating conditions or parameter settings that lead to distinct output patterns.
The plot suggests a successful constraint or design that keeps the system's output away from the "unsafe region". Further investigation would be needed to understand the meaning of the axes (y1 and y2) and the nature of the system being modeled. The non-uniform distribution of data points might indicate biases or limitations in the system's behavior.
</details>
## 5.2 Robotic Arm Model
Figure 3: Robotic arm with two joints. The normal working zone of ( θ 1 , θ 2 ) is colored in green θ 1 , θ 2 ∈ [ 5 π 12 , 7 π 12 ] . The buffering zone is in yellow θ 1 , θ 2 ∈ [ π 3 , 5 π 12 ] ∪ [ 7 π 12 , 2 π 3 ] . The forbidden zone is θ 1 , θ 2 ∈ [0 , π 3 ] ∪ [ 2 π 3 , 2 π ] .
<details>
<summary>Image 3 Details</summary>

### Visual Description
\n
## Diagram: Robotic Arm Kinematics
### Overview
The image depicts a schematic diagram of a two-link robotic arm, illustrating its kinematic parameters. The diagram shows the arm anchored to a base, with two links (L1 and L2) connected by a joint. The end-effector's position is denoted by (x, y). The diagram also shows the angles θ1 and θ2, representing the joint angles. Yellow shaded regions indicate the workspace reachable by the end-effector.
### Components/Axes
* **Base:** The horizontal, textured gray area at the bottom of the diagram represents the base of the robotic arm.
* **Link 1 (L1):** The green line segment extending from the base to the first joint. L1 is labeled as having a length of 10 units.
* **Link 2 (L2):** The blue line segment extending from the first joint to the end-effector. L2 is labeled as having a length of 7 units.
* **Joint 1:** The red circle where Link 1 connects to the base.
* **Joint 2:** The red circle where Link 1 connects to Link 2.
* **End-Effector:** The red circle at the end of Link 2, with coordinates (x, y).
* **Angle θ1:** The angle between Link 1 and the vertical axis, measured at Joint 1.
* **Angle θ2:** The angle between Link 2 and the line connecting Joint 1 and Joint 2, measured at Joint 2.
* **Workspace:** The yellow shaded areas represent the reachable workspace of the end-effector.
* **Grid:** A faint grid pattern is visible in the background, providing a visual reference for position.
### Detailed Analysis
The diagram illustrates the forward kinematics of a 2R (two revolute joint) planar robotic arm. The lengths of the links are explicitly given: L1 = 10 and L2 = 7. The coordinates (x, y) represent the position of the end-effector, which is a function of the joint angles θ1 and θ2 and the link lengths. The yellow shaded areas represent the workspace, which is the set of all points that the end-effector can reach given the constraints of the link lengths and joint limits.
The diagram does not provide specific numerical values for x, y, θ1, or θ2. It is a conceptual illustration of the arm's geometry.
### Key Observations
* The workspace is limited by the link lengths. Shorter links result in a smaller workspace.
* The diagram shows the potential for multiple configurations of the arm to reach the same point in space (due to the overlapping yellow regions).
* The grid provides a visual scale, but no specific units are indicated.
### Interpretation
This diagram is a fundamental representation used in robotics to understand the relationship between joint angles and end-effector position. It demonstrates the concept of kinematic chains and the importance of link lengths and joint angles in determining the arm's reach and dexterity. The workspace visualization is crucial for task planning, ensuring that the robot can reach all necessary points within its environment. The diagram is a simplified model, neglecting factors such as link thickness, joint friction, and actuator limits, but it provides a valuable starting point for analyzing and controlling robotic arm movements. The diagram is a visual aid for understanding the mathematical equations that govern the arm's kinematics.
</details>
In [3], a learning forward kinematics of a robotic arm model with two joints is proposed, shown in Figure 3. The learning task is using a feedforward neural network to predict the position ( x, y ) of the end with knowing the joint angles ( θ 1 , θ 2 ) . The input space [0 , 2 π ] × [0 , 2 π ] for ( θ 1 , θ 2 ) is classified into three zones for its operations: normal working zone θ 1 , θ 2 ∈ [ 5 π 12 , 7 π 12 ] , buffering zone θ 1 , θ 2 ∈ [ π 3 , 5 π 12 ] ∪ [ 7 π 12 , 2 π 3 ] and forbidden zone θ 1 , θ 2 ∈ [0 , π 3 ] ∪ [ 2 π 3 , 2 π ] . The detailed formulation for this robotic arm model and neural network training can be found in [3].
The safety specification for the position ( x, y ) is S = { ( x, y ) | -14 ≤ x ≤ 3 and 1 ≤ y ≤ 17 } . The input set of the robotic arm is the union of normal working and buffering zones, that is ( θ 1 , θ 2 ) ∈ [ π 3 , 2 π 3 ] × [ π 3 , 2 π 3 ] . In the safety point of view, the neural network needs to be verified that all the outputs produced by the inputs in the normal working
zone and buffering zone will satisfy safety specification S . In [3], a uniform partition for input space is used, and thus 729 intervals are produced to verify the safety property. Using our specification-guided approach, the safety can be guaranteed by partitioning the input space into only 15 intervals, see Figure 4 and Figure 5. Due to the small number of intervals involved in the verification process, the computational time is only 0.27 seconds for specification-guided approach.
Figure 4: 15 sub-intervals for robotic arm safety verification.
<details>
<summary>Image 4 Details</summary>

### Visual Description
\n
## Diagram: Partition of Input Space
### Overview
The image depicts a grid-like partition of a two-dimensional input space. The space is defined by the ranges of two variables, x₁ and x₂, both constrained between π/3 and 2π/3. The diagram visually represents a division of this space into rectangular regions.
### Components/Axes
* **Title:** "Partition of input space" - positioned at the top-center of the image.
* **X-axis Label:** "π/3 < x₁ < 2π/3" - located at the bottom of the image. The axis ranges from approximately 1.1 to 2.0.
* **Y-axis Label:** "π/3 < x₂ < 2π/3" - located on the left side of the image. The axis ranges from approximately 1.1 to 2.0.
* **Grid Lines:** A series of horizontal and vertical blue lines create a grid, dividing the space into rectangular cells. The lines are evenly spaced.
### Detailed Analysis
The diagram shows a 6x6 grid. The x-axis is divided into six equal segments, with markers at approximately 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, and 2.0. The y-axis is similarly divided into six equal segments, with markers at approximately 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, and 2.0.
The grid is formed by the intersection of these horizontal and vertical lines. Each cell represents a specific region within the defined input space. The grid is symmetrical.
### Key Observations
The diagram does not contain any data points or values *within* the grid cells. It simply illustrates a partitioning of the input space. The grid is uniform, suggesting equal division of the space.
### Interpretation
This diagram likely represents a discretization of a continuous input space for some computational or analytical purpose. The partitioning could be used for:
* **Quantization:** Mapping continuous values of x₁ and x₂ to discrete grid cells.
* **Classification:** Assigning data points to specific regions based on their x₁ and x₂ values.
* **Sampling:** Selecting representative points from each grid cell for analysis.
* **Feature Engineering:** Creating new features based on the grid cell a data point falls into.
The fact that the ranges for both x₁ and x₂ are identical (π/3 to 2π/3) suggests that the two variables are treated equally in this partitioning scheme. The diagram itself doesn't reveal the *purpose* of this partitioning, only *how* it is done. It is a visual representation of a mathematical space being divided into discrete regions.
</details>
## 5.3 Handwriting Image Recognition
In this handwriting image recognition task, we use 5000 training examples of handwritten digits which is a subset of the MNIST handwritten digit dataset (http://yann.lecun.com/exdb/mnist/), examples from the dataset are shown in Figure 6. Each training example is a 20 pixel by 20 pixel grayscale image of the digit. Each pixel is represented by a floating point number indicating the grayscale intensity at that location. We first train a neural network with 400 inputs, one hidden layer with 25 neurons and 10 output units corresponding to the 10 digits. The activation functions for both hidden and output layers are sigmoid functions. A trained neural network with about 97.5% accuracy is obtained.
Under adversarial perturbations, the neural network may produce a wrong prediction. For example in Figure 7(a) which is an image of digit 2 , the label predicted by the neural network will turn to 1 as a 4 × 4 perturbation belonging to [ -0 . 5 , 0 . 5] attacks the left-top corner of the image. With our developed verification method, we wish to prove that the neural network is robust to certain classes of perturbations, that is no perturbation belonging to those classes can alter the prediction of the neural network for a perturbed image. Since there exists one adversarial example for 4 perturbations at the left-top corner, it implies this image is not robust to this class of perturbation. We consider another class of perturbations, 3 × 3 perturbations at the left-top corner, see Figure 7(b). Us-
Figure 5: Safety verification for neural network of robotic arm. Blue boxes are output intervals, red box are boundary for unsafe region, black dots are 5000 random outputs. 15 output intervals are sufficient to prove the safety.
<details>
<summary>Image 5 Details</summary>

### Visual Description
\n
## Scatter Plot: Output Set Estimation and Unsafe Region
### Overview
The image presents a scatter plot visualizing an output set estimation alongside an "unsafe region". The plot displays a dense cluster of points, seemingly representing data samples, within a defined coordinate system. A red rectangular boundary encompasses the majority of the points, while several smaller blue rectangles are overlaid within this region.
### Components/Axes
* **Title:** "Output set estimation and unsafe region" (positioned at the top-center)
* **X-axis:** Labeled "y₁", ranging approximately from -15 to 5. The scale appears linear.
* **Y-axis:** Labeled "y₂", ranging approximately from 1 to 20. The scale appears linear.
* **Data Points:** A dense collection of black dots scattered within the coordinate space.
* **Red Rectangle:** A large rectangular boundary encompassing most of the data points.
* **Blue Rectangles:** Multiple smaller rectangular boundaries overlaid on the data points, positioned within the larger red rectangle.
### Detailed Analysis
The scatter plot shows a concentration of data points forming a roughly triangular shape. The points are most dense in the upper-right portion of the plot and taper off towards the bottom-left.
* **Data Point Distribution:** The points are not uniformly distributed. They are clustered, suggesting a correlation between y₁ and y₂.
* **Red Rectangle:** The red rectangle spans from approximately y₁ = -15 to y₁ = 5 and from y₂ = 1 to y₂ = 17. It defines a boundary around the majority of the data points.
* **Blue Rectangles:** There are approximately 10-15 blue rectangles visible, varying in size and orientation. They are positioned within the red rectangle, seemingly highlighting specific sub-regions of the data. The rectangles do not appear to be aligned with the axes. Their placement seems somewhat random, but they are all contained within the larger red rectangle.
### Key Observations
* The data points exhibit a clear pattern, suggesting a non-linear relationship between y₁ and y₂.
* The red rectangle likely represents a defined "safe" or acceptable region for the output set.
* The blue rectangles may represent areas of uncertainty, potential risk, or specific sub-sets within the output set.
* There are no data points outside the red rectangle, indicating that all observed outputs fall within the defined boundary.
### Interpretation
The plot likely represents the results of a model or simulation where y₁ and y₂ are outputs. The "output set estimation" refers to the distribution of these outputs, visualized as the scatter plot. The "unsafe region" is implicitly defined as the area *outside* the red rectangle. The blue rectangles could represent areas where the model's predictions are less certain, or where the outputs are considered more sensitive to changes in input parameters.
The concentration of points suggests a strong relationship between y₁ and y₂. The absence of points outside the red rectangle indicates that the model consistently produces outputs within the defined bounds. The blue rectangles may be used to identify areas where further investigation or refinement of the model is needed.
The image does not provide numerical data, only a visual representation of the output set and its relationship to a defined "safe" region. The purpose of the visualization is to provide a qualitative assessment of the model's performance and identify potential areas of concern.
</details>
Figure 6: Examples from the MNIST handwritten digit dataset.
<details>
<summary>Image 6 Details</summary>

### Visual Description
\n
## Image: Handwritten Digit Grid
### Overview
The image presents a grid of handwritten digits, likely representing a sample dataset used for machine learning or character recognition tasks. The digits are arranged in a 10x10 grid. There are no axes, legends, or explicit labels beyond the digits themselves.
### Components/Axes
There are no axes or legends. The components are individual handwritten digits ranging from 0 to 9. The grid is organized into 10 rows and 10 columns.
### Detailed Analysis or Content Details
The image contains 100 handwritten digits. Here's a row-by-row transcription of the digits, with some uncertainty due to handwriting variations:
* **Row 1:** 1, 3, 2, 3, 3, 2, 2, 5, 7, 9
* **Row 2:** 8, 4, 4, 0, 0, 1, 2, 6, 5, 1
* **Row 3:** 6, 9, 6, 4, 8, 1, 5, 6, 3, 8
* **Row 4:** 6, 3, 3, 3, 2, 7, 3, 0, 1, 0
* **Row 5:** 9, 7, 4, 7, 3, 8, 9, 4, 6, 3
* **Row 6:** 2, 8, 5, 4, 0, 0, 1, 0, 8, 5
* **Row 7:** 4, 4, 5, 5, 6, 9, 0, 5, 9, 0
* **Row 8:** 5, 0, 9, 3, 5, 5, 5, 5, 5, 0
* **Row 9:** 2, 4, 5, 0, 0, 6, 0, 2, 9, 9
* **Row 10:** 1, 2, 6, 9, 0, 2, 6, 4, 4, 2
There is a noticeable variation in the style of handwriting across the digits. Some digits are clearly formed, while others are more ambiguous. For example, the '0' in row 2, column 5, and the '0' in row 7, column 7 are quite different in appearance.
### Key Observations
* All digits from 0 to 9 are present in the grid.
* The distribution of digits appears roughly uniform, although a precise count would be needed to confirm this.
* The handwriting quality varies significantly, which is typical of real-world handwritten data.
* Some digits are more easily recognizable than others. For example, '1', '7', and '9' tend to be more distinct, while '3', '5', and '8' can be more ambiguous.
### Interpretation
This image likely represents a sample of handwritten digits used for training or testing a machine learning model designed for optical character recognition (OCR). The variability in handwriting style is a crucial aspect of this type of dataset, as it forces the model to learn to generalize and recognize digits regardless of individual writing styles. The dataset's quality (clarity, consistency) directly impacts the performance of the OCR model. The presence of all digits suggests an attempt to create a balanced dataset. The image itself doesn't provide any information about the source of the data, the context in which it was collected, or the intended use of the OCR model. It is a raw data sample.
</details>
ing Algorithm 1, the neural network can be proved to be robust to all 3 × 3 perturbations located at at the left-top corner of the image, after 512 bisections.
Moreover, applying Algorithm 1 to all 5000 images with 3 × 3 perturbations belonging to [ -0 . 5 , 0 . 5] and located at the left-top corner, it can be verified that the neural network is robust to this class of perturbations for all images. This result means this class of perturbations will not affect the prediction accuracy of the neural network. The neural network is able to maintain its 97.5% accuracy even subject to any perturbations belonging to this class of 3 × 3 perturbations.
Figure 7: Perturbed image of digit 2 with perturbation in [ -0 . 5 . 0 . 5] . (a) 4 × 4 perturbation at the left-top corner, the neural network will wrongly label it as digit 1. (b) 3 × 3 perturbation at the left-top corner, the neural network can be proved to be robust for this class of perturbations.
<details>
<summary>Image 7 Details</summary>

### Visual Description
\n
## Image: Digit Perturbation Comparison
### Overview
The image presents a side-by-side comparison of two pixelated images, likely representing a handwritten digit (possibly a '7'). Each image shows the digit after being subjected to a different "perturbation" – a modification of the original pixel values. The goal appears to be to visualize the effect of different perturbation sizes on the digit's appearance.
### Components/Axes
The image consists of two sub-images, labeled:
* **(a) 4x4 perturbation** – Located on the left.
* **(b) 3x3 perturbation** – Located on the right.
There are no explicit axes or legends. The images themselves are grayscale pixel arrays.
### Detailed Analysis or Content Details
Both images depict a digit that strongly resembles a '7'. The digit is formed by varying shades of gray pixels against a dark background.
**Image (a) - 4x4 perturbation:**
The digit appears slightly more distorted and blocky compared to image (b). There's a noticeable dark area in the top-left corner, and a few darker pixels scattered along the upper curve of the '7'. The overall shape is still recognizable, but the edges are less smooth.
**Image (b) - 3x3 perturbation:**
This image shows a smoother, more refined representation of the '7'. The distortion is less pronounced than in image (a). The edges are more defined, and the dark areas are less prominent. The digit appears closer to a clean, unperturbed version.
It is impossible to extract numerical data from these images as they are visual representations only. There are no scales or values provided.
### Key Observations
* The 3x3 perturbation results in a less distorted image compared to the 4x4 perturbation.
* Larger perturbation sizes (4x4) introduce more noticeable artifacts and blockiness.
* Both perturbations still allow for the digit to be reasonably identified.
### Interpretation
The image demonstrates the impact of perturbation size on the visual quality of a digit image. Perturbation, in this context, likely refers to a process of adding noise or making small changes to the pixel values. A smaller perturbation (3x3) preserves the original shape more effectively, while a larger perturbation (4x4) introduces more significant distortions.
This type of visualization is relevant in the field of machine learning, particularly in the context of adversarial attacks. Adversarial attacks involve making small, carefully crafted perturbations to input data (like images) to fool a machine learning model. The image suggests that even relatively small perturbations can alter the appearance of an image, potentially leading to misclassification by a model.
The presence of darker pixels in the top-left corner of image (a) could indicate that the perturbation process is not uniform across the image, or that certain areas are more susceptible to distortion. The comparison highlights the trade-off between perturbation size and image quality – larger perturbations can introduce more significant changes, but may also make the image less recognizable.
The image does not provide any quantitative data, but it offers a qualitative understanding of how perturbation size affects the visual representation of a digit.
</details>
## 6 Conclusion and Future Work
In this paper, we introduce a specification-guided approach for safety verification of feedforward neural networks with general activation functions. By formulating the safety verification problem into the framework of interval analysis, a fast computation formula for calculating output intervals of feedforward neural networks is developed. Then, a safety verification algorithm which is called specification-guided is developed. The algorithm is specification-guided since the activation of bisection actions are totally determined by the existence of intersections between the computed output intervals and unsafe sets. This distinguishing feature makes the specification-guided approach be able to avoid unnecessary computations and significantly reduce the computational cost. Several experiments are proposed to show the advantages of our approach.
Though our approach is general in the sense that it is not tailored to specific activation functions, the specification-guided idea has potential to be further applied to other methods dealing with specific activation functions such as ReLU neural networks to enhance their scalability. Moreover, since our approach can compute the output intervals of a neural network, it can be incorporated with other reachable set estimation methods to compute the dynamical system models with neural network components inside such as extension of [3] to closed-loop systems [19] and neural network models of nonlinear dynamics [20].
## References
- [1] C. Szegedy, W. Zaremba, I. Sutskever, J. Bruna, D. Erhan, I. Goodfellow, and R. Fergus, 'Intriguing properties of neural networks,' in International Conference on Learning Representations , 2014.
- [2] G. Katz, C. Barrett, D. Dill, K. Julian, and M. Kochenderfer, 'Reluplex: An efficient SMT solver for verify-
3. ing deep neural networks,' in International Conference on Computer Aided Verification , pp. 97-117, Springer, 2017.
- [3] W. Xiang, H.-D. Tran, and T. T. Johnson, 'Output reachable set estimation and verification for multi-layer neural networks,' IEEE Transactions on Neural Network and Learning Systems , vol. 29, no. 11, pp. 5777-5783, 2018.
- [4] E. Clarke, O. Grumberg, S. Jha, Y. Lu, and H. Veith, 'Counterexample-guided abstraction refinement,' in International Conference on Computer Aided Verification , pp. 154-169, Springer, 2000.
- [5] N. Een, A. Mishchenko, and R. Brayton, 'Efficient implementation of property directed reachability,' in Proceedings of the International Conference on Formal Methods in Computer-Aided Design , pp. 125-134, FMCAD Inc, 2011.
- [6] S. Skelboe, 'Computation of rational interval functions,' BIT Numerical Mathematics , vol. 14, no. 1, pp. 87-95, 1974.
- [7] W. Xiang, H.-D. Tran, and T. T. Johnson, 'Reachable set computation and safety verification for neural networks with ReLU activations,' arXiv preprint arXiv: 1712.08163 , 2017.
- [8] T. Gehr, M. Mirman, D. Drachsler-Cohen, P. Tsankov, S. Chaudhuri, and M. Vechev, ' AI 2 : Safety and robustness certification of neural networks with abstract interpretation,' in Security and Privacy (SP), 2018 IEEE Symposium on , 2018.
- [9] R. Ehlers, 'Formal verification of piecewise linear feedforward neural networks,' in International Symposium on Automated Technology for Verification and Analysis , pp. 269-286, Springer, 2017.
- [10] A. Lomuscio and L. Maganti, 'An approach to reachability analysis for feed-forward ReLU neural networks,' arXiv preprint arXiv:1706.07351 , 2017.
- [11] S. Dutta, S. Jha, S. Sanakaranarayanan, and A. Tiwari, 'Output range analysis for deep neural networks,' arXiv preprint arXiv:1709.09130 , 2017.
- [12] S. Dutta, S. Jha, S. Sankaranarayanan, and A. Tiwari, 'Output range analysis for deep feedforward neural networks,' in NASA Formal Methods Symposium , pp. 121138, Springer, 2018.
- [13] L. Pulina and A. Tacchella, 'An abstraction-refinement approach to verification of artificial neural networks,' in International Conference on Computer Aided Verification , pp. 243-257, Springer, 2010.
- [14] L. Pulina and A. Tacchella, 'Challenging SMT solvers to verify neural networks,' AI Communications , vol. 25, no. 2, pp. 117-135, 2012.
- [15] M. Fr¨ anzle and C. Herde, 'HySAT: An efficient proof engine for bounded model checking of hybrid systems,' Formal Methods in System Design , vol. 30, no. 3, pp. 179-198, 2007.
- [16] X. Huang, M. Kwiatkowska, S. Wang, and M. Wu, 'Safety verification of deep neural networks,' in International Conference on Computer Aided Verification , pp. 3-29, Springer, 2017.
- [17] W. Ruan, X. Huang, and M. Kwiatkowska, 'Reachability analysis of deep neural networks with provable guarantees,' arXiv preprint arXiv:1805.02242 , 2018.
- [18] R. E. Moore, R. B. Kearfott, and M. J. Cloud, Introduction to interval analysis , vol. 110. Siam, 2009.
- [19] W. Xiang, D. M. Lopez, P. Musau, and T. T. Johnson, 'Reachable set estimation and verification for neural network models of nonlinear dynamic systems,' in Safe, Autonomous and Intelligent Vehicles , pp. 123-144, Springer, 2019.
- [20] W. Xiang, H. Tran, J. A. Rosenfeld, and T. T. Johnson, 'Reachable set estimation and safety verification for piecewise linear systems with neural network controllers,' in 2018 Annual American Control Conference (ACC) , pp. 1574-1579, June 2018.