{'fraction_non_alphanumeric': 0.039314061214196595, 'fraction_numerical': 0.006981497703803987, 'mean_word_length': 4.418092909535452, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 15, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Sensitive Samples Revisited: Detecting Neural Network Attacks Using Constraint Solvers

Neural Networks are used today in numerous security- and safety-relevant domains and are, as such, a popular target of attacks that subvert their classification capabilities, by manipulating the network parameters. Prior work has introduced sensitive samples -- inputs highly sensitive to parameter changes -- to detect such manipulations, and proposed a gradient ascent-based approach to compute them. In this paper we offer an alternative, using symbolic constraint solvers. We model the network and a formal specification of a sensitive sample in the language of the solver and ask for a solution. This approach supports a rich class of queries, corresponding, for instance, to the presence of certain types of attacks. Unlike earlier techniques, our approach does not depend on convex search domains, or on the suitability of a starting point for the search. We address the performance limitations of constraint solvers by partitioning the search space for the solver, and exploring the partitions according to a balanced schedule that still retains completeness of the search. We demonstrate the impact of the use of solvers in terms of functionality and search efficiency, using a case study for the detection of Trojan attacks on Neural Networks.


Introduction
Given recent advances in the field of Deep Learning, Neural Networks (DNN)-the preferred data structure for many learning tasks-are used today in numerous application areas, including security-and safety-relevant domains. Their use by unsuspecting end users increasingly makes them the target of attacks that manipulate (a small fraction of) the network parameters, attempting to override the decisionmaking functionality of the network, at least for some inputs. Examples include the hijacking of image recognition software for access control, and the misguidance of autonomous vehicles. Society has a vital interest in detecting these kind of attacks, in order to mitigate or prevent them. Inspired by recent work by He et al. [7], we consider in this paper the "cloud scenario": the defender is the designer of the network, with full access to all parameters and the training data. To facilitate widespread use, after training they deploy the network using some DNN inference cloud service, which can, however, ultimately not be trusted. They therefore wish to determine inputs, called sensitive samples [7], that are sensitive to parameter manipulations and thus able to distinguish the original, trusted network, N, from a manipulated one, N .
In the aforementioned recent work, a sensitive sample X * is defined as an input that maximizes the difference between N and N , resulting in an optimization problem. Provided the sample space is convex, X * can be found using (projected) gradient ascent (PGA). PGA is an efficient technique, but it is alsofrom a user perspective-somewhat demanding: in addition to the convexity of the sample space, we must compute the differential of the objective function, as well as the projection into the sample space, both of which can be numerically hard problems.

Defender Model and Problem Definition
In this work we assume there is a party called defender that has access to a trusted trained machine learning model N. The defender seeks to deploy N to some publicly available DNN query service, which we refer to here simply as the cloud, to be accessed by end users via a narrow DNN query API. The cloud provider has full access to the deployed model ("white-box"); the end user submits inputs to the service and retrieves a classification result in the form of probabilities for each class.
Further, there is a party known as attacker (often identical to the cloud provider) set to manipulating the numeric model parameters, i.e., the weights and biases, resulting in a new model N . The precise goals for such manipulation vary and include altering the network's functionality, for some inputs, e.g., using a Trojan attack [9]. As in prior work [7], we assume that the attacker does not manipulate N's hyper-parameters, e.g., by adding extra layers, or adding neurons to a layer.
We note that, once the defender has deployed the model N, they can access it only via the same narrow interface that is available to standard end users ("black-box"). That is, the details of N are unknown to them.
Problem definition. We address in this paper the following idealized problem for the defender. Given the network N and a type T of network attacks (such as Trojan attacks), determine a detection threshold β and an input X s called sensitive sample [7], such that the following holds for any potential cloud model N : if N and N disagree in their response to input X s by at mostβ , then N is not the result of an attack of type T against N. In addition, we typically want sample X s to be "similar" to the inputs given in the training set, so that the use of the sample by the defender to probe N does not trigger a "spy alarm" by the cloud provider, which could lead to non-uniform treatment of the defender, compared to other end users.
The idea is: if input X s gives rise to a difference of more thanβ , networks N and N disagree nontrivially, which must be reported, using witness X s . (For this to make sense, we cannot simply choosē β = 0; see Sec. 3.2.) Otherwise, we consider the cloud model uncompromised, as far as attacks of type T .
The above problem description is idealistic since it contains an implicit universal quantification over all models N compromised via a type-T attack. This results in a formula in the expensive (although in principle decidable) SMT theory of quantified non-linear real arithmetic (NRA). In this paper we approximate this problem, by determining an input X s that is a sensitive sample for a typical instantiation N of a type T -attacked network. This results in a more manageable formula in quantifier-free real arithmetic (QF-NRA). We then check the effectiveness of the sample thus obtained against other network instances. In general, however, we cannot guarantee the integrity of the cloud model in the "otherwise" case in the previous paragraph.

Symbolic Specifications of NNs and Sensitive Samples
Our method of choice to tackle the problem defined in the previous section is via logical constraint solvers. This requires formalizing the neural network (NN), the attack type, and the notion of sensitivity in the language of the solver. In the Technical Appendix, we give a background of NNs, plus the inner workings of a Trojan attack.

Fully-Connected Neural Networks
Consider an L-layer fully-connected NN, (see Technical Appendix, Sec. A.1). We formulate the linear function and subsequent non-linear activation function in each hidden layer l < L as linear combination: hidden layer activation: represent the parameters (weights and bias), the linear (pre-activation) output vector, and the activated output vector, respectively. To encode the linear-combination intermediate result Z in the SMT-Lib language [1], we declare it to be an uninterpreted real-valued constant, and then constrain it to be equal to a linear expression over the components of weights w i and previous-layer activation a i : (declare-const z_h Real) (assert (= z_h (+ (* w_1 a_1) (* w_2 a_2)...(* w_n a_n) bias))) For the activation in hidden layers, RELU is a typical choice. We define it in the SMT-Lib language relationally, as a function relu : R × R → {0, 1}: (define-fun relu ((z Real) (a Real)) Bool (= a (ite (<= z 0.0) 0.0 z))) ; intuitively, a = relu(z) For the purpose of adding queries to the encoded neural network, e.g., to retrieve a sensitive sample, we define the output of the network to be the logit computed by the pre-activation output function F, rather than the result of the output activation function σ , which can give rise to complex symbolic encodings. This is feasible because conditions over the final activated value σ (F(X,W )) can be translated "backwards" to conditions over the logit vector, Z [L] . For instance, if σ = sigmoid and we wish to constrain our sample to be classified as label t = 1 with probability at least 80%, we translate the condition σ (Z [L] ) ≥ 0.8 to the constraint Z [L] ≥ σ −1 (0.8) = 1.386 (σ −1 is called the logit function).

Sensitive Sample Queries
The sensitivity of a sample X, notated β , is measured by the deviation of its prediction when run on a tweaked model from its original prediction. Selecting some parameters of interest w ∈ W for study, Lee et al. define sensitivity as β = σ (X, w) − σ (X, w + δ ) , for some suitable norm · . A sensitive sample then is an input X * that maximizes this sensitivity assuming that the w have been tweaked by some δ : X * = argmax I σ (I, w) − σ (I, w + δ ) [7]. For this X * , its corresponding sensitivity β * is optimal.
In this paper, instead of solving an optimization problem, we determine input samples that give rise to a suitable "target sensitivity". Requiring this sensitivity to be positive is not enough: differences in the compiler, the computation environment, the available hardware and other unknowns (which impact the precise semantics of floating-point arithmetic [6]) will typically cause some deviations in the output between the client's platform and the cloud. In the absence of an attack, these deviations would show up as false positives. We therefore model floating-point vagaries using an application-dependent detection thresholdβ beyond which any observed sensitivity is blamed on the presence of an attack, while sensitivities below it are assumed to be harmless. We show later in our experiments that such deviations tend to be far smaller than differences due to an attack, making the two quite easily separable via a suitable detection threshold. Thus, an input X s witnesses the presence of an attack iff its sensitivity β s ≥β .
In contrast to PGA where the sensitivity of a sample is determined when a SS is retrieved, (if the model fails to converge, however, then no optimal SS is retrieved); in our approach, we set a threshold for the sensitivity first and determine whether we can find a satisfying assignment for our prescribed SS. In the following subsection we spell out an attack symbolically to determine a desired X s , displaying flexible specifications, leading to a case where we detect a Trojan attack.

Symbolically Encoding Sensitive Sample Conditions
Consider an attack on weight parameters whose goal is to manipulate the original value of some target logit Z and, consequently, to belie the prediction. In detecting this attack, we select w ∈ W on which we assume weight changes, δ . These w are referred to as the parameters of interest (POI) [7], selected based on knowledge about an attack, which are representative of the actual parameters that have been perturbed for detection. We specify the conditions for the sensitive sample as follows: The sensitive sample X s takes the form X s = X 0 +γ, where X 0 is a training sample modified by some suitable transform variablesγ. We distinguish the variable we seek for satisfiability from the rest of the parameters that the defender defines to bound the search with a hat; in the case of Eq. (1), these are the γ. While, the variables that are given or defined by the defender are: the training sample, X 0 ; the sample space S and additional constraints C; the DNN architecture, F(·); the trained weights, W ; the weight change vector δ applied to the POI and its assumed range of values; and the logit detection threshold ε, which sets the sensitivity of the sample that satisfies the detection threshold. We expound on these conditions further.
By constrainingγ to within a small radius around 0, we force the SS to be close to the training sample X 0 ; thereby, appear "natural", not artificial, to an input analyzer that may be used by the service provider to detect whether their inference is being monitored or tested. Prior work has used similar mechanisms to enforce similarity of the sensitive sample to the training data [7]. Moreover, the sample space S, which the SS is an element of, can be convex or non-convex, as can be the additional constraints C. Such constraints might state that the sample should be classified into a particular label by the network. Further, when X s is forward-propagated through the network, the output, expressed as a formula over the logit vector Z [L] , must of course agree with the network formula F(X s ,W ), a function of X s and W .
For our assumed tweaked model-F(X s ,W + δ ), a function of X s , the W and corresponding weightchange vector δ -we are assuming a reasonable range for the weight perturbations δ i (components of δ ) applied to the POI. The choice of POI and range of weight-change is attack-dependent. The actual weight deltas are not known to us, but we know the range of the trained weights. We can therefore get a sense of a plausible range of the deltas based on the nature of the attack (later we present suitable choices for the case of a Trojan attack). Note that we are expressing sensitivity in terms of the logits. We refer toε as the satisfying logit threshold, whose equivalent sensitivity (measured in terms of the output probability, by applying σ to the logits) satisfies the detection thresholdβ . In Sec. 5, we present an example to configure this metric that models sensitivity given a detection threshold.
So in a nutshell, we wish to solve forγ such that the sensitive sample X s captures a bandwidthε when the POI have been tweaked by δ . In the next specification where we take on a Trojan attack, the parameters assumed as placeholders take shape.

Detecting a Trojan Attack
After a Trojan attack, [9] observed that some weights from the target layer through the output layer will be inflated, causing a jump in the output towards the target masquerade t; while, the rest will be re-adjusted to compensate for the inflation, making the Trojanned model to behave like the original model when the trigger is absent. To devise sensitivity conditions to detect this attack, we translate these observations as a special configuration of Eq. (1), as explained in the following.
We detect whether our model has been Trojanned towards some label t, which we select for scrutiny. As POI for this attack, we choose the weights connected to the output layer (a similar strategy was employed in [7]); the weights from the target layer (which only the attacker knows) all the way up to just before the output layer are assumed unchanged. Among the POI, we let w L e be the weights expected to be inflated; while, the rest of the weights potentially deflated as w L d . That is: we assume positive weight deltas δ e > 0 applied to the former weights, and non-positive weight deltas δ d ≤ 0 applied to the latter. The corresponding activated neurons connected by these weights are A The perturbed logit, with the corresponding weight deltas, is given by Since a Trojan attack raises the prediction towards the target masquerade t in the presence of a trigger, we set the difference between the perturbed logit and the original logit to be positive and non-trivial, 1] ≥ε. This suggests that we model our sensitive sample to have a non-trivial net sensitivity on the possible weight perturbations that can occur among the POI in a Trojan attack. With this as sensitivity condition, the sensitive-sample specification from Eq. (1) becomes: In Sec. 5, we determine suitable values for these parameters that boundγ by detecting a real-world Trojan attack. But before that, we devise an algorithm to tackle scalability of this approach in the next section.

