Adversarial Robustness of Streaming Algorithms through Importance Sampling
Abstract
In the adversarial streaming model, an adversary gives an algorithm a sequence of adaptively chosen updates as a data stream and the goal of the algorithm is to compute or approximate some predetermined function for every preﬁx of the adversarial stream.
However, the adversary may generate future updates based on previous outputs of the algorithm and in particular, the adversary may gradually learn the random bits internally used by an algorithm to manipulate dependencies in the input.
This is especially problematic as many important problems in the streaming model require randomized algorithms, as they are known to not admit any deterministic algorithms that use sublinear space.
In this paper, we introduce adversarially robust streaming algorithms for central machine learning and algorithmic tasks, such as regression and clustering, as well as their more general counterparts, subspace embedding, low-rank approximation, and coreset construction.
Our results are based on a simple, but powerful, observation that many importance sampling-based algorithms give rise to adversarial robustness in contrast to sketching based algorithms, which are very prevalent in the streaming literature but suffer from adversarial attacks.
In addition, we show that the well-known merge and reduce paradigm used for corset construction in streaming is adversarially robust.
To the best of our knowledge, these are the ﬁrst adversarially robust results for these problems yet require no new algorithmic implementations.
Finally, we empirically conﬁrm the robustness of our algorithms on various adversarial attacks and demonstrate that by contrast, some common existing algorithms are not robust.
Authors listed in alphabetical order.
1 Google 2 Electrical Engineering and Computer Science Department, Massachusetts In- stitute of Technology, Cambridge, MA, USA 3 Computer Science
Department, Carnegie Mellon University, Pittsburgh, PA, USA.
Correspondence to: Samson Zhou <
samsonzhou
[Table] 1. Introduction
Robustness against adversarial attacks have recently been at the forefront of algorithmic design for machine learning tasks (Goodfellow et al., 2015; Carlini & Wagner, 2017;
Athalye et al., 2018; Madry et al., 2018;
Tsipras et al., 2019).
We extend this line of work by studying adversarially robust streaming algorithms.
In the streaming model, data points are generated one at a time in a stream and the goal is to compute some meaningful function of the input points while using a limited amount of memory, typically sublinear in the total size of the input.
The streaming model is applicable in many algorithmic and ML related tasks where the size of the data far exceeds the available storage.
Applications of the streaming model include monitoring IP trafﬁc ﬂow, analyzing web search queries (Liu et al., 2016), processing large scientiﬁc data, feature selection in machine learning (Hou et al., 2021;
Gomes et al., 2019; Wu et al., 2010), and estimating word statistics in natural language processing (Goyal et al., 2012) to name a few.
Streaming algorithms have also been implemented in popular data processing libraries such as Apache
Spark which have implementations for streaming tasks such as clustering and linear regression (Zaharia et al., 2016a).
In the adversarial streaming model (Mitrovic et al., 2017;
Bogunovic et al., 2017; Avdiukhin et al., 2019; Ben-Eliezer & Yogev, 2020; Ben-Eliezer et al., 2020; Hassidim et al., 2020; Woodruff & Zhou, 2020; Alon et al., 2021; Kaplan et al., 2021), an adversary gives an algorithm a sequence of adaptively chosen updates u 1 , . . .
, u n as a data stream.
The goal of the algorithm is to compute or approximate some predetermined function for every preﬁx of the adversarial stream, but the adversary may generate future updates based on previous outputs of the algorithm.
In particular, the adversary may gradually learn the random bits internally used by an algorithm to manipulate dependencies in the input.
This is especially problematic as many important problems in the streaming model require randomized algorithms, as they are known to not admit any deterministic algorithms that use sublinear space.
Studying when adversarially robust streaming algorithms are possible is an important problem in lieu of recent interest in adversarial attacks in ML with applications to adaptive data analysis.
Related Works.
Adversarial robustness of streaming algorithms has been an important topic of recent research.
On the positive note, (Ben-Eliezer et al., 2020) gave a robust framework for estimating the L p norm of points in a stream in the insertion-only model, where previous stream updates cannot later be deleted.
Their work thus shows that deletions are integral to the attack of (Hardt & Woodruff, 2013).
Subsequently, (Hassidim et al., 2020) introduced a new algorithmic design for robust L p norm estimation algorithms, by using differential privacy to protect the internal randomness of algorithms against the adversary.
Although (Woodruff & Zhou, 2020) tightened these bounds, showing that essentially no losses related to the size of the input n or the accuracy parameter ε were needed, (Kaplan et al., 2021) showed that this may not be true in general.
Speciﬁcally, they showed a separation between oblivious and adversarial streaming in the adaptive data analysis problem.
(Ben-Eliezer & Yogev, 2020) showed that sampling is not necessarily adversarially robust; they introduce an exponentially sized set system where a constant number of samples, corresponding to the VC-dimension of the set system, may result in a very unrepresentative set of samples.
However, they show that with an additional logarithmic overhead in the number of samples, then Bernoulli and/or reservoir sampling are adversarially robust.
This notion is further formalized by (Alon et al., 2021), who showed that the classes that are online learnable require essentially sample-complexity proportional to the Littlestone dimension of the underlying set system, rather than VC dimension.
However, these sampling procedures are uniform in the sense that each item in the stream is sampled with the same probability.
Thus the sampling probability of each item is oblivious to the identity of the item.
By contrast, we show the robustness for a variety of algorithms based on non-oblivious sampling, where each stream item is sampled with probability roughly proportional to the “importance” of the item.
1.1. Our Contributions
Our main contribution is a powerful yet simple statement that algorithms based on non-oblivious sampling are adversarially robust if informally speaking, the process of sampling each item in the stream can be viewed as using fresh randomness independent of previous steps, even if the sampling probabilities depend on previous steps.
Let us describe, very informally, our meta-approach.
Suppose we have an adversarial stream of elements given by u 1 , . . .
, u n .
Our algorithm A will maintain a data structure
A t at time t which updates as the stream progresses.
A will use a function g
( A t , u t ) to determine the probability of sampling item u t to update A t to A t +1 .
The function g measures the “importance” of the element u t to the overall problem that we wish to solve.
For example, if our application is k -means clustering and u t is a point far away from all previously seen points so far, we want to sample it with a higher probability.
We highlight that even though the sampling probability for u t given by g ( A t , u t ) is adversarial, since the adversary designs u t and previous streaming elements, the coin toss performed by our algorithm A to keep item u t is independent of any events that have occurred so far, including the adversary’s actions.
This new randomness introduced by the independent coin toss is a key conceptual step in the analysis for all of the applications listed in
Table 1.
Contrast this to the situation where a “ﬁxed” data structure or sketch is speciﬁed upfront.
In this case, we would not be adaptive to which inputs u t the adversary designs to be “important” for our problem which would lead us to potentially disregard such important items rendering the algorithm ineffective.
As applications of our meta-approach, we introduce adversarially robust streaming algorithms for two central machine learning tasks, regression and clustering, as well as their more general counterparts, subspace embedding, low-rank approximation, and coreset construction.
We show that several methods from the streaming algorithms “toolbox”, namely merge and reduce, online leverage score sampling, and edge sampling are adversarially robust “for free.”
As a result, existing (and future) streaming algorithms that use these tools are robust as well.
We discuss our results in more detail below and provide a summary of our results and applications in Table 1.
Meta-approach Applications
Merge and reduce (Theorem 1.1)
Coreset construction, SVMs,
Gaussian mixture models, k -means/median clustering, projective clustering, PCA,
M -estimators
Row sampling (Theorem 1.2)
Linear regression, spectral approximation, low-rank approximation, projection-cost preservation,
L 1 -subspace embedding
We ﬁrst show that the well-known merge and reduce paradigm is adversarially robust.
Since the merge and reduce paradigm deﬁnes coreset constructions, we thus obtain robust algorithms for k -means, k -median, Bregman clustering, projective clustering, principal component analysis (PCA), non-negative matrix factorization (NNMF) (Lucic & Krause, 2017).
Theorem 1.1 (Merge and reduce is adversarially robust)
Given an ofﬂine ε -coreset construction, the merge and reduce framework gives an adversarially robust streaming construction for an ε -coreset with high probability.
For regression and other numerical linear algebra related tasks, we consider the row arrival streaming model, in which the adversary generates a sequence of row vectors a 1 , . . .
, a n in d -dimensional vector space.
For t ∈ [ n ] , the t -th preﬁx of the stream induces a matrix A t ∈ R t × d with rows a 1 , . .
. , a t .
We denote this matrix as A t = a 1 ◦ . . .
◦ a t and deﬁne κ to be an upper bound on the largest condition number 1 of the matrices A 1 , . .
A n .
Theorem 1.2 (Row sampling is adversarially robust)
There is a row sampling based framework for adversarially robust streaming algorithms that at each t ∈ [ n ] : (1) Outputs a matrix M t such that (1 − ε )
A (cid:62) t
A t (cid:22)
M (cid:62) t M t (cid:22) (1 + ε ) A (cid:62) t
A t , while sampling
O (cid:16) d 2 κ ε 2 log n log κ (cid:17) rows (spectral approximation/subspace embedding/linear regression/generalized regression).
(2) Outputs a matrix
M t such that for all rank k orthogonal projection matrices
P
[Equation]
≤ [Equation] (1 + ε ) (cid:107)
A t − A t P (cid:107) 2 F , while sampling O (cid:0) dkκε 2 log n log 2 κ (cid:1) rows (projection-cost preservation/low-rank approximation).
(3) Outputs a matrix M t such that (1 − ε ) (cid:107)
A t x (cid:107) 1 ≤ (cid:107) M t x (cid:107)≤ (1 + ε ) (cid:107)
A t x (cid:107) 1 , while sampling O (cid:16) d 2 κ ε 2 log 2 n log κ (cid:17) rows ( L 1 subspace embedding).
Finally, we show that our analysis also applies to algorithms for graph sparsiﬁcation in which edges are sampled according to their “importance”.
See the appendix for details.
Sketching vs Sampling Algorithms.
A central tool for randomized streaming algorithms is the use of linear sketches.
These methods maintain a data structure f such that after the ( i +1) -th
input x i , we can update f by computing a linear function of x i .
Typically, these methods employ a random matrix.
For example, if the input consists of vectors, sketching methods will use a random matrix to project the vector into a much smaller dimension space.
In (Hardt &
Woodruff, 2013), it was proved no linear sketch can approximate the L 2 -norm within a polynomial multiplicative factor against such an adaptive adversary.
In general, streaming algorithms that use sketching are highly susceptible to the type of attack described in (Hardt & Woodruff, 2013) where the adversary can effectively “learn” the kernel of the linear function used and send inputs along the kernel.
For example, if an adversary knows the kernel of the random matrix used to project the input points, then by sending points that lie on the kernel of the matrix as inputs, the adversary can render the whole streaming algorithm useless.
One the other hand, we employ a different family of streaming algorithms that are based on sampling the input rather than sketching it.
Surprisingly, this simple change allows one to automatically get many adversarially robust algorithms either “for free” or without new algorithmic overheads.
For more information, see Section 1.1.
We emphasize that while our techniques are not theoretically sophisticated, we believe its power lies in its simple message that sampling is often superior to sketching for adversarial robustness .
In addition to downstream algorithmic and
ML applications, this provides an interesting separation and trade-offs between the two paradigms; for non-adversarial inputs sketching often gives similar or better performance guarantees for many tasks (Bar-Yossef et al., 2001).
2. Experiments
To illustrate the robustness of importance sampling based streaming algorithms, we devise adversarial settings for clustering and linear regression.
With respect to our adversarial setting, we show that the performance of a mergeand-reduce based streaming k -Means algorithm is robust while a popular streaming k -Means implementation (not based on importance sampling) is not.
Similarly, we show the robustness superiority of a streaming linear regression algorithm based on row sampling over a popular streaming linear regression implementation and over sketching.
Streaming k -means In this adversarial clustering setting
we consider a series of point batches where all points except those in the last batch are randomly sampled from a two dimensional standard normal distribution and points in the last batch similarly sampled but around a distant center (see the data points realization in both panels of Figure 1).
We then feed the point sequence to StreamingKMeans , the streaming k -Means implementation of Spark (Zaharia et al., 2016b)
the popular big-data processing framework.
As illustrated in the left panel of Figure 1, the resulting two centers are both within the origin.
Now, this result occurs regardless of the last batch’s distance from the origin, implying that the per-sample loss performance of the algorithm can be made arbitrarily large.
Alternatively, we used a merge and reduce based streaming k -Means algorithm and show that one of the resulting cluster centers is at the distant cluster (as illustrated in the right panel of Figure 1) thereby keeping the resulting per sample loss at the desired minimum.
Speciﬁcally we use Streamkm an implementation of StreamKM++ (Ackermann et al., 2012) from the ClusOpt
[Figure]
[Figure] [Figure] [Figure] [Figure]
[Figure] [Figure]
[Figure]
Core library (Macedo, 2020).
Streaming linear regression.
Similar to the clustering setting, in the adversarial setting for streaming linear regression all batches except the last one are sampled around a constellation of four points in the plane such that the optimal regression line is of − 1 slope through the origin (see the leftmost panel of Figure 2).
The last batch of points however, is again far from the origin ( L, L ) such that the resulting optimal regression line is of slope 1 through the origin 2 .
We compare the performance of LinearRegression from the popular streaming machine learning library River (Montiel et al., 2020) to our own row sampling based implementation of streaming linear regression along the lines of Algorithm 1 and observe the following: Without the last batch of points, both implementations result in the optimal regression line, however, the River implementation reaches that line only after several iterations, while our implementation is accurate throughout (This is illustrated in the second-left panel of Figure 2).
When the last batch is used, nevertheless, Algorithm 1 picks up the drastic change and adapts immediately to a line of the optimal slope (the blue line of the second right panel of Figure 2) while the
River implementation update merely moves the line in the desired direction (the orange line in that same panel) but is far from catching up.
Finally, the rightmost panel of Figure 2) details the loss trajectory for both implementations.
While the River loss skyrockets upon the last batch, the loss of Algorithm 1 remains relatively unaffected, illustrating its adversarial robustness.
Note that in both the clustering and linear regression settings above, the adversary was not required to consider the algorithms internal randomization to achieve the desired effect (this is due to the local nature of the algorithms computations).
This is not the case in the following setting.
Sampling vs. sketching.
Finally, we compare the performance of the leverage sampling Algorithm 1 to Sketching.
In this setting, for a random unit sketching matrix S (that is, each of its elements is sampled from {− 1 , 1 } with equal probability), we create an adversarial data stream A such that its columns are in the null space of S .
As a result, the linear regression as applied to the sketched data S · A as a whole is unstable and might signiﬁcantly differ from the resulting linear regression applied to streamed preﬁxes of the sketched data.
As illustrated in Figure 3, this is not the case when applying the linear regression to the original streamed data A using Algorithm 1.
Upon the last batch, the performance of the sketching-based regression deteriorates by orders of magnitude, while the performance of Algorithmis not affected.
Moreover, the data reduction factor achieved by leveraged sampling 3 is almost double compared to the data reduction factor achieved by sketching. Acknowledgments
Sandeep Silwal was supported in part by a NSF Graduate
Research Fellowship Program.
Samson Zhou was supported by a Simons Investigator Award of David P. Woodruff.
com -oliveira/clusopt_core . K. The network data repository with interactive graph analytics and visualization. In http://networkrepository.
//doi.org/10.1145/2934664 .
A. Merge and Reduce
We show that the general merge and reduce paradigm is adversarially robust.
Merge and reduce is widely used for the construction of a coreset, which provides dimensionality reduction on the size of an underlying dataset, so that algorithms for downstream applications can run more efﬁciently:
Deﬁnition A.1 ( ε coreset) Let P ⊂ X be a set of elements from a universe X , z ≥ 0 , ε ∈ (0 , 1) , and ( P, dist , Q ) be a query space.
Then a subset C equipped with a weight function w : P → R is called an ε -coreset with respect to the query space ( P, dist , Q ) if
[Equation]
The study of efﬁcient ofﬂine coreset constructions for a variety of geometric and algebraic problems forms a long line of active research.
For example, ofﬂine coreset constructions are known for linear regression, low-rank approximation, L 1 -subspace embedding, k -means clustering, kmedian clustering, k -center, support vector machine, Gaussian mixture models, M -estimators, Bregman clustering, projective clustering, principal component analysis, k -line center, j -subspace approximation, and so on.
Thus, our result essentially shows that using the merge and reduce paradigm, these ofﬂine coreset constructions can be extended to obtain robust and accurate streaming algorithms.
The merge and reduce paradigm works as follows.
Suppose we have a stream p 1 , . .
, p n of
Stream: [Equation] [Figure] some integer k , without loss of generality (otherwise we can use a standard padding argument to increase the length of the stream).
Deﬁne C 0 ,j = p j for all j ∈ [ n ] .
Consider k levels, where each level i ∈ [ k ] consists of n 2 i coresets
C i, 1 , . . .
, C i,n/ 2 i and each coreset C i,j is an ε 2 k -coreset of
C i − 1 , 2 j − 1 and C i − 1 , 2 j .
Note that this approach can be implemented efﬁciently in the streaming model, since each
C i,j can be built immediately once C i − 1 , 2 j − 1 and C i − 1 , 2 j are constructed, and after C i,j is constructed, then both
C i − 1 , 2 j − 1 and C i − 1 , 2 j can be discarded.
For an illustration of the merge and reduce framework, see Figure 4, though we defer all formal proofs to Section D. Using the coresets of (Braverman et al., 2020), Theorem 1.1 gives the following applications:
Theorem A.2 There exists a merge-and-reduce row sampling based framework for adversarially robust streaming algorithms that at each time t ∈ [ n ] :
(1) Outputs a matrix M t such that (1 − ε )
A (cid:62) t
A t (cid:22) M (cid:62) t M t (cid:22) (1 + ε ) A (cid:62) t
A t , while sampling O (cid:16) d 2 ε 2 log 4 n log κ (cid:17) rows (spectral approximation/subspace embedding/linear regression/generalized regression).
(2) Outputs a matrix M t such that for all rank k orthogonal projection matrices
P ∈ R d × d , (1 − ε ) (cid:107)
A t − A t P (cid:107) 2 F ≤ (cid:107) M t − M t P (cid:107) 2 F ≤ (1 + ε ) (cid:107)
A t − A t P (cid:107) 2 F , while sampling O (cid:0) kε 2 log 4 n log 2 κ (cid:1) rows (projectioncost preservation/low-rank approximation).
(3) Outputs a matrix M t such that (1 − ε ) (cid:107)
A t x (cid:107) 1 ≤ (cid:107) M t x (cid:107)≤ (1 + ε ) (cid:107)
A t x (cid:107) 1 , while sampling
O (cid:0) dε 2 log 5 n log κ (cid:1) rows ( L 1 subspace embedding).
Using coresets of (Huang & Vishnoi, 2020), then Theorem 1.1 also gives applications for ( k, z ) -clustering such as k -median for z = 1 and k -means for z = 2 .
Moreover, (Lucic & Krause, 2017) noted that constructions of (Feldman & Langberg, 2011) give coresets for Bregman clustering, which handles µ -similar Bregman divergences such as the Itakura-Saito distance, KL-divergence, Mahalanobis distance, etc.
Theorem A.3 There exists a merge-and-reduce importance sampling based framework for adversarially robust streaming algorithms that at each time t : (1) Outputs a set of centers that gives a (1 + ε ) -approximation to the optimal ( k, z ) - clustering, k -means clustering ( z = 2 ), and
k
median clustering ( z
[Equation]
1 ), while
storing
[Equation]
(2) Outputs a set of centers that gives a (1 + ε ) - approximation to the optimal k -Bregman clustering, while storing O (cid:0) 1 ε 2 dk 3 log 3 n (cid:1) points.
Using the sensitivity bounds of (Varadarajan & Xiao, 2012a;b) and the coreset constructions of (Braverman et al., 2016), then Theorem 1.1 also gives applications for the following shape ﬁtting problems:
Theorem A.4 There exists a merge-and-reduce importance sampling based framework for adversarially robust streaming algorithms that at each time t :
(1) Outputs a set of lines that gives a (1+ ε ) -approximation to the optimal k -lines clustering, while storing O (cid:0) dε 2 f ( d, k ) k
f ( d,k ) log 4 n (cid:1) points of R d , for a ﬁxed function f ( d, k ) .
(2) Outputs a subspace that gives a (1 + ε ) -approximation to the optimal dimension j subspace approximation, while storing O (cid:0)
dε 2 g
( d, j ) k g ( d,j ) log 4 n (cid:1) points of R d , for a ﬁxed function g ( d, j ) .
(3) Outputs a set of subspaces that gives a (1 + ε ) -approximation to the optimal ( j, k ) -projective clustering, while storing O (cid:0)
dε 2 h
( d, j, k ) log 3 n (log n ) h
( d,j,k ) (cid:1) points of R d s, for a ﬁxed function
h ( d, j, k ) , for a set of input points with integer coordinates.
Adversarially robust approximation algorithms for Bayesian logistic regression, Gaussian mixture models, generative adversarial networks (GANs), and support vector machine can be obtained from Theorem 1.1 and coreset constructions of (Huggins et al., 2016; Feldman et al., 2019; Sinha et al., 2020; Tukan et al., 2020); a signiﬁcant number of additional applications of Theorem 1.1 using coreset constructions can be seen from recent works and surveys on coresets, e.g., see (Lucic & Krause, 2017; Feldman, 2020).
B. Adversarial Robustness of Subspace Embedding and Applications
We use [ n ] to represent the set { 1 , . . . , n } for an integer n > 0 .
We typically use bold font to denote vectors and matrices.
For a matrix A , we use A − 1 to denote the MoorePenrose inverse of A .
We ﬁrst formally deﬁne the goals of our algorithms:
Problem B.1 (Spectral Approximation) Given a matrix
A ∈ R n × d and an approximation parameter ε > 0 , the goal is to output a matrix M ∈ R m × d with m (cid:28) n such that (1 − ε ) (cid:107) Ax (cid:107) 2 ≤ (cid:107)
Mx (cid:107) 2 ≤ (1 + ε ) (cid:107) Ax (cid:107) 2 for all x ∈ R d or equivalently, (1 − ε )
A (cid:62) A (cid:22) M (cid:62) M (cid:22) (1 + ε )
A (cid:62) A .
We note that linear regression is a well-known speciﬁc application of spectral approximation.
Problem B.2 (Projection-Cost Preservation) Given a matrix A ∈ R n × d , a rank parameter k > 0 , and an approximation parameter ε > 0 , the goal is to ﬁnd a matrix M ∈ R m × d with m (cid:28) n such that for all rank k orthogonal projection matrices P ∈ R d × d , (1 − ε )
[Equation]
Note if M is a projection-cost preservation of A , then its best low-rank approximation can be used to ﬁnd a projection matrix that gives an approximation of the best low-rank approximation to A .
Problem B.3 (Low-Rank Approximation)
Given a matrix A ∈ R n × d , a rank parameter k > 0 , and an approximation parameter ε > 0 , ﬁnd a rank k matrix M ∈ R n × d such that (1 − ε ) (cid:13)(cid:13)
A − A ( k ) (cid:13)(cid:13) 2 F ≤ (cid:107)
A − M (cid:107) 2 F ≤ (1 + ε ) (cid:13)(cid:13)
A − A ( k ) (cid:13)(cid:13) 2 F , where A ( k ) for a matrix
A denotes the best rank k approximation to A .
Problem B.4 ( L 1 -Subspace Embedding)
Given a matrix
A ∈ R n × d and an approximation parameter ε > 0 , the goal is to output a matrix M ∈ R m × d with m (cid:28) n such that (1 − ε ) (cid:107) Ax (cid:107) 1 ≤ (cid:107)
Mx (cid:107) 1 ≤ (1 + ε ) (cid:107) Ax (cid:107) 1 for all x ∈ R d .
We consider the general class of row sampling algorithms, e.g., (Cohen et al., 2016; Braverman et al., 2020).
Here we maintain a L p subspace embedding of the underlying matrix by approximating the online L p sensitivities of each row as a measure of importance to perform sampling.
For more details, see Algorithm 1.
Deﬁnition B.5 (Online L p Sensitivities)
For a matrix
A = a 1 ◦ . . .
◦ a n ∈ R n × d , the online sensitivity of row a i for each i ∈ [ n ] is the quantity max x ∈ R d |(cid:104) a i , x (cid:105)| p (cid:107)
A i x (cid:107) pp , where
A i − 1 = a 1 ◦ . . .
◦ a
i − 1 .
Algorithm et al., Input: A stream of rows a 1 , . .
. , a n ∈ R d , parameter p > 0 , and an accuracy parameter ε > Output: A (1 + ε ) L p subspace embedding.
1: M ← ∅ 2: α ← Cdε 2 log n with sufﬁciently large parameter C >3: for each row a i , i ∈ [ n ] do 4: if a i ∈ span( M ) then 5: τ i ← 2 · max x ∈ R d , x ∈ span( M ) |(cid:104) a i , x (cid:105)| p (cid:107)
Mx (cid:107) pp + |(cid:104) a i , x (cid:105)| p (cid:46) See Remark B.
6: else 7: τ i ←8: p i ← min(1 , ατ i ) 9:
With probability p i , M ← M ◦ a i p 1 /pi
(cid:46)
Online sensitivity sampling {+
 :+} return M
