S PAN R ECOVERY FOR D EEP N EURAL N ETWORKS WITH A PPLICATIONS TO I NPUT O BFUSCATION
Anonymous authors
Paper under double-blind review
A BSTRACT
The tremendous success of deep neural networks has motivated the need to better understand the fundamental properties of these networks, but many of the theoretical results proposed have only been for shallow networks.
In this paper, we study an important primitive for understanding the meaningful input space of a deep network: span recovery .
For k < n , let A ∈ R k × n be the innermost weight matrix of an arbitrary feed forward neural network M : R n → R , so M ( x ) can be written as M ( x )
=
σ ( A x ) , for some network σ : R k
→ R .
The goal is then to recover the row span of A given only oracle access to the value of M ( x ) .
We show that if M is a multi-layered network with ReLU activation functions, then partial recovery is possible: namely, we can provably recover k/ 2 linearly independent vectors in the row span of A using poly ( n ) non-adaptive queries to M ( x ) .
Furthermore, if M has differentiable activation functions, we demonstrate that full span recovery is possible even when the output is ﬁrst passed through a sign or 0 / 1 thresholding function; in this case our algorithm is adaptive.
Empirically, we conﬁrm that full span recovery is not always possible, but only for unrealistically thin layers.
For reasonably wide networks, we obtain full span recovery on both random networks and networks trained on MNIST data.
Furthermore, we demonstrate the utility of span recovery as an attack by inducing neural networks to misclassify data obfuscated by controlled random noise as sensical inputs.
I NTRODUCTION
Consider the general framework in which we are given an unknown function f : R n → R and we want to learn properties about this function given only access to the value f ( x ) for different inputs x .
There are many contexts where this framework is applicable, such as blackbox optimization in which we are learning to optimize f ( x ) (Djolonga et al., 2013), PAC learning in which we are learning to approximate f ( x ) (Denis, 1998), adversarial attacks in which we are trying to ﬁnd adversarial inputs to f ( x ) (Szegedy et al., 2013), or structure recovery in which we are learning the structure of f ( x ) .
For example in the case when f ( x ) is a neural network, one might want to recover the underlying weights or architecture (Arora et al., 2014; Zhang et al., 2017).
In this work, we consider the setting when f ( x ) =
M ( x ) is a neural network that admits a latent low-dimensional structure, namely M ( x ) =
σ ( A x ) where A ∈ R k × n is a rank k matrix for some k < n , and σ : R k
→ R is some neural network.
In this setting, we focus primarily on the goal of recovering the row-span of the weight matrix A .
We remark that we can assume that A is full-rank as our results extend to the case when A is not full-rank.
Span recovery of general functions f ( x )
=
g ( A x ) , where g is arbitrary, has been studied in some contexts, and is used to gain important information about the underlying function f .
By learning Span ( A ) , we in essence are capturing the relevant subspace of the input to f ; namely, f behaves identically on x as it does on the projection of x onto the row-span of A .
In statistics, this is known as effective dimension reduction or the multi-index model Li (1991); Xia et al.
Another important motivation for span recovery is for designing adversarial attacks .
Given the span of A , we compute the kernel of A , which can be used to fool the function into behaving incorrectly on inputs which are perturbed by vectors in the kernel.
Speciﬁcally, if x is a legitimate input correctly classiﬁed by f and y is a large random vector in the kernel of A , then x + y will be indistinguishable from noise but we will have f ( x ) =
f ( x + y ) .
Several works have considered the problem from an approximation-theoretic standpoint, where the goal is to output a hypothesis function (cid:101) f which approximates f well on a bounded domain.
For instance, in the case that A ∈ R n is a rank 1 matrix and g ( A x ) is a smooth function with bounded derivatives, Cohen et al.
(2012) gives an adaptive algorithm to approximate f .
Their results also give an approximation (cid:101) A to A , under the assumption that A is a stochastic vector ( A i ≥ 0 for each i and (cid:80) i
A i = 1 ).
Extending this result to more general rank k matrices A ∈ R k × n , Tyagi &
Cevher (2014) and Fornasier et al.
(2012) give algorithms with polynomial sample complexity to ﬁnd approximations (cid:101)
f to twice differentiable functions f .
However, their results do not provide any guarantee that the original matrix A itself or a good approximation to its span will be recovered.
Speciﬁcally, the matrix (cid:101) A used in the hypothesis function (cid:101) f
( x ) = (cid:101) g ( (cid:101)
A x ) of Tyagi & Cevher (2014) only has moderate correlation with the true row span of A , and always admits some constant factor error (which can translate into very large error in any subspace approximation).
Furthermore, all aforementioned works require the strong assumption that the matrix of gradients is well-conditioned (and full rank) in order to obtain good approximations (cid:101) f .
In contrast, when f ( x ) is a non-differentiable ReLU deep network with only mild assumptions on the weight matrices, we prove that the gradient matrix has rank at least k/ 2 , which signiﬁcantly strengthens span recovery guarantees since we do not make any assumptions on the gradient matrix.
Finally, Hardt & Woodruff (2013) gives an adaptive approximate span recovery algorithm with poly ( n ) samples under the assumption that the function g satisﬁes a norm-preserving condition, which is restrictive and need not (and does not) hold for the deep neural networks we consider here.
On the empirical side, the experimental results of Tyagi & Cevher (2014) for function approximation were only carried out for simple one-layer functions, such as the logistic function in one dimension (where A has rank k = 1) , and on linear functions g T ( A x + b ) , where g ∈ R k has i.i.d.
Gaussian entries.
Moreover, their experiments only attempted to recover approximations (cid:101)
A to A when A was orthonormal.
In addition, Fornasier et al.
(2012) experimentally considers the approximation problem for f when f ( A x ) is a third degree polynomial of the input.
This leaves an experimental gap in understanding the performance of span recovery algorithms on non-smooth, multi-layer deep neural networks.
When f ( x ) is a neural network, there have been many results that allow for weight or architecture recovery under additional assumptions; however nearly all such results are for shallow networks.
Arora et al.
(2014) shows that layerwise learning can recover the architecture of random sparse neural networks.
Janzamin et al.
(2015) applies tensor methods to recover the weights of a two-layer neural network with certain types of smooth activations and vectorvalued output, whereas Ge et al.
; Bakshi et al.
(2019) obtain weight recovery for ReLU activations.
Zhang et al.
(2017) shows that SGD can learn the weights of two-layer neural networks with some speciﬁc activations.
There is also a line of work for improperly two-layer networks, where the algorithm outputs an arbitrary hypothesis function which behaves similarly to the network under a ﬁxed distribution (Goel et al., 2017; Goel & Klivans, 2019).
Learning properties of the network can also lead to so-called model extraction attacks or enhance classical adversarial attacks on neural networks (Jagielski et al., 2019).
Adversarial attacks are often differentiated into two settings, the whitebox setting where the trained network weights are known or the blackbox setting where the network weights are unknown but attacks can still be achieved on external information, such as knowledge of the dataset, training algorithm, network architecture, or network predictions.
Whitebox attacks are well-studied and usually use explicit gradients or optimization procedures to compute adversarial inputs for various tasks such as classiﬁcation and reinforcement learning (Szegedy et al., 2013; Huang et al., 2017; Goodfellow et al., 2014).
However, blackbox attacks are more realistic and it is clear that model recovery can enhance these attacks.
The work of Papernot et al.
(2017) attacks practical neural networks upon observations of predictions of adaptively chosen inputs, trains a substitute neural network on the observed data, and applies a whitebox attack on the substitute.
This setting, nicknamed the practical blackbox setting (Chen et al., 2017), is what we work in, as we only observe adaptively chosen predictions without knowledge of the network architecture, dataset, or algorithms.
We note that perhaps surprisingly, some of our algorithms are in fact entirely non-adaptive.
1. O UR C ONTRIBUTIONS
In this paper, we provably show that span recovery for deep neural networks with high precision can be efﬁciently accomplished with poly ( n ) function evaluations, even when the networks have poly ( n ) layers and the output of the network is a scalar in some ﬁnite set.
Speciﬁcally, for deep networks M ( x ) : R n → R with ReLU activation functions, we prove that we can recover a subspace V ⊂ Span ( A ) of dimension at least k/ 2 with polynomially many non-adaptive queries.
1 First, we use a volume bounding technique to show that a ReLU network has sufﬁciently large piece-wise linear sections and that gradient information can be derived from function evaluations.
Next, by using a novel combinatorial analysis of the sign patterns of the ReLU network along with facts in polynomial algebra, we show that the gradient matrix has sufﬁcient rank to allow for partial span recovery.
Theorem 3.4 (informal) Suppose we have the network M ( x )
=
w T φ ( W 1 φ ( W 2 φ ( . . .
W d φ ( A x )) . . . ) , where φ is the ReLU and W i ∈
R k
i × k
i +1 are weight matrices, with k
i possibly much smaller than k .
Then, under mild assumptions, there is a non-adaptive algorithm that makes O ( kn log k ) queries to M ( x ) and returns in poly ( n, k ) - time a subspace V ⊆ span
( A ) of dimension at least k 2 with probability 1 − δ .
We remark that span recovery of the ﬁrst weight layer is provably feasible even in the surprising case when the neural network has many “bottleneck" layers with small O (log( n )) width.
Because this does not hold in the linear case, this implies that the non-linearities introduced by activations in deep learning allow for much more information to be captured by the model.
Moreover, our algorithm is non-adaptive, which means that the points x i at which M ( x i ) needs to be evaluated can be chosen in advance and span recovery will succeed with high probability.
This has the beneﬁt of being parallelizable, and possibly more difﬁcult to detect when being used for an adversarial attack.
In contrast with previous papers, we do not assume that the gradient matrix has large rank; rather our main focus and novelty is to prove this statement under minimal assumptions.
We require only two mild assumptions on the weight matrices.
The ﬁrst assumption is on the orthant probabilities of the matrix A , namely that the distribution of sign patterns of a vector A g , where g ∼ N (0 , I n ) , is not too far from uniform.
Two examples of matrices which satisfy this property are random matrices and matrices with nearly orthogonal rows.
The second assumption is a non-degeneracy condition on the matrices W i , which enforces that products of rows of the matrices W i result in vectors with non-zero coordinates.
Our next result is to show that full span recovery is possible for thresholded networks M ( x ) with twice differentiable activation functions in the inner layers, when the network has a 0 / 1 threshold function in the last layer and becomes therefore non-differentiable, i.e., M ( x ) ∈ { 0 , 1 } .
Since the activation functions can be arbitrarily non-linear, our algorithm only provides an approximation of the true subspace Span ( A ) , although the distance between the subspace we output and Span ( A ) can be made exponentially small.
We need only assume bounds on the ﬁrst and second derivatives of the activation functions, as well as the fact that we can ﬁnd inputs x ∈ R n
such that M ( x ) (cid:54) =
with good probability, and that the gradients of the network near certain points where the threshold evaluates to one are not arbitrarily small.
We refer the reader to Section 4 for further details on these assumptions.
Under these assumptions, we can apply a novel gradient-estimation scheme to approximately recover the gradient of M ( x ) and the span of A .
Theorem 4.3 (informal) Suppose we have the network M ( x ) =
τ ( σ ( A x )) , where τ : R → { 0 , 1 } is a threshold function and σ : R k
→ R is a neural network with twice differentiable activation functions, and such that M satisﬁes the conditions sketched above (formally deﬁned in Section 4).
Then there is an algorithm that runs in poly ( N ) time, making at most poly ( N ) queries to M ( x ) , where N = poly ( n, k, log( 1 (cid:15) ) , log( 1 δ )) , and returns with probability 1 − δ a subspace V ⊂ R n of dimension k such that for any x ∈ V , we have
[Equation]
where P Span ( A ) is the orthogonal projection onto the span of A .
Empirically, we verify our theoretical ﬁndings by running our span recovery algorithms on randomly generated networks and trained networks.
First, we conﬁrm that full recovery is not possible for all architectures when the network layer sizes are small.
This implies that the standard assumption that the gradient matrix is full rank does not always hold.
However, we see that realistic network architectures lend themselves easily to full span recovery on both random and trained instances.
We emphasize that this holds even when the network has many small layers, for example a ReLU network that has 6 hidden layers with [784 , 80 , 40 , 30 , 20 , 10] nodes, in that order, can still admit full span recovery of the rank 80 weight matrix.
Furthermore, we observe that we can effortlessly apply input obfuscation attacks after a successful span recovery and cause misclassiﬁcations by tricking the network into classifying noise as normal inputs with high conﬁdence.
Speciﬁcally, we can inject large amounts of noise in the null space of A to arbitrarily obfuscate the input without changing the output of the network.
We demonstrate the utility of this attack on MNIST data, where we use span recovery to generate noisy images that are classiﬁed by the network as normal digits with high conﬁdence.
We note that this veers away from traditional adversarial attacks, which aim to drastically change the network output with humanly-undetectable changes in the input.
In our case, we attempt the arguably more challenging problem of drastically changing the input without affecting the output of the network.
P RELIMINARIES
Notation For a vector x ∈ R k , the sign pattern of x , denoted sign ( x ) ∈ { 0 , 1 } k , is the indicator vector for the nonzero coordinates of x .
Namely, sign ( x ) i = 1 if x i (cid:54) = 0 and sign ( x ) i = 0 otherwise.
Given a matrix A ∈ R n × m , we denote its singular values as σ min ( A ) =
σ min { n,m } , . . .
, σ 1 ( A ) =
σ max ( A ) .
The condition number of A is denoted κ ( A ) =
σ max ( A ) /σ min
( A ) .
We let I n ∈ R n × n denote the n × n identity matrix.
For a subspace V ⊂ R n , we write
P V ∈ R n × n to denote the orthogonal projection matrix onto V .
If µ ∈ R n and Σ ∈ R n × n is a PSD matrix, we write
N ( µ, Σ) to denote the multi-variate Gaussian distribution with mean µ and covariance Σ .
Gradient Information For any function f ( x ) =
g ( A x ) , note that ∇ f ( x ) =
A (cid:62) g
( A x ) must be a vector in the row span of A .
Therefore, span recovery boils down to understanding the span of the gradient matrix as x varies.
Speciﬁcally, note that if we can ﬁnd points x 1 , .., x k such that {∇ f ( x i ) } are linearly independent, then the full span of
A can be recovered using the span of the gradients.
To our knowledge, previous span recovery algorithms heavily rely on the assumption that the gradient matrix is full rank and in fact well-conditioned.
Speciﬁcally, for some distribution
D , it is assumed that H f = (cid:82) x ∼D ∇ f ( x ) ∇ f ( x ) (cid:62) dx is a rank k matrix with a minimum non-zero singular value bounded below by α and the number of gradient or function evaluations needed depends inverse polynomially in α .
In contrast, in this paper, when f ( x ) is a neural network, we provably show that H f is a matrix of sufﬁciently high rank or large minimum non-zero singular value under mild assumptions, using tools in polynomial algebra.
D EEP N ETWORKS WITH R E LU ACTIVATIONS
In this section, we demonstrate that partial span recovery is possible for deep ReLU networks.
Speciﬁcally, we consider neural networks M ( x ) :
R n → R of the form
[Equation]
where φ ( x ) i = max { x i , 0 } is the RELU (applied coordinate-wise to each of its inputs), and W i ∈
R k
i × k
i +1 , and w ∈ R k d , and A has rank k .
We note that k i can be much smaller than k .
In order to obtain partial span recovery, we make the following assumptions parameterized by a value γ > 0 (our algorithms will by polynomial in 1 /γ ):
• Assumption 1: For every sign pattern S ∈ { 0 , 1 } k , we have Pr g ∼N (0 ,I n ) [ sign ( φ ( A g ))
=
S ] ≥ γ/ 2 k .
• Assumption 2:
For any S 1 , . . .
, S d (cid:54) = ∅ where S i ⊆
[ k i ] , we have w T (cid:16)(cid:81) di =1 ( W i ) S
i (cid:17) ∈
R k is entry-wise non-zero.
Here ( W i ) S
i is the matrix with the rows j / ∈ S i set equal to 0 .
Moreover, we assume
[Equation] [Equation]
Our ﬁrst assumption is an assumption on the orthant probabilities of the distribution A g .
Speciﬁcally, observe that
A g ∈ R k follows a multi-variate Gaussian distribution with covariance matrix AA T .
Assumption 1 then states that the probability that a random vector x ∼ N (0 , AA T ) lies in a certain orthant of R k is not too far from uniform.
We remark that orthant probabilities of multivariate Gaussian distributions are well-studied (see e.g., Miwa et al.
Bacon (1963); Abrahamson et al. (1964)), and thus may allow for the application of this assumption to a larger class of matrices.
In particular, we show it is satisﬁed by both random matrices and orthogonal matrices.
Our second assumption is a non-degeneracy condition on the weight matrices W i – namely, that products of w T with non-empty sets of rows of the W i result in entry-wise non-zero vectors.
In addition, Assumption 2 requires that the network is non-zero with probability that is not arbitrarily small, otherwise we cannot hope to ﬁnd even a single x with M ( x ) (cid:54) = 0 .
In the following lemma, we demonstrate that these conditions are satisﬁed by randomly initialized networks, even when the entries of the W i are not identically distributed.
Lemma 3.1.
If A ∈ R k × n is an arbitrary matrix with orthogonal rows, or if n > Ω( k 3 ) and A has entries that are drawn i.i.d.
from some sub-Gaussian distribution D with expectation 0 , unit variance, and constant sub-Gaussian norm (cid:107)D(cid:107) ψ 2 = sup p ≥ 1 p − 1 /
( E X ∼D | X | p ) 1 /p then with probability at least 1 − e − k 2 , A satisﬁes Assumption 1 with γ ≥ 1 / 2 .
Moreover, if the weight matrices w, W 1 , W 2 , ..., W d with W i ∈ R k i × k
i +1 have entries that are drawn independently (and possibly non-identically) from continuous symmetric distributions, and if k i ≥ log( 16 d δγ ) for each i ∈
[ d ] , then Assumption 2 holds with probability 1 − δ .
3. A LGORITHM FOR S PAN R ECOVERY
The algorithm for recovery is given in Algorithm 1.
Our algorithm computes the gradient ∇ M ( g i ) for different
Gaussian vectors g i ∼ N (0 , I k ) , and returns the subspace spanned by these gradients.
To implement this procedure, we must show that it is possible to compute gradients via the perturbational method (i.e. ﬁnite differences), given only oracle queries to the network M .
Namely, we ﬁrstly must show that if g ∼ N (0 , I n ) then ∇ M ( g ) exists, and moreover, that ∇ M ( x ) exists for all x ∈ B (cid:15) ( g ) , where B (cid:15) ( g ) is a ball of radius (cid:15) centered at g , and (cid:15) is some value with polynomial bit complexity which we can bound.
To demonstrate this, we show that for any ﬁxing of the sign patterns of the network, we can write the region of R n which satisﬁes this sign pattern and is (cid:15) -close to one of the O ( dk ) ReLU thresholds of the network as a linear program.
We then show that the feasible polytope of this linear program is contained inside a Euclidean box in R n , which has one side of length (cid:15) .
Using this containment, we upper bound the volume of the polytope in R n which is (cid:15) close to each ReLU, and union bound over all sign patterns and
ReLUs to show that the probability that a Gaussian lands in one of these polytopes is exponentially small.
Lemma
Lemma 3.2.
There is an algorithm which, given g ∼ N (0 , I k ) , with probability 1 − exp( − n c ) for any constant c >(over the randomness in g ), computes
∇ M ( g ) ∈
R n with O ( n ) queries to the network, and in poly ( n ) runtime.
Now observe that the gradients of the network lie in the row-span of A .
To see this, for a given input x ∈ R n , let
S 0 ( x ) ∈ R k be the sign pattern of φ ( A x ) ∈ R k , and more generally deﬁne S
i ( x ) ∈ R k i via
[Equation]
Then ∇ M ( x ) =
( w T · ( (cid:81) di
=1 ( W i ) S i )))
A S 0 , which demonstrates the claim that the gradients lie in the row-span of
A .
Now deﬁne z
i = ∇ M ( g i ) where g i ∼ N (0 , I n ) , and let Z be the matrix where the i -th row is equal to z i .
We will prove that Z has rank at least k/ 2 .
To see this, ﬁrst note that we can write Z =
VA , where V is some matrix such that the non-zero entries in the i -th row are precisely the coordinates in the set S i 0 , where S ij =
S j ( g i ) for any j = 0 , 1 , 2 , . . .
, d and i = 1 , 2 , . . .
, r .
We ﬁrst show that V has rank at least ck for a constant c > 0 .
To see this, suppose we have computed r gradients so far, and the rank of V is less than ck for some 0 <
c < 1 / 2 .
Now V ∈ R r × k is a ﬁxed rank- ck matrix, so the span of the matrix can be expressed as a linear combination of some ﬁxed subset of ck of its rows.
We use this fact to show in the following lemma that the set of all possible sign patterns obtainable in the row span of V is much smaller than 2 k .
Thus a gradient z r +1 with a uniform (or nearly uniform) sign pattern will land outside this set with good probability, and thus will increase the rank of Z when appended.
Lemma 3.3.
Let V ∈ R r × k be a ﬁxed at most rank ck matrix for c ≤ 1 / 2 .
Then the number of sign patterns S ⊂ [ k ] with at most k/ 2 non-zeros spanned by the rows of V is at most 2 k √ k .
In other words, the set S ( V ) =
{ sign ( w ) | w ∈ span ( V ) , nnz ( w ) ≤ k 2 } has size at most 2 k √ k .
Theorem 3.4.
Suppose the network M ( x ) =
w T φ ( W 1 φ ( W 2 φ ( . . .
W d φ ( Ax )) . . . ) , where φ is the ReLU, satisﬁes
Assumptions 1 and 2 .
Then the algorithm given in Figure 1 makes O ( kn log( k/δ ) /γ )
queries to M ( x ) and returns in poly ( n, k, 1 /γ, log(1 /δ )) time a subspace V ⊆ span ( A ) of dimension
at least k 2 with probability 1 − δ .
N ETWORKS WITH T HRESHOLDING ON D IFFERENTIABLE A CTIVATIONS
In this section, we consider networks that have a threshold function at the output node, as is done often for classiﬁcation.
Speciﬁcally, let τ : R → { 0 , 1 } be the threshold function: τ ( x )
=
if x ≥ 1 , and τ ( x ) = 0 otherwise.
Again, we let A ∈ R k × n where k < n , be the innermost weight matrix.
The networks M : R n → R we consider are then of the form:
[Equation]
where W i ∈
R k
i × k
i +
and each φ i is a continuous, differentiable activation function applied entrywise to its input.
We will demonstrate that even for such functions with a binary threshold placed at the end, giving us minimal information about the network, we can still achieve full span recovery of the weight matrix A , albeit with the cost of an (cid:15) - approximation to the subspace.
Note that the latter fact is inherent, since the gradient of any function that is not linear in some ball around each point cannot be obtained exactly without inﬁnitely small perturbations of the input, which we do not allow in our model.
We can simplify the above notation, and write σ ( x )
=
W 1 φ 1 ( W 2 φ 2 ( . . .
φ
d A x )) . . . ) , and thus M ( x ) =
τ ( σ ( x )) .
Our algorithm will involve building a subspace V ⊂ R n which is a good approximation to the span of A .
At each step, we attempt to recover a new vector which is very close to a vector in Span ( A ) , but which is nearly orthogonal to the vectors in V .
Speciﬁcally, after building V , on an input x ∈ R n , we will query M for inputs M (( I n − P V ) x ) .
Recall that P V is the projection matrix onto V , and P V ⊥ is the projection matrix onto the subspace orthogonal to V .
Thus, it will help here to think of the functions M, σ as being functions of x and not ( I n − P V ) x , and so we deﬁne σ V ( x ) =
σ ( A ( I n − P V ) x ) , and similarly M V ( x ) =
τ ( σ V ( x )) .
For the results of this section, we make the following assumptions on the activation functions.
Assumptions:
The function φ i : R → R is continuous and twice differentiable, and φ i (0) = 0 .
φ i and φ (cid:48)
i are L i -Lipschitz, meaning:
[Equation]
The network is non-zero with bounded probability: for every subspace V ⊂ R n of dimension dim ( V ) <
k , we have that Pr g
∼N
(0 , I n ) [ σ V ( g ) ≥ 1] ≥ γ for some value γ > 0 . 4.
Gradients are not arbitrarily small near the boundary: for every subspace V ⊂ R n of dimension dim ( V ) <
k Pr g ∼N (0 , I n ) [ |∇ g σ V ( cg )
| ≥ η, ∀ c > 0 such that σ V ( cg ) = 1 , and σ V ( g ) ≥ 1] ≥ γ for some values η, γ > 0 , where ∇ g σ V ( cg ) is the directional derivative of σ V in the direction g .
The ﬁrst two conditions are standard and straightforward, namely φ i is differentiable, and has bounded ﬁrst and second derivatives (note that for our purposes, they need only be bounded in a ball of radius poly ( n ) ).
Since M ( x ) is a threshold applied to σ ( x ) , the third condition states that it is possible to ﬁnd inputs x with non-zero network evaluation
M ( x ) .
Our condition is slightly stronger, in that we would like this to be possible even when x is projected away from any k (cid:48) <
k dimensional subspace (note that this ensures that A x is non-zero, since A has rank k ).
The last condition simply states that if we pick a random direction g where the network is non-zero, then the gradients of the network are not arbitrarily small along that direction at the threshold points where σ ( c · g ) = 1 .
Observe that if the gradients at such points are vanishingly small, then we cannot hope to recover them.
Moreover, since M only changes value at these points, these points are the only points where information about σ can be learned.
Thus, the gradients at these points are the only gradients which could possibly be learned.
We note that the running time of our algorithms will be polynomial in log(1 /η ) , and thus we can even allow the gradient size η to be exponentially small.
4. T HE A PPROXIMATE S PAN R ECOVERY A LGORITHM
We now formally describe and analyze our span recovery algorithm for networks with differentiable activation functions and 0 / 1 thresholding.
Let κ i be the condition number of the i -th weight matrix W i , and let δ > 0 be a failure probability, and let (cid:15) > 0 be a precision parameter which will affect the how well the subspace we output will approximate Span ( A ) .
Now ﬁx N = poly ( n, k, 1 γ , (cid:80) di
=1 log( L i ) , (cid:80) di =1 log( κ i ) , log( 1 η ) , log( 1 (cid:15) ) , log( 1 δ )) .
The running time and query complexity of our algorithm will be polynomial in N .
Our algorithm for approximate span recovery is given formally in Algorithm 2.
Proposition 4.1.
Let V ⊂ R n be a subspace of dimension k (cid:48) <
k , and ﬁx any (cid:15) 0 > 0 .
Then we can ﬁnd a vector x with 0 ≤ σ V ( x ) − 1 ≤ 2 (cid:15)
in expected O
(1 /γ + N log(1 /(cid:15) 0 )) time.
Moreover, with probability γ/ 2 we have that ∇ x σ V ( x ) >
η/ 4 and the tighter bound of (cid:15)
η 2 − N ≤ σ V ( x ) − 1 ≤ 2 (cid:15) 0 .
We will apply the above proposition as input to the following Lemma 4.2, which is the main technical result of this section.
Our approach involves ﬁrst taking the point x from Proposition 4.1 such that σ V ( x ) is close but bounded away from the boundary, and generating n perturbations at this point M V ( x + u i ) for carefully chosen u i .
While we do not know the value of σ V ( x + u i ) , we can tell for a given scaling c > 0 if σ V ( x + cu i ) has crossed the boundary, since we will then have M V ( x + cu i )
= 0 .
Thus, we can estimate the directional derivative ∇ u i σ ( x ) by ﬁnding a value c i via a binary search such that σ V ( x + c i u i ) is exponentially closer to the boundary than σ V ( x ) .
In order for our estimate to be accurate, we must carefully upper and lower bound the gradients and Hessian of σ v near x , and demonstrate that the linear approximation of σ v at x is still accurate at the point x + c i u i where the boundary is crossed.
Since each value of 1 /c i is precisely proportional to ∇ u i σ ( x ) =
(cid:104)∇ σ ( x ) , u i (cid:105) , we can then set up a linear system to approximately solve for the gradient ∇ σ ( x ) (lines 8 and 9 of Algorithm 2).
Lemma 4.2.
Fix any (cid:15), δ > 0 , and let N be deﬁned as above.
Then given any subspace V ⊂ R n with dimension dim ( V ) < k , and given x ∈ R n , such that (cid:15)
η 2 − N ≤ σ V ( x ) − 1 ≤ 2 (cid:15) 0 where (cid:15)
= Θ(2 − N C /(cid:15) )
for a sufﬁciently large constant C
= O (1) , and such that ∇ x σ V ( x ) >
η/ 2 , then with probability 1 − 2 − N/n 2 , we can ﬁnd a vector v ∈ R n in expected poly ( N ) time, such that (cid:107) P Span ( A ) v (cid:107) 2 ≥ (1 − (cid:15) ) (cid:107) v (cid:107) 2 , and such that (cid:107) P V v (cid:107) 2 ≤ (cid:15) (cid:107) v (cid:107) 2 .
Theorem 4.3.
Suppose the network M ( x ) =
τ ( σ ( A x )) satisﬁes the conditions described at the beginning of this section.
Then Algorithm 2 runs in poly ( N ) time, making at most poly ( N ) queries to M ( x ) , where N =
1 V ← ∅ , N = poly (cid:0) n, k, 1 γ , (cid:80) di
=1 log( L i ) , (cid:80) di =1 log( κ i ) , log( 1 η ) , log( 1 (cid:15) ) , log( 1 δ ) (cid:1) , (cid:15) 0 ← 2 − poly ( N ) 2 for i = 0 , . . .
k do
Generate g ∼ N (0 , I n ) until M (( I n − P V ) g ) =
Find a scaling α > 0 via binary search on values τ ( σ V ( αg )) such that x = αg satisﬁes (cid:15)
η 2 − N ≤ σ V ( x ) − 1 ≤ 2 (cid:15) 0 .
(cid:46) Proposition 4.
Generate g 1 , . .
. , g n ∼ N (0 , I n ) , and set u i = (cid:0) g i 2 − N − x/ (cid:107) x
(cid:107) 2 (cid:1) .
For each i ∈ [ n ] , binary search over values c to ﬁnd c i such that [Equation]
where β = 2 − N 2 (cid:15) 20 .
If any c i satisﬁes | c i | ≥ (10 · 2 − N (cid:15) 0 /η ) , restart from line 5 (regenerate the Gaussian g ).
Otherwise, deﬁne B ∈ R n × n via B ∗ ,i = u i , where B ∗ ,i is the i -th column of B .
Deﬁne b ∈ R n by b i = 1 /c
i .
Let y ∗ be the solution to: min y ∈ R n (cid:107) y T B − b T (cid:107)
Set v i =
y ∗ and V ← Span ( V, v i ) .
10 end 11 return V poly ( n, k, 1 γ , (cid:80) di
=1 log( L i ) , (cid:80) di =1 log( κ i ) , log( 1 η ) , log( 1 (cid:15) ) , log( 1 δ )) , and returns with probability 1 − δ a subspace
V ⊂ R n of dimension k such that for any x ∈ V , we have (cid:107) P Span ( A ) x (cid:107) 2 ≥ (1 − (cid:15) )
(cid:107) x (cid:107) 2 .
E XPERIMENTS
When applying span recovery for a given network, we ﬁrst calculate the gradients analytically via auto-differentiation at a ﬁxed number of sample points distributed according to a standard Gaussian.
Our networks are feedforward, fully-connected with ReLU units; therefore, as mentioned above, using analytic gradients is as precise as using ﬁnite differences due to piecewise linearity.
Then, we compute the rank of the resulting gradient matrix, where the rank is deﬁned to be the number of singular values that are above 1e-5 of the maximum singular value.
In our experiments, we attempt to recover the full span of a 784-by-80 matrix with decreasing layer sizes for varying sample complexity, as speciﬁed in the ﬁgures.
For the MNIST dataset, we use a size 10 vector output and train according to the softmax cross entropy loss, but we only calculate the gradient with respect to the ﬁrst output node
Our recovery algorithms are GradientsRandom (Algorithm 1), GradientsRandomAda (Algorithm 2), and GradientsMNIST.
GradientsRandom is a direct application of our ﬁrst span recovery algorithm and calculates gradients via pertur- bations at random points for a random network.
GradientsRandomAda uses our adaptive span recovery algorithm for a random network.
Finally, GradientsMNIST is an application of GradientsRandom on a network with weights trained on MNIST data.
In general, we note that the experimental outcomes are very similar among all three scenarios.
For networks with very small widths and multiple layers, we see that span recovery deteriorates as depth increases, supporting our theory (see Figure 1).
This holds both in the case when the networks are randomly initialized with
Gaussian weights or trained on a real dataset (MNIST) and whether we use adaptive or non-adaptive recovery algorithms.
However, we note that these small networks have unrealistically small widths (less than 10) and when trained on MNIST, these networks fail to achieve high accuracy, all falling below 80 percent.
The small width case is therefore only used to support, with empirical evidence, why our theory cannot possibly guarantee full span recovery under every network architecture.
For more realistic networks with moderate or high widths, however, full span recovery seems easy and implies a real possibility for attack (see Figure 2).
Although we tried a variety of widths and depths, the results are robust to reasonable settings of layer sizes and depths.
Therefore, we only present experimental results with sub-networks of a network with layer sizes [784, 80, 40, 30, 20, 10].
Note that full span recovery of the ﬁrst-layer weight matrix with rank 80 is achieved almost immediately in all cases, with less than 100 samples.
On the real dataset MNIST, we demonstrate the utility of span recovery algorithms as an attack to fool neural networks to misclassify noisy inputs (see Figure 3).
We train a ReLU network (to around 95 percent accuracy) and recover its span by computing the span of the resulting gradient matrix.
Then, we recover the null space of the matrix and generate random Gaussian noise projected onto the null space.
We see that our attack successfully converts images into noisy versions without changing the output of the network, implying that allowing a full (or even partial) span recovery on a classiﬁcation network can lead to various adversarial attacks despite not knowing the exact weights of the network.
A M ISSING P ROOFS FROM S ECTION
We ﬁrst restate the results which have had their proofs omitted, and include their proofs subsequently.
Lemma 3.1 If A ∈ R k × n has orthogonal rows, or if n > Ω( k 3 ) and A has entries that are drawn i.i.d.
from some sub-Gaussian distribution D with expectation 0 , unit variance, and constant sub-gaussian norm (cid:107)D(cid:107) ψ 2 = sup p ≥ 1 p − 1 /
( E X ∼D | X | p ) 1 /p then with probability at least 1 − e − k 2 , A satisﬁes Assumption 1 with γ ≥ 1 / 2 .
Moreover, if the weight matrices w, W 1 , W 2 , ..., W d with W i ∈ R k i × k
i +1 have entries that are drawn independently (and possibly non-identically) from continuous symmetric distributions, and if k i ≥ log( 16 d δγ ) for each i ∈
[ d ] , then
Assumption 2 holds with probability 1 − δ .
Proof.
By Theorem 5.58 of Vershynin (2010), if the entries A are drawn i.i.d.
from some sub-Gaussian isotropic distribution D over R n such that (cid:107) A j (cid:107) 2 = √ n almost surely, then √ n − C √ k − t ≤ σ min ( A ) ≤ σ max ( A ) ≤ √ n + C √ k + t with probability at least 1 − 2 e − ct 2 , for some constants c, C > 0 depending only on (cid:107)D(cid:107) ψ 2 .
Since the entries are i.i.d.
with variance 1 , it follows that the rows of A are isotropic.
Moreover, we can always condition on the rows having norm exactly √ n , and pulling out a positive diagonal scaling through the ﬁrst Relu of M ( x ) , and absorbing this scaling into W d .
It follows that the conditions of the theorem hold, and we have √ n − C √ k ≤ σ min ( A ) ≤ σ max ( A ) ≤ √ n + C √ k with probability at least 1 − e − k 2 for a suitably large re scaling of the constant
C .
Setting n > Ω( k 3 ) , it follows that κ ( A ) <
(1 + 1 / (100 k )) , which holds immediately if A has orthogonal rows.
Now observe that A g is distributed as a multi-variate Gaussian with co-variance A T A , and is therefore given by the probability density function (pdf)
[Equation]
Let p ( x ) =
[Equation]
be the pdf of an identity covariance Gaussian N (0 , I k ) .
We lower bound p (cid:48) ( x ) /p
( x ) for x with (cid:107) x (cid:107) 22 ≤ 16 k .
In this case, we have
[Equation]
≥
[Equation] [Equation]
Thus for any sign pattern S , Pr [ sign ( Ag ) =
S : (cid:107) Ag (cid:107) 22 ≤ k ] ≥ 12 Pr [ sign ( g ) =
S : (cid:107) g (cid:107) 22 ≤ k ] .
Now
Pr [ sign ( g ) = S ] = 2 − k , and spherical symmetry of Gaussians, Pr [ sign ( g ) =
S : (cid:107) g (cid:107) 22 ≤ k ] = 2 − k , and thus
Pr [ sign ( Ag ) =
S : (cid:107) Ag (cid:107) 22 ≤ k ] ≥ 2 − k − 1 .
Now (cid:107) Ag (cid:107) 22 ≤ 2 (cid:107) g (cid:107) 22 which is distributed as a χ 2 random variable with k -degrees of freedom.
By standard concentration results for χ 2 distributions (Lemma 1 Laurent & Massart (2000)), we have Pr [ (cid:107) g (cid:107) 22 ≥ 8 k ] ≤ e − 2 k , so
Pr [ (cid:107) Ag (cid:107) 22 ≥ 16 k ] ≤
Pr
[ (cid:107) g (cid:107) 22 ≥ 8 k ] ≤ e − 2 k .
By a union bound,
Pr [ sign ( Ag ) =
S : (cid:107) Ag (cid:107) 22 ≤ k ] ≥ 2 − k − 1 − e − 2 k ≥ 14 2 − k , which completes the proof of the ﬁrst claim with γ = 1 / 4 .
For the second claim, by an inductive argument, the entries in the rows i ∈ S j of the product W S j (cid:16)(cid:81) di
= j +
( W i ) S i (cid:17) are drawn from a continuous distribution.
Thus each column of W S j (cid:16) (cid:81) di = j +1 ( W i ) S
i (cid:17) is non-zero with probability 1 .
It follows that (cid:104) w, (cid:16)(cid:81) di
=1 ( W i ) S i (cid:17) ∗ ,j (cid:105) is the inner product of a non-zero vector with a vector w with continuous, independent entries, and is thus non-zero with probability 1 .
By a union bound over all possible non-empty sets S j , the desired result follows.
We now show that the second part of Assumption 2 holds.
To do so, ﬁrst let g ∼ N (0 , I n ) .
We demonstrate that
Pr W 1 , W 2 ,..., W d ,g [ M ( x ) = 0] ≤ 1 − γδ/ 100 .
Here the entries of the W i ’s are drawn independently but not necessarily identically from a continuous symmetric distribution.
To see this, note that we can condition on the value of g , and condition at each step on the non-zero value of y i =
φ ( W i +1 φ ( W i +2 φ ( . . .
φ ( Ag ) . . . ) .
Then, over the randomness of W i , note that the inner product of a row of W i and y i is strictly positive with probability at least 1 / 2 , and so each coordinate of W i
y i is strictly positive independently with probability ≥ 1 / 2 .
It follows that φ ( W i y i ) is non-zero with probability at least 1 − 2 − k i .
Thus
[Equation]
where the second inequality is by assumption.
It follows by our ﬁrst part that
[Equation]
So by Markov’s inequality,
[Equation]
Thus with probability 1 − δ over the choice of W 1 , . .
, W d , we have Pr g
[ M ( g ) = 0] ≤ γ/ 8 as desired.
Lemma 3.2 There is an algorithm which, given g ∼ N (0 , I k ) , with probability 1 − exp( − n c ) for any constant c >(over the randomness in g ), computes
∇ M ( g ) ∈
R n with O ( n ) queries to the network, and in poly ( n ) running time.
Proof.
Let M i ( x ) =
φ ( W i φ ( W i +1 φ ( . . .
φ ( A x )) . . . )
where φ is the ReLU.
If ∇ M ( g ) exists, there is an (cid:15) >such that M is differentiable on B (cid:15) ( g ) .
We show that with good probability, if g ∼ N (0 , I n ) (or in fact, almost any continuous distribution), then M ( g ) is continuous in the ball B (cid:15) ( g ) =
{ x ∈ R n | (cid:107) x
− g (cid:107) 2 < (cid:15) } for some (cid:15) which we will now compute.
First, we can condition on the event that (cid:107) g (cid:107) 22 ≤ ( nd ) 10 c , which occurs with probability at least 1 − exp( − ( nd ) 5 c ) by concentration results for χ 2 distributions Laurent & Massart (2000).
Now, ﬁx any sign pattern S i ⊆
[ k i ] for the i -th layer M i ( x ) =
φ ( W i ( φ ( . . .
( φ ( A x ) . . . ) , and let S =
( S 1 , S 2 , . . .
, S d +1 ) .
We note that we can enforce the constraint that for an input x ∈ R n , the sign pattern of M i ( x ) is precisely S i .
To see this, note that after conditioning on a sign pattern for each layer, the entire network becomes linear.
Thus each constraint that (cid:104) ( W i ) j, ∗ , M i +1 ( x ) (cid:105) ≥ 0 or (cid:104)
( W i )
j, ∗ , M i +1 ( x ) (cid:105) ≤ 0 can be enforced as a linear combination of the coordinates of x .
Now ﬁx any layer i ∈
[ d + 1] and neuron j ∈ [ k i ] , WLOG j ∈ S i .
We now add the additional constraint that (cid:104) ( W i ) j, ∗ , M i +1 ( x ) (cid:105) ≤ η , where η = exp( − poly ( nd )) is a value we will later choose.
Thus, we obtain a linear program with k + (cid:80) di =1 k i constraints and n variables.
The feasible polytope P represents the set of input points which satisfy the activation patterns S and are η -close to the discontinuity given by the j -th neuron in the i -th layer.
We can now introduce the following non-linear constraint on the input that (cid:107) x (cid:107) 2 ≤ ( nd ) 10 c .
Let B = B ( nd ) 10 c ( (cid:126) 0) be the feasible region of this last constraint, and let P ∗ = P ∩ B .
We now bound the Lesbegue measure (volume) V ( P ∗ ) of the region P .
First note that V ( P ∗ ) ≤ V ( P (cid:48) ) , where V ( P (cid:48) ) is the region deﬁned by the set of points which satisfy:
[Equation]
where each coordinate of the vector y ∈ R n is a linear combination of products of the weight matrices W (cid:96) , (cid:96) ≥ i .
One can see that the ﬁrst two constraints for P (cid:48) are also constraints for P ∗ , and the last constraint is precisely B , thus
P ∗ ⊂ P (cid:48) which completes the claim of the measure of the latter being larger.
Now we can rotate P (cid:48) by the rotation which sends y → (cid:107) y (cid:107) 2 · e 1 ∈ R n without changing the volume of the feasible region.
The resulting region is contained in the region P (cid:48)(cid:48) given by
[Equation]
Finally, note that P (cid:48)(cid:48)
⊂ R n is a Eucledian box with n − 1 side lengths equal to ( nd ) 10 c and one side length of (cid:107) y (cid:107) 2 η , and thus V ( P (cid:48)(cid:48) ) ≤ (cid:107) y
(cid:107) 2 η ( nd )
10 nc .
Now note we can assume that the entries of the weight matrices A , W 1 , . .
, W d are speciﬁed in polynomially many (in n ) bits, as if this were not the case the output M ( x ) of the network would not have polynomial bit complexity, and could not even be read in poly ( n ) time.
Equivalently, we can assume that our running time is allowed to be polynomial in the number of bits in any value of M ( x ) , since this is the size of the input to the problem.
Given this, since the coordinates of y were linear combinations of products of the coordinates of the weight matrices, and note that each of which is at most 2 n C for some constant C (since the matrices have polynomial bit-complexity), we have that P ∗ ≤ η 2 n C ( nd ) 10 nc as needed.
Now the pdf of a multi-variate Gaussian is upper bounded by 1 , so Pr g ∼N (0 ,I n ) [ g ∈ P ∗ ] ≤ V ( P ∗ ) ≤ η 2 n C ( nd ) 10 nc .
It follows that the probability that a multivariate Gaussian g ∼ N (0 , I n ) satisﬁes the sign pattern S and is η close to the boundary for the j -th neuron in the i -th layer.
Now since there are at most 2 k · (cid:81) di
=1 2 k i ≤ 2 nd possible combinations of sign patterns S
, it follows that the the probability that a multivariate Gaussian g ∈ N (0 , I n ) is η close to the boundary for the j -th neuron in the i -th layer is at most η 2 n C ( nd ) 10 nc 2 nd .
Union bounding over each of the k i neurons in layer i , and then each of the d layers, it follows that g ∈ N (0 , I n ) is η close to the boundary for any discontinuity in M ( x ) is at most η 2 n C ( nd ) 10 nc +1 2 nd .
Setting η ≤ 2 ( nd ) 20 c +1 ) 2 − n C , it follows that with probability at least 1 − exp( − ( nd ) c ) , the network evaluated at g ∈ N (0 , I n ) is at least η close from all boundaries (note that C is known to us by assumption).
Now we must show that perturbing the point g by any vector with norm at most (cid:15) results in a new point g (cid:48) which still has not hit one of the boundaries.
Note that M ( g ) is linear in an open ball around g , so the change that can occur in any intermediate neuron after perturbing g by some v ∈ R n is at most (cid:107) A (cid:107) 2 (cid:81) di =1 (cid:107) W i (cid:107) 2 , where (cid:107) · (cid:107) 2 is the spectral norm.
Now since each entry in the weight matrix can be speciﬁed in polynomially many bits, the Frobenius norm of each matrix (and therefore the spectral norm), is bounded by n 2 2 n C for some constant C .
Thus (cid:107)
[Equation]
and setting (cid:15)
=
η/β , it follows that M ( x ) is differentiable in the ball B (cid:15) ( x ) as needed.
We now generate u 1 , u 2 , . .
u n ∼ N (0 , I n ) , which are linearly independent almost surely.
We set v i =
(cid:15)u i 2 (cid:107) u
i (cid:107) 2 .
Since M ( g ) is a ReLU network which is differentiable on B (cid:15) ( g ) , it follows that M ( g ) is a linear function on B (cid:15) ( g ) , and moreover v i ∈ B (cid:15) ( g ) for each i ∈ [ n ] .
Thus for any c < 1 we have M ( g ) − M ( g + cv i ) c
= ∇ v i M ( x ) , thus we can compute ∇ v i M ( x ) for each i ∈ [ n ] .
Finally, since the directional derivative is given by ∇ v i M ( x ) =
(cid:104)∇ M ( x ) , v i / (cid:107) v i (cid:107) 2 (cid:105) , and since v 1 , . . .
, v n are linearly independent, we can set up a linear system to solve for ∇ M ( x ) exactly in polynomial time, which completes the proof.
Lemma 3.3 Let V ∈ R r × k be a ﬁxed at most rank ck matrix for c ≤ 1 / 2 .
Then the number of sign patterns S ⊂ [ k ] with at most k/ 2 non-zeros spanned by the rows of V is at most 2 k √ k .
In other words, the set S ( V ) =
{ sign ( w ) | w ∈ span ( V ) , nnz ( w ) ≤ k 2 } has size at most 2 k √ k .
Proof.
Any vector w in the span of the rows of V can be expressed as a linear combination of at most ck rows of V .
So create a variable x
i for each coefﬁcient i ∈ [ ck ] in this linear combination, and let f j ( x ) be the linear function of the x (cid:48)
i s which gives the value of the j -th coordinate of w .
Then f ( x ) =
( f 1 ( x ) , . . .
, f k ( x )) is a k -tuple of polynomials, each in ck -variables, where each polynomial has degree 1 .
By Theorem 4 .
1 of Hall et al.
(2010), it follows that the number of sign patterns which contain at most k/ 2 non-zero entries is at most (cid:0) ck
+ k/ 2 ck (cid:1) .
Setting c ≤ 1 / 2 , this is at most (cid:0) kk/ 2 (cid:1) ≤ 2 k √ k .
Theorem 3.4 Suppose the network M ( x ) =
w T φ ( W 1 φ ( W 2 φ ( . . .
W d φ ( Ax )) . . . ) , where φ is the ReLU, satisﬁes
Assumption 1 and 2 .
Then the algorithm given in Figure 1 makes O ( kn log( k/δ ) /γ )
queries to M ( x ) and returns in poly ( n, k, 1 /γ, log(1 /δ ))
-time a subspace V ⊆ span ( A ) of dimension at least k 2 with probability 1 − δ .
Proof.
First note that by Lemma 3.2, we can efﬁciently compute each gradient ∇ M ( g i ) using O ( n ) queries to the network.
After querying for the gradient z i = ∇ M ( g i ) for r (cid:48) ≤ r independent Gaussian vectors g i ∈ R n , we obtain the vector of gradients Z = V · A ∈ R r (cid:48)
× k .
Now suppose that V had rank ck for some c ≤ 1 / 2 .
Now consider the gradient ∇ ( g r (cid:48) +1 ) , which can be written as z r (cid:48)
+1 =
w T (cid:16)(cid:81) di
=1 ( W i )
S r (cid:48) +1 i (cid:17)
Diag ( sign ( A g r (cid:48) +1 ))
A .
Thus we can write z r (cid:48)
+
=
V r (cid:48) +1 A , where V r (cid:48)
+1 ∈
R k is a row vector which will be appended to the matrix V to form a new Z = VA ∈ R r (cid:48)
+
× k after the ( r (cid:48) + 1) -th gradient is computed.
Speciﬁcally, for any j ∈ [ r ] , we have:
V
[Equation]
=
[Equation]
(cid:16)(cid:81) di =
[Equation]
[Equation]
(cid:17) Diag ( sign ( A g j )) .
Let E r (cid:48)
+1 be the event that M ( g r (cid:48) +1 )
(cid:54) = 0 .
It follows necessarily that, conditioned on E r (cid:48)
+1 , we have that sign ( V r (cid:48) +1 )
=
S r (cid:48)
+1.
The reason is as follows: if M ( g r (cid:48) +1 ) (cid:54) = 0 , then we could not have S r (cid:48)
+1 j = ∅ for any j ∈ { 0 , 1 , 2 , . . .
, d } , since this would result in M ( g r (cid:48)
+1 )
= 0 .
It follows that the conditions for Assumption 2 to apply hold, and we have that w T (cid:16)(cid:81) di =1 ( W i ) S r (cid:48)
+1 i (cid:17)
∈ R k is entry-wise non-zero.
Given this, it follows that the sign pattern of
[Equation]
Diag
[Equation]
)) will be precisely S r (cid:48)
+1, as needed.
Now by Lemma 3.3, the number of sign patterns of k -dimensional vectors with at most k/ 2 non-zero entries which are contained in the span of V is at most 2 k √ k .
Let S be the set of sign patterns with at most k/ 2 non-zeros and such that for every S ∈ S , S is not a sign pattern which can be realized in the row span of V .
It follows that |S| ≥ 12 2 k − 2 k √ k ≥ 14 2 k , so by Assumption 1 , we have that Pr (cid:104) sign ( Ag r (cid:48)
+1 ) ∈ S (cid:105) ≥ γ/ 4 .
By a union bound, we have Pr (cid:104) sign ( Ag r (cid:48) +1 ) ∈ S , E r (cid:48)
+1 (cid:105) ≥ γ/
Conditioned on sign ( Ag r (cid:48) +1 ) ∈ S ) and E r (cid:48)
+1 simultaneously, it follows that adding the row vector V r (cid:48) +1 to the matrix V will increase its rank by 1 .
Thus after O (log( k/δ ) /γ ) repetitions, the rank of V will be increased by at least 1 with probability 1 − δ/k .
By a union bound, after after r = O ( k log( k/δ ) /γ ) , V ∈ R r × k will have rank at least k/ 2 with probability at least 1 − δ , which implies that the same will hold for Z since rank ( Z ) ≥ rank ( V ) , which is the desired result.
B M ISSING P ROOFS FROM S ECTION
Proposition 4.
Let V ⊂ R n be a subspace of dimension k (cid:48) <
k , and ﬁx any (cid:15) 0 > 0 .
Then we can ﬁnd a vector x with
[Equation]
in expected O (1 /γ + N log(1 /(cid:15) 0 )) time.
Moreover, with probability γ/ 2 we have that ∇ x σ V ( x ) >
η/ 4 and the tighter bound of
[Equation]
Proof.
We begin by generating Gaussians g 1 , . . .
and computing M V ( g i ) .
By Property 3 of the network assumptions, we need only repeat the process 1 /γ times until we obtain an input y
=
( I n − P V ) g i with M ( y ) =
M V ( g i )
= 1 .
Since all activation functions satisfy φ i (0) = 0 , we know that σ V (0 · g i ) =
0 , and σ V ( g i )
= 1 .
Since σ is continuous, it follows that ψ g i ( c )
=
σ V ( c · g i ) is a continuous function ψ : R (cid:55)→ R .
By the intermediate value theorem, there exists a c ∗ ≤ 1 such that σ V ( c ∗ g i )
= 1 .
We argue we can ﬁnd a c with | c − c ∗ | ≤ (cid:15) 0 2 − N in time O
( N log(1 /(cid:15) 0 )) .
To ﬁnd c , we can perform a binary search.
We ﬁrst try c
= 1 / 2 ,
and if ψ g i ( c 0 ) =
0 , we recurse into [1 / 2 , 1] , otherwise if ψ g i ( c 0 )
=
1 we recurse into [0 , 1 / 2] .
Thus, we always recurse into an interval where ψ g i switches values.
It follows that we can ﬁnd a c with | c − c ∗ | ≤ (cid:15)
(cid:107) g
i (cid:107) 2 2 − N in time O ( N log( (cid:107) g
i (cid:107) 2 /(cid:15) 0 )) for some c ∗ with σ V ( c ∗ g i ) = 1 .
Now observe that it sufﬁces to binary search a total of O ( N log( (cid:107)
g i (cid:107) 2 /(cid:15) 0 )) times, since 2 N is an upper bound on the Lipschitz constant of ψ x , which gives 0 ≤ σ V ( cg i ) − 1 ≤ (cid:15) 0 .
Now the expected running time to do this is O
(1 /γ + N log( (cid:107) g
i (cid:107) 2 /(cid:15) 0 )) , but since (cid:107) g i (cid:107) 2 has Gaussian tails, the expectation of the maximum value of (cid:107) g
i (cid:107) 2 over
1 /γ repetitions is O (log(1 /γ ) √ n ) , and thus the expected running time reduces to the stated bound, which completes the ﬁrst claim of the Proposition.
For the second claim, note that ∇ g i σ V ( c ∗ g i ) > 0 by construction of the binary search, and since σ V ( c ∗ g i ) >
= 1 , by Property 4 with probability γ
we have that ∇ g i σ V ( g i ) >
η .
Now with probability 1 − γ/ 2 , we have that (cid:107) g
i (cid:107) 22 ≤
O ( n log(1 /γ ))
(see Lemma 1 Laurent & Massart (2000)), so by a union bound both of these occur with probability γ/ 2 .
Now since (cid:107) ( c ∗ − c ) x (cid:107) 2 ≤ (cid:15) 0 2 − N (after rescaling N by a factor of log( (cid:107) g i (cid:107) 2 )
=
O (log( n )) ), and since 2 N is also an upper bound on the spectral norm of the Hessian of σ by construction, it follows
that ∇ g i σ V ( cg i ) >
η/ 2 .
Now we set x ← cg i + c(cid:15) 0 2 − N g i / ( (cid:107) cg
i (cid:107) 2 ) .
First note that this increases σ V ( cx ) − 1 by at most (cid:15) 0 , so σ ( cx ) − 1 ≤ 2 (cid:15) 0 , so this does not affect the ﬁrst claim of the Proposition.
But in addition, note that conditioned on the event in the prior paragraph, we now have that σ V ( x ) > 1 + η(cid:15) 0 2 − N .
The above facts can be seen by the fact that 2 N is polynomially larger than the spectral norm of the Hessian of σ , thus perturbing x by (cid:15)
2 − N additive in the direction of x will result in a positive change of at least 12 ( η/ 4)( (cid:15) 0 2 − N ) in σ .
Moreover, by applying a similar argument as in the last paragraph, we will have ∇ x σ V ( cx ) >
η/ 4 still after this update to x .
Lemma 4.
Fix any (cid:15), δ > 0 , and let N = poly ( n, k, 1 γ , (cid:80) di
=1 log( L i ) , (cid:80) di =1 log( κ i ) , log( 1 η ) , log( 1 (cid:15) ) , log( 1 δ )) .
Then given any subspace V ⊂ R n with dimension dim ( V ) < k , and given x ∈ R n , such that (cid:15)
η 2 − N ≤ σ V ( x ) − 1 ≤ 2 (cid:15)where (cid:15)
= Θ(2 − N C /(cid:15) )
for a sufﬁciently large constant C
= O (1) , and ∇ x σ V ( x ) >
η/ 2 , then with probability 1 − 2 − N/n 2 , we can ﬁnd a vector v ∈ R n in expected poly ( N ) time, such that
[Equation]
and such that (cid:107) P V v (cid:107) 2 ≤ (cid:15) (cid:107) v (cid:107) 2 .
Proof.
We generate g 1 , g 2 , . .
. , g n ∼ N (0 , I n ) , and set u i
=
g
i 2 − N − x/ (cid:107) x (cid:107) 2 .
We ﬁrst condition on the event that (cid:107) g i (cid:107) 2 ≤ N for all i , which occurs with probability 1 − 2 − N/n 2 .
Note ∇ u
i [ σ V ( x )] =
w T A ( I n − P V ) u i , where w T = ∇ [ σ ( A ( I n − P V ) x )] T ∈ R k , which does not depend on u i .
Thus w T A ( I n − P V ) is a vector in the row span of A ( I n − P V ) .
We can write
[Equation]
where Ξ( cu i )
=
O ( (cid:107) c ( I n − P V ) u
i (cid:107) 22 2 N ) =
O ( (cid:107) cu i (cid:107) 22 2 N ) is the error term for the linear approximation.
Note that the factor of N comes from the fact that the spectral norm of the Hessian of σ : R n → R can be bounded by (cid:81) i κ i L i ≤ 2 N .
Fix some β > 0 .
We can now binary search again, as in Proposition 4.1, with O (log( N/β )) iterations over c , querying values M V ( x + cu i ) to ﬁnd a value
c =
c i > 0 such that
[Equation]
so
[Equation]
We ﬁrst claim that the c i which achieves this value satisﬁes (cid:107) c
i u i (cid:107) 2 ≤ (10 · 2 − N (cid:15) 0 /η ) .
To see this, ﬁrst note that by Proposition 4.1, we have ∇ x σ V ( x ) >
η/ 4 with probability γ .
We will condition on this occurring, and if it fails to occur we argue that we can detect this and regenerate x .
Now conditioned on the above, we ﬁrst claim that ∇ u i σ V ( x ) ≥ η/ 8 , which follows from the fact that we can bound the angle between the unit vectors in the directions of u i and x by
[Equation]
along with the fact that we have ∇ x σ V ( x ) > η/ 4 .
Since | σ V ( x ) − 1 | < 2 (cid:15) 0 < 2 − N C , and since 2 N is an upper bound on the spectral norm of the Hessian of σ , we have that ∇ u i σ V ( x + cu i ) >
η/ 8 + 2 − N > η/ 10 for all c < 2 − 2 N .
In other words, if H is the hessian of σ , then perturbing x by a point with norm O ( c ) ≤ 2 − 2 N can change the value of the gradient by a vector of norm at most 2 2 N (cid:107) H (cid:107) 2 ≤ 2 − N , where (cid:107) H (cid:107) 2 is the spectral norm of the Hessian.
It follows that setting c = (10 · 2 − N (cid:15)
/η ) is sufﬁcient for σ V ( x + cu i ) < 1 , which completes the above claim.
Now observe that if after binary searching, the property that c ≤ (10 · 2 − N (cid:15) 0 /η ) does not hold, then this implies that we did not have ∇ σ ( x ) > η/ 4 to begin with, so we can throw away this x and repeat until this condition does hold.
By Assumption 4 , we must only repeat O (1 /γ ) times in expectation in order for the assumption to hold.
Next, also note that we can bound c i ≥ (cid:15)
η 2 − N /N , since 2 N again is an upper bound on the norm of the gradient of σ and we know that σ V ( x ) − 1 > (cid:15)
η 2 − N .
Altogether, we now have that | Ξ( c i u i ) | ≤ c 2 i 2 N ≤ (10 · 2 − N (cid:15) 0 /η ) 2 2 N .
We can repeat this binary search to ﬁnd c i for n different perturbations u 1 , . . .
, u n , and obtain the resulting c 1 , . . .
, c n , such that for each i ∈ [ n ] we have
[Equation]
where β i is the error obtained from the binary seach on c i , and therefore satisﬁes | β i | ≤ 2 −
N 2 (cid:15) 20 taking poly ( N ) iterations in the search.
Now we know c i and u i , so we can set up a linear system
[Equation]
for an unknown y ∈ R k where the i -th column of B is given by B i = u
i ∈ R n , and b i = 1 /c
i for each i ∈ [ n ] .
First note that the set { u 1 , u 2 , . . .
, u n } is linearly independent with probability 1 , since { u 1 − x, u 2 − x, . . .
, u n − x } is just a set of Gaussian vectors.
Thus B has rank n , and the above system has a unique solution y ∗ .
Next, observe that setting (cid:98) y
= w T A ( I n − P V ) (1 − σ V ( x )) , we obtain that for each i ∈ [ n ] :
[Equation]
Thus
[Equation]
Now setting y ∗ such that ( y ∗ ) T B = b T , we have that cost of the optimal solution is 0 , and (cid:107) (cid:98) y B − b T (cid:107) 2 ≤ (2 − N ) O (1) (cid:15)
c i (1 − σ ( x )) , so (cid:107) (
[Equation]
− (cid:98)
[Equation]
B (cid:107) 2 ≤ (2 −
[Equation] [Equation]
) (cid:15)
[Equation]
i (1 − σ ( x )) .
By deﬁnition of the minimum singular value of
B , it follows that (cid:107) y ∗ − (cid:98) y (cid:107) 2 ≤
[Equation]
i
[Equation]
1 − σ ( x )) .
Now using the fact that B = 2 − N G + X where G is a
Gaussian matrix and X is the matrix with each row equal to x , we can apply Theorem 1.6 of Cook et al.
(2018), we have σ min ( B ) ≥ 1 / (2 − N ) O
(1) , So (cid:107) y ∗ − (cid:98) y
(cid:107) 2 ≤ (2 − N ) O (1)
[Equation]
i
[Equation]
1 − σ
[Equation]
x )) .
Thus we have (cid:107) y ∗ (cid:107) 2 ≤
[Equation]
y
[Equation]
− σ ( x
[Equation]
, and moreover note that (cid:107) (cid:98) y (cid:107) 2 ≥ (cid:107)∇ σ ( x ) (cid:107)
[Equation]
− σ
[Equation]
x
[Equation]
>
η
[Equation]
1 − σ
[Equation]
x
[Equation]
So we have that
[Equation]
Where the last inequality holds by taking C larger than some constant in the deﬁnition of (cid:15) 0 .
Thus (cid:107) y ∗ − (cid:98) y
(cid:107) 2 ≤ 2 − N/ 2 (cid:107) (cid:98) y
(cid:107) 2 , thus (cid:107) y ∗ − (cid:98) y
(cid:107) 2 ≤ 2 · 2 − N/ 2 (cid:107) y ∗ (cid:107) 2 ≤ (cid:15) (cid:107) y ∗ (cid:107) 2 after scaling N up by a factor of log 2 (1 /(cid:15) ) .
Thus by setting v = y ∗ , and observing that (cid:98) y is in the span of A , we ensure (cid:107) P Span ( A ) v (cid:107) 2 ≥ (1 − (cid:15) )
(cid:107) v (cid:107) 2 as desired.
For the ﬁnal claim, note that if we had y ∗ = (cid:98)
y
exactly, we would have (cid:107) P V y ∗ (cid:107) 2 = 0 , since (cid:98) y is orthogonal to the subspace V .
It follows that since (cid:107) y ∗ − (cid:98) y (cid:107) 22 ≤ (cid:15) 2 (cid:107) y ∗ (cid:107) 22 , we have (cid:107) ( I n − P V )
y ∗ (cid:107) 22 ≥ (1 − (cid:15) 2 ) (cid:107) y ∗ (cid:107) 22 , so by the Pythagorean theorem, we have (cid:107) P V y ∗ (cid:107)
= (cid:107) y ∗ (cid:107) 22 − (cid:107) ( I n − P V )
y ∗ (cid:107) 22 ≤ (cid:15) 2 (cid:107) y ∗ (cid:107) 22 as desired.
Theorem 4.3 Suppose the network M ( x ) =
τ ( σ ( A x )) satisﬁes the conditions described at the beginning of this section.
Then Algorithm 2 runs in poly ( N ) time, making at most poly ( N ) queries to M ( x ) , where N = poly ( n, k, 1 γ , (cid:80) di
=1 log( L i ) , (cid:80) di =1 log( κ i ) , log( 1 η ) , log( 1 (cid:15) ) , log( 1 δ )) , and returns with probability 1 − δ a subspace
V ⊂ R n of dimension k such that for any x ∈ V , we have
[Equation]
Proof.
We iteratively apply Lemma 4.2, each time appending the output v ∈ R n of the proposition to the subspace
V ⊂ R n constructed so far.
WLOG we can assume v is a unit vector by scaling it.
Note that we have the property at any given point in time k (cid:48) <
k that V =
Span ( v 1 , . .
. , v k (cid:48) ) where each v i satisﬁes that (cid:107) P Span { v 1 ,...,v i − 1 } v i (cid:107) 2 ≤ (cid:15) .
Note that the latter fact implies that v 1 , . . .
v k (cid:48) are linearly independent.
Thus at the end, we recover a rank k subspace
V =
Span ( v 1 , . .
, v k ) , with the property that (cid:107) P Span ( A ) v i (cid:107) 22 ≥ (1 − (cid:15) ) (cid:107) v i (cid:107) 22 for each i ∈ [ k ] .
Now let V ∈ R n × n be the matrix with i -th column equal to v i .
Fix any unit vector x = V a ∈ V , where a ∈ R n is uniquely determined by x .
Let V
=
V
+
+ V − where V + = P Span ( A ) V and V − =
V − V
+ Then x = V + a + V − a , and
[Equation]
First note that by the construction of the v i ’s, each column of V − has norm O ( (cid:15) ) , thus (cid:107) V − (cid:107) 2 ≤ O ( √ n(cid:15) ) .
Moreover, since (cid:107) x (cid:107) 2 = 1 , it follows that (cid:107) a (cid:107) 2 ≤ 1 σ min ( V ) , which we now bound.
Since (cid:107) P Span { v 1 ,...,v i − 1 } v i (cid:107) 2 ≤ (cid:15) for each i ∈ [ k ] , we have
[Equation]
n
[Equation]
=
[Equation]
v
[Equation]
n
[Equation]
n
[Equation]
=
[Equation]
P
[Equation]
≥ (cid:107) n (cid:88) i =
[Equation]
≥ (cid:0) (cid:107) a (cid:107)
[Equation]
− O
[Equation]
(cid:15) )
(cid:107) a
[Equation]
(cid:1)
[Equation] [Equation]
≥ (1 − O ( (cid:15) ))
(cid:107) a (cid:107)(8)
Thus σ min ( V ) ≥ (1 − O ( (cid:15) )) , so we have (cid:107) ( I n − P Span ( A ) )
x (cid:107) 2 ≤ (cid:107) V − (cid:107)1 σ min ( V ) ≤ 2 √ n(cid:15) .
By the Pythagorean theorem: (cid:107) P Span ( A ) )
x (cid:107) 22 = 1 − (cid:107) ( I n − P Span ( A ) )
x (cid:107) 22 ≥ 1 − O ( n(cid:15) 2 ) .
Thus we can scale (cid:15) by a factor of Θ(1 / √ n ) in the call to Lemma 4.2, which gives the desired result of (cid:107) P Span ( A ) x (cid:107) 2 ≥ 1 − (cid:15) .