Improving Scalability using RELU Profiling
For non-trivial networks, the SMT models designed in Sec. 3 represent hard decision problems. In this section we get to the bottom of the complexity, and design an algorithm to improve the scalability.

Root-Cause Analysis: Scalability Bottleneck
We analyze the root cause of the scalability problems. As also observed in other work [8], the main culprit is the "branches" that each application of a RELU activation function represents: they cause the network model to be a piece-wise linear, rather than linear, mathematical function of the inputs. We can (vastly) underapproximate the SMT model for the sample query, by replacing each RELU activation function by either the identity or the constant-zero function-we say the RELU node is fixed as identity or fixed as zeroand simultaneously forcing the inputs to the function to be respectively non-negative or negative: ; id: R x R -> Boolean (define-fun id ((z Real) (a Real)) Bool (and (>= z 0) (= a z))) ; z >= 0 and a = z ; zero: R x R -> Boolean (define-fun zero ((z Real) (a Real)) Bool (and (< z 0) (= a 0)) ; z < 0 and a = 0 Performing this replacement on one RELU node roughly cuts the solution space for the solver to explore in half. We now design an algorithm for more efficient sensitive-sample search exploiting these insights, and demonstrate its impact in Sec. 5.

Greedy ReLU Branch Exploration using Decision Profiling
Solving a query for a sample input intuitively requires exhaustively exploring all combinations of branch decisions that the RELU nodes might make-RELU combinations for short-for a given input. The number of such combinations is, of course, exponential in the number of RELU nodes, resulting in poor scalability. A key idea, however, is that we are free to choose the order in which the combinations are examined. An optimistic approach might try first RELU combinations that are deemed "more likely" to permit a satisfying assignment, easier to solve for short. Completeness of this approach can be guaranteed by exploring harder to solve combinations later, rather than discarding them.
But what makes one RELU combination easier than others? We borrow here the idea of branch prediction done by runtime-optimizing compilers: As the owner of the network model and the training data used to obtain it, we can perform an inexpensive decision profiling step, which determines, for each RELU node, how often it acts as the identity function, and how often as the zero function, measured over the training data. We call the larger of these two numbers, as a percentage of the training data size, the decision bias, d-bias for short, of a RELU node: a large d-bias towards "identity" suggests the node acts more often as the identity function than as the zero function. The table above illustrates, for a toy network of two hidden layers with 5 neurons each and a dataset of 1000 inputs, the number if times a RELU node acted as identity or as zero, the direction of the bias, and the d-bias value (formally defined in (3) below).
Since the sensitive samples are designed to be (slight) perturbations of the training data, we expect it to be beneficial to assume that the RELU nodes exhibit a branching behavior similar to that over the training data. We say a RELU node has been fixed if it has been fixed according to its d-bias (ties resolved in some arbitrary but deterministic way). To unfix a (fixed) RELU node means to reinstate the RELU function, in place of the identity or zero function that it had been replaced with.
Equipped with these definitions, we deem a RELU combination easier to solve than another if the RELU nodes that have been fixed in the former form a superset of those fixed in the latter. Additionally, we sort the RELU nodes according to their d-bias and use this ordering to make RELU combinations easier to solve. The motivation is that fixing a RELU node with a large d-bias is more likely to preserve many satisfying solutions than fixing a RELU node with a small d-bias (near 50%).
To formalize these ideas, let (X 1 , . . . , X k ) be an input to the network. Consider a neuron j, and let Z j be the function that computes the pre-activation value of the neuron, i.e., the input to the RELU function at j. (The output computed at j is therefore A j = RELU(Z j (X 1 , . . . , X k )).) We say j acts as identity on (X 1 , . . . , X k ) if Z j (X 1 , . . . , X k ) ≥ 0; otherwise j acts as zero on this input. For a set X of network inputs (such as a training set), the d-bias of neuron j (a number in [0.5, 1]) is defined as d-bias( j) = max |{(X 1 , . . . , X k ) ∈ X : Z j (X 1 , . . . , X k ) ≥ 0}|, |{(X 1 , . . . , X k ) ∈ X : Z j (X 1 , . . . , X k ) < 0}| / |X| .
Alg. 1 implements the RELU-aware search strategy we sketched above. It takes as input a NN model F(X s ,W ) along with a training data set X, and a formula φ over the model inputs X 1 , . . . , X k . Formula φ typically encodes some kind of condition for an input that we are trying to find, e.g., the condition of X 1 , . . . , X k being a sensitive sample for F(X s ,W ). The algorithm begins by computing the d-biases of all RELU nodes over the training set. It then fixes each RELU node according to its d-bias, i.e., it replaces, in φ , each RELU activation function by the identity or the zero function, depending on the direction of the bias.
If the modified formula φ , which represents an underapproximation of the original φ , permits a solution, this solution is genuine, and we return it. Otherwise, we have to weaken the formula, by unfixing one of the fixed RELU nodes. Here we unfix nodes with small d-bias first: a small bias means the predictive power of the decision profiling is weak, so unfixing this node may re-enable many solutions. This order heuristic is implemented via the sorting step in Line 3; ties are resolved arbitrarily.
Algorithm 1 Greedy RELU branch exploration using decision profiling Input: network model F(X s ,W ), training data X, formula φ Output: a model input X 1 , . . . , X k satisfying φ , if one exists; otherwise "unsat" 1: compute the d-biases of all RELU nodes in F(X s ,W ) w.r.t. data set X 2: in φ , fix each RELU node according to its d-bias 3: sort the RELU nodes in F(X s ,W ) in order of increasing d-bias: A 1 , . . . , A l 4: for j := 1 to l do 5: if there exists X 1 , . . . , X k : (X 1 , . . . , X k ) |= φ then 6: return "solution: X 1 , . . . , X k " 7: unfix RELU node A j 8: return "unsat" We emphasize that we have merely used heuristics to determine the order in which different RELU combinations are searched. Theoretical completeness of the algorithm is not affected, since all combinations are, in the worst case, examined. If we were to pass φ directly to the SMT solver, we would leave it to the solver to examine these combinations, oblivious to the information offered by the profiling data.

Evaluation
We conducted experiments to retrieve samples sensitive against a Trojan attack, as motivated in Sec. 3.2.2, and checked their effectiveness in detecting the attack. We then assessed the scalability of the technique to larger networks, both without and with Alg. 1. We used Microsoft's Z3 as SMT solver. The experiments were run on an Intel Core i7-10750H CPU at 2.60GHz and 16GB of RAM.

Victim Network
Our benchmarks for detecting a Trojan attack come from the Belgium Traffic Signs dataset [11, https: //btsd.ethz.ch/shareddata]. We re-sized the images to 14x14 pixels and turned them grayscale. We trained a fully-connected NN of dimensions 30x20x10x1 to identify whether a traffic sign indicates a speed limit (label 0) or STOP (label 1). For this mini-image classification task, this NN-despite being small-has 100% validation accuracy, precision, and recall.

Configuring the parameter space
We partition the sensitive-sample parameter space into attack parameters and sample parameters. Our configuration was defined independently of the attack simulation.
Attack parameters. They model the Trojan attack and include the following: Assumed target masquerade, t: STOP-sign label.
POI, w ∈ W : weights attached to the output layer.
Weight deltas, δ : We assume the top weights, in terms of value, to be inflated and few, since the attack is supposedly stealthy; the rest are assumed potentially deflated, (i.e., non-positive delta Sample parameters. They include the sample space and the detection threshold. We further added as constraint the predicted label of the sample on the original model. Sample space: In order to make the sensitive sample appear like a regular input, we randomly picked a speed limit sign X 0 from the test data (see Fig. 1 (left)) and added transform variables,γ, over the entire region of the pixel dimensions. The SS is the pointwise sum of the pixel values of X 0 and the assignment to the transform variables.
Predicted output label: We explicitly required that the originally predicted output label remain as a speed limit sign even after the SS transformation.
Detection threshold,β , and the satisfying logit threshold,ε: We first stipulated a detection threshold that is significant to warrant weight perturbations: we setβ = 0.01; that is, a sensitivity of 1 percentage point in probability output or more is attributed to an attack in model parameters. Based on this requirement, we determinedε by computing the initial logit and then setting a satisfying logit threshold. By forward propagation on the original network, we computed the logit of the random sample X 0 to be Z [4] = −4.8510. In this experiment, we setε = 1, which models a tweaked logit Z [4] ≥ −3.8510. The corresponding modeled sensitivity under this setting is β ≥ 0.0131, which satisfies the detection threshold.

Effectiveness of SS
After solving for the transform values, we tested the obtained sensitive sample in detecting the Trojanned model. We deem the sample effective if the observed sensitivity is at least the detection threshold. If it is below, this would be a false negative. Furthermore, to assess the possibility of false positives, we subjected the original model to minor perturbations as they may occur "innocently" on the cloud. Concretely, we compared the prediction of the sensitive samples on a version where model parameters are originally stored in float16 precision to one where the parameters are stored in float32. If the sensitivity to such innocent perturbations (SIP) remains below the detection threshold, then the sample does not represent a false positive.

Results
Naive approach: This approach passes Eq. (2) to the SMT solver (w/o Alg. 1). After solving for the transform variables (which took about one minute), we obtained the sample shown in Fig. 1 (right): it has a sensitivity of β = 0.0744 (summarized in the first row of Table 2 in the Appendix). This sensitivity means that the prediction of the Trojanned model is 7.44 percentage points away from the original prediction. Moreover, given SIP = 7.41E-06, the sample does not exhibit a false positive. Scaling of (2) to larger networks: Sec. B of the Technical Appendix shows results of attempting to scale the naive approach to larger networks. Sec. C shows raw size data for various SMT encodings.
Employing Alg. 1: We allotted 20/60/120sec as the increasing time per iteration of the for loop in Line 4, before the algorithm moves on to the next RELU combination. This reflects the greedy character of the algorithm: we want to first try many instantiations of RELU nodes as "identity" or "zero", believing that one of them will give us a solution. If this approach fails, we increase the time allotment per iteration. This serves the goal of delaying advancing to later iterations, with fewer fixed RELU nodes, as much as possible, which eventually degenerates the algorithm to one that simply has the solver explore the many RELU combinations. In Table 1, the iteration number where a satisfying assignment was finally found is given in column "iter. #". Small numbers here indicate success of the philosophy purported by Alg. 1. Column "runtime" shows the total time it took to find a satisfying assignment, i.e., the sum across all iterations, for a respective iteration timeout of 20/60/120sec. If a solution is found for an iteration timeout of 20sec, one would normally stop the algorithm. In order to evaluate scalability, we include results for larger time allotments. But despite the extension, the solver wounded up with the same result as with the initial allocation.  Comparison naive approach/Alg. 1: Consider the case of the 30x20x10x1 NN model. Alg. 1 found a satisfying assignment in iteration #6. This means that the activation functions of five neurons-those with the smallest d-bias-were freed from their fixed instantiation to the identity or zero functions, and reverted to exact RELU semantics. This combination yielded a sensitivity of 12.34 percentage points, a higher sensitivity than the solution found by the naive approach. The time reported for Alg. 1's 20s/iter. run (111s) is larger though. This is not surprising, since Alg. 1 "wastes" five SMT runs. In fact, the motivation for using this algorithm is not to find solutions in "easy" cases faster. It is, instead, to increase scalability to larger models. Indeed, Alg. 1 was able to solve all models except the 90x60x30x1 case, while the naive approach timed out for most.
Presently, the method is not able to handle deeper and larger networks, such as state-of-the-art convolutional neural networks. Nevertheless, the DNN models that we presented are valid networks; we showed that SMT solvers can be used for such NN queries, e.g., sensitive-sample generation, when appropriately formalized. To deal with the complexity of DNNs, research has been conducted into dedicated theories for NN queries, e.g., Reluplex [8]. Using a dedicated solver may potentially address the scalability issue further: we first use Alg. 1 to eliminate some ReLU nodes, (e.g. the ones with high bias), while others are left in. For those left in, Reluplex can be applied. The investigation of this possibility can be picked up in future work.

Related Work
This work was inspired by the sensitive-sample fingerprinting technique proposed by He et al. [7], which uses classic machine learning techniques based on (projected) gradient ascent to determine sensitive samples. This is very efficient, but requires a starting point for the search and a convex solution space. Lack of convexity can lead to sub-optimality or, worse, failure to converge. The goal here was to solve a similar problem, but bring the flexibility of symbolic constraint solvers to bear: we can specify any search space and sample conditions, as long as they are definable in the underlying logic. However, definability does not imply efficient processibility, which is why Sec. 4 presents an algorithm for improved satisfiability checking.
Solving an optimization problem, the gradient-based technique returns samples that maximize the sensitivity. The authors conclude that any output discrepancy confirms the presence of an attack ("guarantee[s] zero false positives" [7]). As discussed in Sec. 3.2, this is not quite true: due to platformdependencies of floating-point computations [6], DNN model inference is not deterministic. We address this problem using an empirical non-zero sensitivity detection threshold (Sec. 2).
Using symbolic techniques in deep learning is still a relatively young area; examples include [5,12]. The Reluplex SMT solver [8] introduces a theory of real arithmetic extended by the RELU function as a primitive operation. We can view our greedy Alg. 1 as an alternative dedicated way of handling RELU nodes. A stand-alone comparison of both methods is left for future work.
Our method needs to be instantiated for different attack types (to avoid an unrealistic universal quantification over "all" adversarial models). We have focused on Trojan attacks, a survey can be found in [10]. Strategies for formalizing other types of DNN attacks are left as future work. "Fingerprinting", using inputs characteristic of model manipulations, is one way of detecting such attacks; there are others. For instance, we can conclude the model has been compromised if, for some class, the minimal trigger that causes a misclassification is substantially smaller than for other classes and thus is likely supported by a Trojan [13]. In that approach, the defender does not need access to the trusted model or the training data. The approach is designed specifically for backdoor-style attacks relying on a trigger. Other methods perform statistical analyses, e.g., determining the probability distribution of potential triggers [3] or of prediction results under perturbations [4]. Such analyses may not be realistic in a cloud environment.

Summary
We revisited the technique of retrieving sensitive samples in detecting NN attacks. A previous approach solves an optimization problem, using an efficient projected gradient-based search, in order to find the optimal sensitivity [7], which faces, however, various technical preconditions and is somewhat rigid. Our approach performs the search via a symbolic constraint solver. This permits a flexible specification of desirable features of the sample. We argue that a sample need not be optimal to be effective, as long as its sensitivity is above a threshold that delineates it from innocent perturbations that can occur upon upload of the NN model to the cloud. This alternative comes with the price of efficiency, however. To address scalability, we devised a greedy algorithm that searches through all possible combinations of the ReLU node behaviors in an "easiest-first" order. This algorithm has applications in symbolic NN analysis beyond sensitive-sample search. Future work includes investigating the performance impact of using dedicated solvers for NN queries, such as Reluplex [8].
regression. Given parameters W (a matrix of weights and biases), each layer consists of a linear function l i over the layer's inputs and its weight parameters, and a subsequent non-linear activation function f i . Function l i is a simple dot product, translated by the bias, for a fully-connected layer. The activation for inner layers is typically implemented via the rectified linear unit, defined as RELU(b) = max{b, 0}. The activated values become the inputs of the next layer. The result of the final linear function, known as logit, i.e., computed at the output layer, is passed to a special activation function σ . For a binary classification task, the output activation is typically a sigmoid function; for a multi-label classification, it is a softmax function. Output y is then a set of probabilities indicating which among the labels the input X most likely belongs to. For a regression task, the output activation is a linear function, which yields an output over the real numbers. Thus given a network of L layers, we summarize the function computed by the NN as X,W )) . . .))) = σ (F(X,W )), where F denotes the pre-activation output, i.e., the logit value computed for input X.

A.2 Trojan Attack on Neural Networks
A Trojan attack on NN perturbs model parameters in order to cause a misclassification towards a target label on inputs with an embedded trigger; the modified network is said to be Trojanned. But, when the Trojanned model is presented with inputs without the trigger, the prediction is unchanged. This makes the attack hard to detect by unsuspecting users.
There are three steps to Trojan a neural network (see figure on the right, taken from [9]). The attacker is assumed to be able to modify the model parameters. First, the attacker generates a Trojan trigger, which is a snippet embedded to a test input that excites certain neurons so that the prediction is skewed towards a target masquerade. This trigger is initialized with a mask or shape. [9] suggests that the target layer from which to establish a link with the trigger is somewhere near the middle layer, wherein the neurons that are most connected are selected.
The authors define weight connection of a neuron as the L1-norm of the weights connected to the neuron from the previous layer. The values of the initialized trigger are set by optimizing the activation values of the select neurons to intended values, supposedly large. This establishes a strong connection between the trigger and the select neurons, so that in the presence of the former the latter have strong activations, which would influence the model prediction.
After generating the trigger, the attacker stamps it to some training samples for each of the output labels, wherein the label for all these stamped samples is the target masquerade. If the attacker does not have access to the training data, they can generate the latter by model inversion. The batch of samples to be used for retraining the NN would consist of both unstamped and stamped samples. This last step of retraining the original NN Trojans the network, such that the weights are re-adjusted so that the new model predicts the target masquerade whenever the trigger is present in a test input, but predicts normally when absent, making the attack stealthy.

B Scalability of naive sample search via SMT
Using the same training data and basic network architecture, we trained larger networks, by expanding the layer sizes. We then simulated a Trojan attack on each of these. In order to assess scalability, we kept all SS parameters as set earlier. (In practice, one might determine individual SS parameters for each network.) Although we were able to transform sensitive samples in some networks, Table 2 shows the poor scaling of the naive approach to larger networks, especially where the size of the layers close to the output increases.

C Raw size data for encodings of various networks
To convey an idea of the raw complexity of the SMT approach, Table 3 shows various size data of the network models and the SMT encoding (2)