We remark on standard computation or approximation of the online L p sensitivities, e.g., see (Cohen et al., 2015; 2016; 2017; Braverman et al., 2020).
Remark B.
We note that for p = 1 , a constant fraction approximation to any online L p sensitivity τ
i such that τ i > 1 poly( n ) can be computed in polynomial time using (ofﬂine) linear programming while for p = 2 , τ i is equivalent to the online leverage score of a i , which has the closed form expression a (cid:62) i
( A (cid:62) i
A i ) − 1 a i , which can be approximated by a (cid:62)
i ( M (cid:62) M ) − 1 a i , conditioned on M being a good approximation to A
i − 1 when a i is in the span of M .
Otherwise, τ i takes value 1 when a i is not in the span of M .
Lemma B.7 ( Adversarially Robust L p Subspace
Embedding and Linear Regression )
Given ε > 0 , p ∈ { 1 , 2 } , and a matrix A ∈ R n × d whose rows a 1 , . . .
, a n arrive sequentially in a stream with condition number at most κ , there exists an adversarially robust streaming algorithm that outputs a (1 + ε ) spectral approximation with high probability.
The algorithm samples O (cid:16) d 2 κ 2 ε 2 log n log κ (cid:17) rows for p = 2 and O (cid:16) d 2 λ
ε 2 log 2 n log κ (cid:17) rows for p
= 1 , with high probability, where λ is a ratio between upper and lower bounds on (cid:107) A (cid:107) 1 .
We also show robustness of row sampling for low-rank approximation by using online ridge-leverage scores.
Together,
Lemma B.7 and Lemma B.8 give Theorem 1.2.
Lemma B.8 ( Adversarially Robust Low-Rank Approximation )
Given accuracy parameter ε > 0 , rank parameter k > 0 , and a matrix A ∈ R n × d whose rows a 1 , . . .
, a n arrive sequentially in a stream with condition number at most κ , there exists an adversarially robust streaming algorithm that outputs a (1 + ε ) low-rank approximation with high probability.
The algorithm samples O (cid:16) kdκ 2 ε 2 log n log κ (cid:17) rows with high probability.
C. Graph Sparsiﬁcation
In this section, we highlight how the sampling paradigm gives rise to an adversarially robust streaming algorithm for graph sparsiﬁcation.
First, we motivate the problem of graph sparsiﬁcation.
Massive graphs arise in many theoretical and applied settings, such as in the analysis of large social or biological networks.
A key bottleneck in such analysis is the large computational resources, in both memory and time, needed.
Therefore, it is desirable to get a representation of graphs that take up far less space while still preserving the underlying “structure” of the graph.
Usually the number of vertices is much fewer than the number of edges; for example in typical real world graphs, the number of vertices can be several orders of magnitude smaller than the number of edges (for example, see the graph datasets in (Rossi &
Ahmed, 2015)).
Hence, a natural benchmark is to reduce the number of edges to be comparable to the number of vertices.
The most common notion of graph sparsiﬁcation is that of preserving the value of all cuts in the graph by keeping a small weighted set of edges of the original graph.
More speciﬁcally, suppose our graph is G =
( V, E ) and for simplicity assume all the edges have weight 1 .
A cut of the graph is a partition of V =
( C, V \ C ) and the value of a cut, Val G ( C ) , is deﬁned as the number of edges that cross between the vertices in C and V \ C .
A graph H on the same set of vertices as V is a sparsiﬁer if it preserves the value of every cut in G and has a few number of weighted edges.
For a precise formulation, see Problem C.1.
In addition to being algorithmically tractable, this formulation is natural since it preserves the underlying cluster structure of the graph.
For example, if there are two well connected components separated by a sparse cut, i.e. two distinct communities, then the sparsiﬁer according to the definition above will ensure that the two communities are still well separated.
Conversely, by considering any cut within a well connected component, it will also ensure that any community remains well connected (for more details, see (Satuluri et al., 2011) and references therein).
Lastly, graph sparsiﬁcation has been considered in other frameworks such as differential privacy (Eli´as et al., 2020), distributed optimization (Wangni et al., 2018), and even learning graph sparsiﬁcation using deep learning methods (Zheng et al., 2020).
The formal problem deﬁnition of graph sparsiﬁcation is as follows.
Problem C.1 (Graph Sparsiﬁcation)
Given a graph weighted G =
( V, E ) with | V | = n, | E | = m, and an approximation parameter ε > 0 , compute a weighted subgraph H of G on the same set of vertices such that (1) every cut in H has value between 1 −
ε and
+
ε times its value in G : ( −
ε Val G ( C ) ≤ Val H ( C ) ≤ (1 + ε ) Val G ( C ) for all cuts C where Val G ( C ) , Val H ( C ) denotes the cost of the cut in the graphs G and H respectively and for the latter quantity, the edges are weighted,
(2) the number of edges in H is O (cid:16) n log n ε 2 (cid:17) .
Ignoring dependence on ε , there are previous results that already get sparsiﬁers H with O ( n log n ) edges (Bencz ´ ur &
Karger, 1996; Spielman & Srivastava, 2008).
Their setting is when the entire graph is present up-front in memory.
In contrast, we are interested in the streaming setting where future edges can depend on past edges as well as revealed randomness of an algorithm while processing the edges.
Our main goal is to show that the streaming algorithm from (Ahn & Guha, 2009) (presented in Algorithm 2 in Section
F), which uses a sampling procedure to sample edges in a stream, is adversarially robust, albeit with a slightly worse guarantee for the number of edges.
Following the proof techniques of the non streaming algorithm given in (Bencz´ur & Karger, 1996), it is shown in (Ahn & Guha, 2009) that
Algorithm 2 outputs a subgraph H such that H satisﬁes the conditions of Problem C.1 with probability 1 − 1 / poly( n ) where the probability can be boosted by taking a larger constant C .
We must show that this still holds true if the edges of the stream are adversarially chosen, i.e., when new edges in the stream depend on the previous edges and the randomness used by the algorithm so far.
We thus again use a martingale argument; the full details are given in Section F.
As in Section B, we let κ 1 and κ 2 to be deterministic lower/upper bounds on the size of any cut in
G and deﬁne κ = κ 2 /κ 1 .
Theorem C.2 Given a weighted graph G =
( V, E ) with | V | = n whose edges e 1 , . . .
, e m arrive sequentially in a stream, there exists an adversarially robust streaming algorithm that outputs a 1 ± ε cut sparsiﬁer with O (cid:16) κ 2 n log n ε(cid:17) edges with probability 1 − 1 / poly( n ) .
D. Missing Proofs from Section A
In this section, we give the full details of the statements in Section A. Coreset constructions are known for a variety of problems, e.g., in computational geometry (Feldman et al., 2010; Feldman & Langberg, 2011; Braverman et al., 2016; Lucic & Krause, 2017; Sohler & Woodruff, 2018; Braverman et al., 2019; Huang & Vishnoi, 2020; Feldman, 2020), linear algebra (Braverman et al., 2020), machine learning (Munteanu et al., 2018; Baykal et al., 2019; Mussay et al., 2020).
We ﬁrst show that coreset construction is adversarially robust by considering the merge and reduce framework.
For example, consider the ofﬂine coreset construction through sensitivity sampling.
Lemma D.1 (Lemma 2.3 in (Lucic & Krause, 2017))
Given ε > 0 and δ ∈ (0 , 1) , let P be a set of weighted points, with non-negative weight function µ : P → R ≥and let s : P → R ≥ 0 denote an upper bound on the sensitivity of each point.
For S = (cid:80) p ∈ P µ ( p ) s ( p ) , let m
= Ω (cid:16) S 2 ε 2 (cid:0) d (cid:48)
+ log 1 δ (cid:1)(cid:17) , where d (cid:48) is the pseudodimension of the query space.
Let C be a sample of m points from P with replacement, where each point p ∈ P is sampled with probability q ( p ) = µ ( p ) s ( p ) S and assigned the weight µ ( p ) m · q ( p ) if sampled.
Then C is an ε -coreset of P with probability at least 1 − δ .
We ﬁrst observe that any streaming algorithm that uses linear memory is adversarially robust because intuitively, it can recompute an exact or approximate solution at each step.
Lemma D.2 Given a set of points P , there exists an ofﬂine adversarially robust construction that outputs an ε -coreset of P with probability at least 1 − δ .
Proof :
Given an adversary A , let P = p 1 , . .
. , p n be a set of points such that each p i with i ∈ [ n ] is generated by
A , possibly as a function of p 1 , . . .
, p i − 1 .
For example, it may be possible that the points p 1 , . .
, p n/ 2 are a coreset of some set of points P 1 and the points p n/ 2+1 , . .
p n (1) were either generated with full knowledge of p 1 , . .
. , p n/or (2) are a coreset of a set of points P 2 generated with full knowledge of P 1 .
Let s ( p ) be an upper bound on the sensitivity of each point in P and consider the sensitivity sampling procedure described in Lemma D.1.
We would like to sample each point with probability q ( p ) .
Each point in C is chosen to be p with probability q ( p ) .
However, if our algorithm generates internal randomness to perform this sampling procedure, it may be possible for an adversary to either learn correlations with the internal randomness or even learn the internal randomness entirely (such as the seed of a pseudorandom generator).
Thus the choice for each point of C may no longer be independent, so we are no longer guaranteed that the resulting construction is a coreset.
Instead, suppose the randomness used by the algorithm at time i in the sampling procedure is independent of the choices of p 1 , . .
, p i − 1 , e.g., the algorithm has access to a source of fresh public randomness at each time in the data stream.
Then the algorithm can generate C independent of the choices of p 1 , . .
. , p i − 1 .
Thus by Lemma D.1, C is an ε -coreset of P with probability at least 1 − δ .
(cid:50)
We emphasize that Lemma D.2 shows that any ofﬂine coreset construction is adversarially robust; the example of sensitivity sampling is speciﬁcally catered to our applications of the merge and reduce framework to clustering.
We now prove our main statement.
Proof of Theorem 1.1: Let δ = 1 poly( n ) and consider an ε -coreset construction with failure probability δ .
We prove that the merge and reduce framework gives an adversarially robust construction for an ε -coreset with probability at least 1 − 2 nδ .
We consider a proof by induction on an input set P of n points, supposing that n = 2 k for some integer k > 0 .
Observe that C 0 ,j is a coreset of p j for j ∈ [ n ] since
C 0 ,j = p j .
Let E i be the event that for a ﬁxed i ∈ [ k ] that
C i − 1 ,j is an ε 2 k -coreset of C
i − 1 , 2 j − 1 and C i − 1 , 2 j for each j ∈ (cid:2) n
i − 1 (cid:3) .
By Lemma D.2, it holds that for a ﬁxed j , C i,j is an ε 2 k -coreset of C
i − 1 , 2 j − 1 and C i − 1 , 2 j with probability at least 1 − δ .
By a union bound over n 2 i − 1 possible indices j , we have that for a ﬁxed i , all C i,j are ε 2 k -coresets of
C i − 1 , 2 j − 1 and C i − 1 , 2 j with probability at least 1 − n
i − 1 · δ .
Thus, Pr [ E i +1 ] ≥ 1 − nδ
i − 1 , which completes the induction.
Hence with Pr (cid:2) ∪ ki =
E i (cid:3) , we have that the cost induced by
C k, 1 is a (cid:0) 1 + ε 2 k (cid:1)
k -approximation to the cost induced by P .
Since (cid:0) 1 + ε 2 k (cid:1) k ≤ e ε/ 2 ≤ 1 + ε , then C k, 1 is an ε -coreset of P with probability Pr (cid:2) ∪ ki =
E i (cid:3) .
By a union bound, we have that Pr (cid:2) ∪ ki =
E i (cid:3) [Equation] ≥ 1 − [Equation]
nδ . [Equation]
E. Missing Proofs from Section B
Theorem E.1 (Freedman’s inequality) (Freedman, 1975)
Suppose Y 0 , Y 1 , . . .
, Y n is a scalar martingale with difference sequence X 1 , . . .
, X n .
Speciﬁcally, we initiate Y 0 =and set Y i
=
Y i − 1 + X i for all i ∈ [ n [ Let R ≥ | X t | for all t ∈ [ n ] with high probability.
We deﬁne the predictable quadratic variation process of the martingale by w k := (cid:80) kt
=1 E t − 1 (cid:2)
X 2 t (cid:3) , for k ∈ [ n ] .
Then for all ε ≥ 0 and σ 2 > 0 , and every k ∈ [ n ] ,
Pr (cid:20) max t ∈ [ k ] | Y t | > ε and w k ≤ σ(cid:21) ≤ 2 exp (cid:18) − ε 2 /σ 2 + Rε/(cid:19) .
We ﬁrst show robustness of our algorithm by justifying correctness of approximation for L p norms.
Lemma E.2 ( L p subspace embedding) Suppose ε > 1 n , p ∈ { 1 , 2 } , and C > κ p , where κ is an upper bound on the condition number of the stream.
Then Algorithm 1 returns a matrix M such that for all x ∈ R d ,
[Equation]
with high probability.
Proof :
Consider an arbitrary x ∈ R d and suppose ε ∈ (0 , 1 / 2) with ε > 1 n .
We claim through induction the stronger statement that |(cid:107) M j x (cid:107) pp − (cid:107) A j x (cid:107) pp | ≤ ε (cid:107)
A j x (cid:107)
pp for all times j ∈ [ n ] with high probability.
Here M j is the matrix consisting of the rows of the input matrix A that have already been sampled at time j and A j = a 1 ◦ . . .
◦ a j . Note that either a 1 is the zero vector or p 1 = 1 , so that either way, we have M
=
A 1 for our base case.
We assume the statement holds for all j ∈ [ n − 1] and prove it must hold for j = n .
We implicitly deﬁne a martingale Y 0 , Y 1 , . . .
, Y n through the difference sequence X 1 , . . .
, X n , where for j ≥ 1 , we set X j =
if Y j − 1 > ε (cid:107) A j − 1 x (cid:107) pp
and otherwise if Y j − 1 ≤ ε (cid:107)
A j − 1 x (cid:107) pp , we set
X j = (cid:40)(cid:16) 1 p j − 1 (cid:17) | a (cid:62) j x | p if a j is sampled in M −| a (cid:62)
j x | p otherwise .
Since E [ Y j | Y 1 , . .
Y j − 1 ] =
Y j − 1 , then the sequence
Y 0 , . .
, Y n induced by the differences is indeed a valid martingale.
Furthermore, by the design of the difference sequence, we have that Y j = (cid:107) M j x (cid:107) pp − (cid:107)
A j x (cid:107) pp .
If p j = 1 , then a j is sampled in M j , so we have that
X j = 0 .
Otherwise, we have that [
[Equation]
p
[Equation]
| a (cid:62) j x | 2 p .
For p j < 1 , then we have p j = ατ j and thus E (cid:2) Xj | Y 1 , . . .
, Y j − 1 (cid:3) ≤ 1 ατ j | a (cid:62)
j x | 2 p .
By the deﬁnition of τ j and the inductive hypothesis that |(cid:107) M j − 1 x (cid:107) pp − (cid:107)
A j − 1 x (cid:107) pp (cid:107) ≤ ε (cid:107)
A j − 1 x (cid:107) pp < 12 (cid:107)
A j − 1 x (cid:107) pp , then we have τ j ≥ 2 | a (cid:62) j x | p (cid:107) [Equation]
[Equation] (cid:107)
[Equation]
| a (cid:62) j x | p ≥ | a (cid:62) j x | p (cid:107) [Equation]
(cid:107) pp
[Equation] | a (cid:62) j
[Equation]
| p = | a (cid:62) j x | p (cid:107) A j x (cid:107) pp ≥ | a (cid:62) j x | p (cid:107)
[Equation]
Thus, [Equation]
Moreover, we have that | X j | ≤ 1 p j | a (cid:62) j x | p .
For p j = 1 , we have 1 p j | a (cid:62) j x | p ≤ (cid:107) A j x (cid:107) pp ≤ (cid:107)
Ax (cid:107)
pp .
For p j < 1 , we have p j = ατ j < 1 .
Again by the deﬁnition of τ j and by the inductive hypothesis that |(cid:107) M
[Equation]
− 1 x (cid:107) pp − (cid:107) A
[Equation]
1 x (cid:107) pp (cid:107) ≤ ε
[Equation]
x
[Equation]
pp
[Equation]
1 x (cid:107) pp , we have that
[Equation]
Hence for α =
Cdε 2 log n , it follows that
[Equation]
We would like to apply Freedman’s inequality (Theorem E.1) with σ 2 = (cid:107) [-Ax (cid:107) 
-][Equation]
for α = O (cid:0) dε 2 log n (cid:1) and R ≤
[Equation] log n (cid:107) Ax (cid:107) pp , as in (Braverman et al., 2020).
However, in the adversarial setting we won’t be able bound the probability that | Y n | exceeds ε (cid:107)
Ax | pp using Freedman’s inequality as the latter is a random variable.
Thus we instead assume that κ 1 , κ 2 are constants so that for p = 1 , we have κ 1 and κ 2 are lower and upper bounds on (cid:107) A (cid:107) 1 and for p = 2 , we have that κ 1 and κ 2 are lower and upper bounds on the singular values of A .
We are now ready to apply Freedman’s inequality with σ 2 ≤ κ 2 p 2 (cid:107) x (cid:107) 2 pp α for α = O (cid:0) dε 2 log n (cid:1) and R ≤ 2 ε 2 d log n κ p 2 (cid:107) x (cid:107) pp .
By Freedman’s inequality, we have that
[Equation]
for sufﬁciently large C > ( κ 1 /κ 2 ) p .
Note for p = 2 , we have the upper bound on the condition number κ ≥ κ 1 /κso
it sufﬁces to set C = κ 2 .
Since κ p 1 (cid:107) x (cid:107) pp ≤ (cid:107) Ax (cid:107) pp , then we have
[Equation]
Thus | (cid:107) Mx (cid:107)
pp − (cid:107) Ax (cid:107) pp | ≤ ε (cid:107)
Ax (cid:107) pp with probability at least 1 − 1 2 d poly( n ) .
By a rescaling of ε since p ≤ 2 , we thus have that | (cid:107) Mx [Equation] p with probability at least 1 −
[Equation]
We now show that we can union bound over an ε -net.
We ﬁrst deﬁne the unit ball B = { Ay ∈ R n | (cid:107)
Ay (cid:107) p = 1 } .
We also deﬁne N to be a greedily constructed ε -net of B .
Since balls of radius ε 2 around each point cannot overlap, but must all ﬁt into a ball of radius 1+ ε 2 , then it follows that
N has at most (cid:0) 3 ε (cid:1)
d points.
Therefore, by a union bound for 1 ε < n , we have | (cid:107) My (cid:107) p − (cid:107)
Ay (cid:107) p | ≤ ε (cid:107)
Ay (cid:107) p for all
Ay ∈ N , with probability at least 1 − 1 poly( n ) .
We now argue that accuracy on this ε -net implies accuracy everywhere.
Indeed, consider any vector z ∈ R d normalized to (cid:107) Az (cid:107) p = 1 .
We shall inductively deﬁne a sequence
Ay 1 ,
Ay 2 , . . .
such that (cid:13)(cid:13)(cid:13) Az − (cid:80) ij =
Ay j (cid:13)(cid:13)(cid:13) p ≤ ε i and there exists some constant γ i ≤ ε i − 1 with 1 γ i
Ay i ∈ N for all i .
Deﬁne our base point
Ay 1 to be the closest point to
Az in the ε -net N .
Then since N is a greedily constructed ε -net, we have that (cid:107) Az −
Ay 1 (cid:107) p ≤ ε .
Given a sequence
Ay 1 , . . .
, Ay i − 1 such that γ i := (cid:13)(cid:13)(cid:13)
Az − (cid:80) i − 1 j =
Ay j (cid:13)(cid:13)(cid:13) p ≤ ε i − 1 , note that 1 γ i (cid:13) (cid:13) (cid:13) Az − (cid:80) i − 1 j =
Ay j (cid:13) (cid:13) (cid:13) p = 1 .
Thus we inductively deﬁne the point Ay i ∈ N so that Ay i is within distance ε of Az − (cid:80) i − 1 j =
Ay j .
Therefore, |
[Equation]
Az
[Equation]
which completes the induction for time n .
[Equation]
E.1. Adversarially Robust Spectral Approximation
We observe that Lemma E.2 provides adversarial robustness for free.
Lemma E.3 (Adversarially robust spectral approximation )
Algorithm 1 is adversarially robust.
Proof :
Let us inspect the proof of Lemma E.2.
Observe that since the adversary can observe the past data and the past randomness of Algorithm 1, then the rows a i are random variables that depend on the history and the randomness of the algorithm.
In other words, a i is measurable with respect to the sigma algebra generated by a 1 , . . .
, a i − 1 , B 1 , . . .
, B i − 1 , C i where B i is the indicator of the event that we sample row a i in Algorithm 1 and C
i is the random vector generated by the adversary at step i to create row a i .
Denote
F i the sigma algebra generated by a 1 , . . .
, a i − 1 , B 1 , . . .
B i − 1 , C i .
Then a i is measurable with respect to F i .
Let us remind that Y
j = Y j − 1 + X j
and let us observe that the deﬁnition of X j in Equation (1) can be rewritten as [Equation] [Table] [Equation]
[Table]
I Y j
[Equation]
<
[Equation]
It can be easily checked that
[Equation]
= 0 .
This is because Y j − 1 , p j , a j are measurable with respect to
F j .
This implies that in the adversarial setting sequence
Y j is a martingale with respect to the ﬁltration F 0 ⊂ F 1 ⊂ · · · ⊂ F n .
The remainder of the proof of Lemma E.2 goes through as is for arbitrary rows a i ’s.
Thus, the algorithm is indeed adversarially robust.
[Equation]
We note the established upper bounds on the sum of the online L p sensitvities, e.g., Theorem 2.2 in (Cohen et al., 2016), Lemma 2.2 and Lemma 4.7 in (Braverman et al., 2020).
Lemma E.
(Bound on Sum of Online L p Sensitivities)
(Cohen et al., 2016; Braverman et al., 2020)
Let the rows of A = a 1 ◦ . . .
◦ a n ∈ R n × d arrive in a stream with condition number at most κ
and let (cid:96) i be the online L p sensitivity of a i .
Then (cid:80) ni =1 (cid:96) i
= O
( d log n log κ ) for p = 1 and (cid:80) ni
=1 (cid:96) i
= O
( d log κ ) for p = 2 .
We note that κ is an adversarially chosen parameter, since the rows of the input matrix A are generated by an adversary.
One can mitigate possible adversarial space attacks by tracking κ and aborting if log κ exceeds a desired threshold.
Proof of Lemma B.7: Algorithm 1 is adversarially robust by Lemma E.3.
It remains to analyze the space complexity of Algorithm 1.
By Lemma E.3 and a union bound over the n rows in the stream, each row a i is sampled with probability at most 4 ατ i , where τ i is the online leverage score of row a i .
By Lemma E.4, we have (cid:80) ni
=
τ i
=
O
( d log κ ) and we also set α = O (cid:0) dκε 2 log n (cid:1) .
Let γ > 0 be a sufﬁciently large constant such that
(cid:80) ni
=1 ατ i ≤ d 2 γκ log κ [Equation] log n .
We use a martingale argument to bound the number of rows that are sampled.
Consider a martingale U 0 , U 1 , . .
, U n with difference sequence W 1 , . .
. , W n , where for j ≥ 1 , we set W [-j = 
-][Equation]
{+= 
+} if U
[Equation]
log n and otherwise if
[Equation]
log n , we set
[Equation]
is sampled
[Equation]
We have E
[ U j | U 1 , . . .
, U j − 1 ]
=
U j − 1 , then the sequence
U 0 , . .
, U n induced by the differences is indeed a valid martingale.
Note that intuitively, U n is the difference between the number of sampled rows and (cid:80) nj =1 p j .
Since a j is sampled with probability p j ∈ [0 , 1] ,
[Equation]
Moreover, we have E [ | W j | | U 1 , . . .
, U j − 1 ] ≤ 1 .
Thus by Freedman’s inequality (Theorem E.1) with σ 2 =
[Equation]
log n and R ≤ 1 ,
[Equation]
Hence we have that with high probability, the number of rows sampled is O (cid:0)
[Equation]
We remark that the space bounds for Lemma B.7 could similarly be shown (with constant probability of success) using
Markov’s inequality though analysis Freedman’s inequality provides much higher guarantees in terms of probability of success.
On the other hand, it is not clear how to execute a similar strategy using the Matrix Freedman’s Inequality rather than using Freedman’s inequality.
This is because to obtain the desired spectral bound, we must deﬁne a martingale at time j in terms of both the matrix A j and whether the rows a 1 , . . .
, a j − 1 were previously sampled.
However, since A j is itself a function of whether a 1 , . . .
a j − 1 were previously sampled, the resulting sequence is not a valid martingale.
We ﬁrst require the following bound on the sum of the online ridge leverage scores, e.g., Theorem 2.12 from (Braverman et al., 2020), which results from considering Lemma 2.
in (Braverman et al., 2020) at O (log n ) different scales.
Lemma E.5 ( Bound on Sum of Online Ridge Leverage
Scores ) (Braverman et al., 2020) Let the rows of A = a 1 ◦ . . .
◦ a n ∈ R n × d arrive in a stream with condition number at most κ , let λ i
= (cid:107)
A i − ( A i ) ( k ) (cid:107) 2 F k , where A i = a 1 ◦ . . .
◦ a i and ( A i ) ( k ) is the best rank k approximation to A i .
Let (cid:96) i be the online ridge leverage score of a i with regularization λ i .
Then (cid:80) ni =1 (cid:96) i
= O ( k log n log κ ) .
From Lemma E.5 and a similar argument to Lemma E.2, we also obtain adversarially robust projection-cost preservation and therefore low-rank approximation.
Namely, (Cohen et al., 2017; Braverman et al., 2020) showed that projectioncost preservation essentially reduces to sampling a weighted submatrix M of A such that (cid:107) Mx (cid:107)
+ λ (cid:107) x (cid:107) 22 ∈
(1 ± ε )( (cid:107) Ax (cid:107)
+ λ (cid:107) x (cid:107) 22 ) for a ridge parameter λ .
Since the online ridge leverage score of each row a i can be rewritten as max
[Table] x (cid:107) 22 , then the same concentration argument of Lemma E.2 gives Lemma B.8.
E.2. Adversarially Robust Linear Regression
We ﬁrst give the formal deﬁnition of linear regression:
Problem E.6 (Linear Regression)
Given a matrix A ∈ R n × d , a vector b ∈ R n and an approximation parameter ε > 0 , the goal is to output a vector y such that
[Equation]
Lemma E.7 (Adversarially Robust Linear Regression)
Given ε > 0 and a matrix A ∈ R n × d whose rows a 1 , . . .
, a n arrive sequentially in a stream with condition number at most κ , there exists an adversarially robust streaming algorithm that outputs a (1 + ε ) approximation to linear regression and uses O (cid:16) d 3 ε 2 log 2 n log κ (cid:17) bits of space, with high probability.
Proof : Suppose each row of A arrives sequentially, along with the corresponding entry in b .
Let B =
A ◦ b so that the effectively, the rows of B arrive sequentially.
Note that if M is a spectral approximation to B , then we have
[Equation]
for all vectors v ∈ R d +1 .
In particular, let w ∈ R d
+1 be the vector
that minimizes (cid:107) Mv (cid:107) 2 subject to the constraint that the last coordinate of w is 1 , and let w = (cid:20) y
(cid:21) .
Then we have
[Equation]
Let z be the vector that minimizes (cid:107)
Ax − b (cid:107) 2 and let u
= (cid:20) z (cid:21) .
Then we have
[Equation]
where the last inequality follows from the minimality of w .
Thus we have that (cid:107)
[Equation]
F. Missing Proofs from Section C
Other Related Works Note that there is an alternate streaming algorithm for graph sparsiﬁcation given in (Goel et al., 2010) which has the same guarantees but is computationally faster.
However, we choose to analyze the algorithm of (Ahn & Guha, 2009) since its core argument is sampling based.
Nevertheless, it is possible that the algorithm from (Goel et al., 2010) is also adversarially robust.
Lastly, we recall that our model is the streaming model where edges arrive one at a time.
There is also related work in the dynamic streaming model (see (Kapralov et al., 2019) and references therein) where previously shown edges can be deleted but this is not the scope of our work.
The notion of the connectivity of an edge is needed to in the algorithm of (Ahn & Guha, 2009).
Deﬁnition F.1 (Connectivity (Bencz´ur & Karger, 1996))
A graph is k -strong connected iff every cut in the graph has value at least k .
A k -strong connected component is a maximal node-induced subgraph which is k -strong connected.
The connectivity of an edge e is the maximum k such that there exists a k -strong connected component that contains e .
Algorithm 2 Graph sparsiﬁcation algorithm from (Ahn & Guha, 2009).
Input: A stream of edges e 1 , · · · , e m and an accuracy parameter ε >
Output: Spariﬁed graph H 1: H ← ∅ 2: ρ ← C (log n +log m ) /ε 2 for sufﬁciently large constant
C >3: for each new edge e do 4: compute the connectivity c
e of e in H 5: p e = min( ρ/c e , 1) (cid:46) Importance of edge e , see
Deﬁnition F.
Add e to H with probability p e and weight 1 /p
e times its original weight 7: return H
We begin by providing a brief overview of our proof.
The ﬁrst step is to show that for a cut in G of value c , the same cut in the sparsiﬁed graph H has value that concentrates around c .
Note that in (Ahn & Guha, 2009), the concentration inequality they obtain depends roughly on exp( − c ) .
In other words, they get a stronger concentration for larger cuts in the original graph.
However, their concentration inequality is not valid in our setting since the value c is random .
Therefore, we employ a different concentration inequality, namely Freedman’s inequality (Theorem Theorem E.1) in conjunction with an assumption about the sizes of cuts in the graph to obtain concentration for a ﬁxed cut.
The second step is to use a standard worst-case union bound strategy to bound the total number of cuts with a particular size in the original graph.
This uses the standard fact that the number of cuts in a graph that is at most α times the minimum cut is at most n 2 α .
Then the ﬁnal result for the property (1) in
Problem C.1 follows by combining the union bound with the previously mentioned concentration inequality.
The bound for the total number of edges (condition (2) in Problem C.1) is a “worst case” calculation in (Ahn & Guha, 2009) so it automatically ports over to our setting.
Note that we assume κ 1 and κ 2 to be deterministic lower and upper bounds on the size of any cut in G and deﬁne κ to be their ratio.
Theorem C.2 Given a weighted graph G =
( V, E ) with | V | = n whose edges e 1 , . . .
, e m arrive sequentially in a stream, there exists an adversarially robust streaming algorithm that outputs a 1 ± ε cut sparsiﬁer with O (cid:16) κ 2 n log n ε(cid:17) edges with probability 1 − 1 / poly( n ) .
Proof :
We claim through induction the stronger statement that the value C H of any cut in H is a (1 + ε ) - approximation of the value C G of the corresponding cut in G for all times j ∈ [ m ] with high probability.
Consider a ﬁxed set S ⊆ V and the corresponding cut C
= ( S, V \ S ) .
Let e 1 , . .
, e m be the edges of the stream in the order that they arrive.
We emphasize that e 1 , . . .
, e m are possibly random variables given by the adversary rather than ﬁxed edges.
For each j ∈ [ m ] , let G j be the graph consisting of the edges e 1 , . . .
, e j and let H j be the corresponding sampled weighted subgraph.
We abuse notation and deﬁne p j :=
p e j to denote the probability of sampling the edge e j that arrives at time j .
We use C ( j ) G and C ( j ) H to denote the value of the cut at time j in graphs G and H , respectively.
Note that p 1 = 1 , so we have H
=
G 1 for our base case.
We assume the statement holds for all j ∈ [ m − 1] and prove it must hold for j = m .
We deﬁne a martingale Y 0 , Y 1 , . . .
, Y m through its difference sequence
X 1 , . . .
, X m , where for j ≥ 1 , we set
X j = 0 if C ( j − 1) H (cid:54)∈ (1 ± ε )
C
( j − 1) G .
Otherwise if (1 − ε ) C ( j − 1) G ≤ C ( j − 1) H ≤ (1+ ε ) C ( j − 1) G , then we set X j equal to 0 if e j does not cross the cut C , (cid:16) 1 p j − 1 (cid:17) if e j crosses the cut and is sampled in
H , and − 1 if e j crosses the cut and is not sampled in H .
Because E [ Y j | Y 1 , . .
Y j − 1 ] =
Y j − 1 , then we have that the sequence Y 0 , . . .
, Y n is indeed a valid martingale and that Y j = C ( j ) H − C ( j ) G .
(We abuse notation and use
Y 1 , . . .
, Y i to indicate the similar ﬁltration to the one in
Lemma Lemma E.3).
If p j = 1 , then e j is sampled in H j , so we have that X j = 0 .
Otherwise,
E (cid:2)
X
[Equation]
For p j < 1 , then we have p
j = ρ/c e j and thus E (cid:2)
X 2 j | Y 1 , . .
, Y j − 1 (cid:3) ≤ c ej ρ .
Thus,
[Equation]
Recall that c
e j is the connectivity of e j in H rather than G .
However, by the deﬁnition of c e j and the inductive hypothesis that H j − 1 is a (1 + ε ) cut sparsiﬁer of G j − 1 , then we have that for ε < 12 , the connectivity of c e j in H is within a factor of two of the connectivity of c e j in G .
By deﬁnition of connectivity, we have that the connectivity of c e j at time j in G is at most C ( j ) G ≤ C ( m ) G
if e j crosses the cut C .
Hence, m
[Equation]
By similar reasoning, we have | X j | ≤ 1 p j ≤ c ej ρ ≤ 2( C ( m ) G ) ρ .
Now we would like to apply Freedman’s inequality (Theorem E.1) with σ 2 = 2( C ( m ) G ) 2 ρ and R ≤ 2( C ( m ) G ) ρ for ρ = C (log n + log m ) /ε
However, we cannot bound the probability that | Y n | exceeds εC ( m ) G , as the latter is a random variable.
Thus we instead assume that κ 1 and κare lower and upper bounds on C ( m ) G .
By Freedman’s inequality,
[Equation]
where we deﬁne κ := κ 2 /κ 1 .
Since κ 1 ≤ C ( m ) G , then we have
[Equation]
Thus | C ( m ) H − C (
[Equation]
with probability at least 1 − n − O
( C/κ 2 ) .
We now union bound over all cuts C .
Based on our assumption that every cut in G has value at least κ 1 , it follows that for any α ≥ 1 , the number of cuts in G of size ακ 1 is at most n 2 α (Bencz´ur & Karger, 1996; Ahn & Guha, 2009).
Note that we are using a deterministic upper bound on the number of cuts that holds for any graph.
Due to our assumption, on the size of cuts, we know that α ranges from 1 ≤ α ≤ κ 2 /κ
= κ .
Then using our concentration result derived above, it follows by a union bound that the probability that there exists some C such that | C (
[Equation]
is at most
[Equation]
where the last inequality follows by setting C
= c (cid:48) κ 2 for some large enough constant c (cid:48) > 1 .
This veriﬁes part (1) of
Problem C.1.
We now need to check the number of edges in H .
For this, we note that the proof of Theorem 3 . 2 in (Ahn & Guha, 2009) carries over to our setting since the proof there only relies on the fact that if an edge has strong connectivity at most z in G , its weight in H is at most z/ρ in H which is true for us as well.
The extra κ 2 factor in the number of edges comes from our setting of the parameter C in ρ .
[Equation]