Following the seminal work of HOGWILD! [NRRW11], many studies have demonstrated that near-linear speedups are achievable on a variety of machine learning tasks via asynchronous, lock-free implementations [RRTB12, ZCJL13, YYH13, LWR
14, DJM13, WSD
14, HYD15, MPP
15]. In all of these studies, classic algorithms are parallelized by simply running parallel and asynchronous model updates without locks. These lock-free, asynchronous algorithms exhibit speedups even when applied to large, non-convex problems, as demonstrated by deep learning systems such as Google’s Downpour SGD [DCM
12] and Microsoft’s Project Adam [CSAK14].
While these techniques have been remarkably successful, many of the papers cited above require delicate and tailored analyses to understand the benefits of asynchrony for the particular learning task at hand. Moreover, in non-convex settings, we currently have little quantitative insight into how much speedup is gained from asynchrony and how much accuracy may be lost.
In this work, we present CYCLADES, a general framework for lock-free, asynchronous machine learning algorithms that obviates the need for specialized analyses. CYCLADES runs asynchronously and maintains serial equivalence, i.e., it produces the same outcome as the serial algorithm. Since it returns exactly the same output as a serial implementation, any algorithm parallelized by our framework inherits the correctness proof of the serial counterpart without modifications. Additionally, if a particular heuristic serial algorithm is popular, but does not have a rigorous analysis, such as backpropagation on neural networks, CYCLADES still guarantees that its execution will return a serially equivalent output.
CYCLADES achieves serial equivalence by partitioning updates among cores, in a way that ensures that there are no conflicts across partitions. Such a partition can always be found efficiently by leveraging a powerful result on graph phase transitions [Kri16]. When applied to our setting, this result guarantees that a sufficiently small sample of updates will have only a logarithmic number of conflicts. This allows us to evenly partition model updates across cores, with the guarantee that all conflicts are localized within each core. Given enough problem sparsity, CYCLADES guarantees a nearly linear speedup, while inheriting all the qualitative properties of the serial counterpart of the algorithm, e.g., proofs for rates of convergence. Enforcing a serially equivalent execution in CYCLADES comes with additional practical benefits. Serial equivalence is helpful for hyperparameter tuning, or locating the best model produced by the asynchronous execution, since experiments are reproducible, and solutions are easily verifiable. Moreover, a CYCLADES program is easy to debug, because bugs are repeatable and we can examine the step-wise execution to localize them.
A significant benefit of the update partitioning in CYCLADES is that it induces considerable access locality compared to the more unstructured nature of the memory accesses during HOGWILD!. Cores will access the same data points and read/write the same subset of model variables. This has the additional benefit of reducing false sharing across cores. Because of these gains, CYCLADES can actually outperform HOGWILD! in practice on sufficiently sparse problems, despite appearing to require more computational overhead. Remarkably, because of the added locality, even a single threaded implementation of CYCLADES can actually be faster than serial SGD. In our SGD experiments for matrix completion and word embedding problems, CYCLADES can offer a speedup gain of up to 40% compared to that of HOGWILD!. Furthermore, for variance reduction techniques such as SAGA [DBLJ14] and SVRG [JZ13], CYCLADES yields better accuracy and more significant speedups, with up to performance gains over HOGWILD!-type implementations.
The remainder of our paper is organized as follows. Section 2 establishes some preliminaries. Details and theory of CYCLADES are presented in Section 3. We present our experiments in Section 4, we discuss related work in Section 5, and then conclude with Section 6.
We study parallel asynchronous iterative algorithms on the computational model used by [NRRW11], and similar to the partially asynchronous model of [BT89]: a number of cores have access to the same shared memory, and each of them can read and update components of x in parallel from the shared memory.
In this work, we consider a large family of randomized algorithms that we will refer to as Stochastic Updates (SU). The main algorithmic component of SU focuses on updating small subsets of a model variable x, that lives in shared memory, according to prefixed access patterns, as sketched by Alg. 1.
In Alg. 1 each set is a subset of the coordinate indices of x, each function
only operates on the subset
of coordinates (i.e., both its domain and co-domain are inside
), and
is a local update function that computes a vector with support on
using as input x
and
. Moreover, T is the total number of iterations, and D is the distribution with support {1,...,n} from which we draw i. As we explain in Appendix A, several machine learning
and optimization algorithms belong to the SU algorithmic family, such as stochastic gradient descent (SGD), with or without weight decay and regularization, variance-reduced learning algorithms like SAGA and SVRG, and even some combinatorial graph algorithms.
The Updates Conflict Graph A useful construction for our developments is the conflict graph between updates, which can be generated from the bipartite graph between the updates and the model variables. We define these graphs below, and provide an illustrative sketch in Fig. 1.
Definition 1. We denote as the bipartite update-variable graph between the updates
and the d model variables. In
an update
is linked to a variable
, if
requires to read or write
. We let
denote the number of edges in the bipartite graph, and also denote as
the left max vertex degree of
, and as
its average left degree.
Definition 2. We denote by a conflict graph on n vertices, each corresponding to an update
. Two vertices of
are linked with an edge, if and only if the corresponding updates share at least one variable in the bipartite-update graph
. We also denote as
the max vertex degree of
.
Figure 1: The above bipartite graph links an update to a variable
when an update needs to access (read or write) the variable. From
we obtain the conflict graph
whose max degree is
is sufficiently sparse, we expect that it is possible to parallelize updates without too many conflicts. CY-
Our Main Result By exploiting the structure of the above graphs and through a light-weight and careful sampling and allocation of updates, CYCLADES is able to guarantee the following result for SU algorithms, which we establish in the following sections.
Theorem 1 (informal). Let us consider an SU algorithm A defined through n update rules, where the conflict max degree between the n updates is , and the sampling distribution D is uniform with (or without) replacement from {1,...,n}. Moreover, assume that we wish to run A for
iterations, and that
Then on up to cores, CYCLADES guarantees a
speedup over A, while outputting the same solution x as A would do after the same random set of T iterations.1
We will now provide some simple examples of how the above parameters, and guarantees translate for specific problem cases.
Example 1. Many machine learning applications often seek to minimize the empirical risk
where arepresents the ith data point, x is the model we are trying to fit, and
is a loss function that tells us how good of a fit a model is with respect to data point i. Several problems can be formulated in the above way, such as logistic regression, least squares, support vector machines (SVMs) for binary classification, and others. If we attempt to solve the above problem using SGD (with or without regularization), or via variance reduction techniques like SVRG and SAGA, then (as we show in Appendix A) the sparsity of the
updates is determined by the gradient of a single sampled data point i. For the aforementioned problems, this will be proportional to
, hence the sparsity of the update is defined by the non-zero support of datapoint a
. In the induced bipartite update-variable graph of this problem, we have
, and the maximum conflict degree
is the maximum number of data points a
that share at least one of the d features. As a toy example, let
and let the non-zero support of a
be of size
and uniformly distributed. Then, one can show that with overwhelmingly high probability
and hence CYCLADES achieves an
speedup on up to
cores.
Example 2. Consider the following generic minimization problem
where is a convex function of a scalar. The above generic formulation captures several problems like matrix completion and matrix factorization [RR13] (where
y
), word embeddings [ALL
15] (where
), graph k-way cuts [NRRW11] (where
), and others. Let
for simplicity, and assume that we aim to minimize the above by sampling a single function
and then updating x
and y
using SGD. Here, the number of update functions is proportional to
, and for the above setup each gradient update with respect to the sampled function
is only interacting with the variables x
and y
, i.e., only two variable vectors out of the 2m many (i.e.,
). Moreover, the previous imply a conflict degree of at most
. In this case, CYCLADES can provably guarantee an
speedup for up to P = O(m) cores.
In our experiments we test CYCLADES on several problems including least squares, classification with logistic models, matrix factorization, and word embeddings, and several algorithms including SGD, SVRG, and SAGA. We show that in most cases it can significantly outperform the HOGWILD! implementation of these algorithms, if the data is sparse.
Remark 1. We would like to note, that there are several cases where there might be a few outlier updates with extremely high conflict degree. In Appendix E, we prove that if there are no more than vertices of high conflict degree
, and the rest of the vertices have max degree at most
, then the result of Theorem 1 still holds in expectation.
In the following section, we establish the technical results behind CYCLADES and provide the details behind our parallelization framework.
CYCLADES consists of three computational components as shown in Figure 2.
Figure 2: CYCLADES carefully samples updates, then finds conflict-groups, and allocates them across cores. Then, each core asynchronously updates the shared model, without incurring any read/write conflicts. This is possible by processing all the conflicting updates within the same core. After the processing of a batch is completed, the above is repeated, for as many iterations as required.
It starts by sampling (according to a distribution D) a number of B updates from the graph shown in Fig. 1, and assigns a label to each of them (a processing order). We note that in practice the sampling is done on the bipartite graph, which avoids the need to actually construct the conflict graph. After sampling, it computes the connected components of the sampled subgraph induced by the B sampled updates, to determine the conflict groups. Once the conflicts groups are formed, it allocates them across P cores. Finally, each core processes locally the conflict groups of updates that it has been assigned, following the order that each update has been labeled with. The above process is then repeated, for as many iterations as needed.
The key component of CYCLADES is to carry out the sampling in such a way that we have as many connected components as possible, and all of them of small size, provably. In the next subsections, we explain how each part is carried out, and provide theoretical guarantees for each of them individually, which we combine at the end of this section for our main theorem.
Frugal sampling shatters conflicts. A key techni-
cal aspect that we exploit in CYCLADES is that appropriate sampling and allocation of updates can lead to near optimal parallelization of sparse SU algorithms. To do that we expand upon the following result established in [Kri16].
Theorem 2. Let G be a graph on n vertices, with maximum vertex degree . Let us sample each vertex independently with probability
and define as
the induced subgraph on the sampled vertices. Then, the largest connected component of
has size at most
, with high probability.
The above result pays homage to the giant component phase transition phenomena in random ErdosRenyi graphs. What is surprising is that a similar phase transition can apply for any given graph!
Adapting to ML-friendly sampling procedures. In practice, for most SU algorithms of interest, the sampling distribution of updates is either with or without replacement from the n updates. As it turns out, morphing Theorem 2 into a with-/without-replacement result is not straightforward. We defer the analysis needed to Appendix B, and present our main theorem about graph sampling here.
Theorem 3. Let G be a graph on n vertices, with maximum vertex degree . Let us sample
vertices with or without replacement, and define as
the induced subgraph on the sampled vertices. Then, the largest connected component of
has size at most
, with high probability.
The key idea from the above theorem is that if one samples no more than vertices, then there will be at least
conflict groups to allocate across cores, all of size at most
. Moreover, since there are no conflicts between different conflict-groups, the processing of updates per any single group will never interact with the variables corresponding to the updates of another conflict group.
The next step of CYCLADES is to form and allocate the connected components (CCs) across cores, and do so efficiently. We address this in the following subsection. In the following, for simplicity we carry our analysis for the with-replacement sampling case, but it can be readily extended to the without-replacement sampling case.
Identifying Groups of Conflict via CCs In CYCLADES, we sample batches of updates of size multiple times, and for each batch we need to identify the conflict groups across the updates. Let us refer to
as the subgraph induced by the ith sampled batch of updates on the update-variable bipartite graph
. In the following we always assume that we sample at most
batches, where
is a constant that does not depend on n. This number of batches results in a constant number of passes over the dataset.
Identifying the conflict groups in can be done with a connected components (CC) algorithm. The main question we need to address is what is the best way to parallelize this graph partitioning part. There are two avenues that we can take for this, depending on the number of cores P at our disposal. We can either parallelize the computation of the CCs of a single batch (i.e., compute the CCs of
on P cores), or we can compute in parallel the CCs of all
batches, by allocating the sampled graphs
to cores, so that each of them can compute the CCs of its allocated subgraphs. Depending on the number of available cores, one technique can be better than the other. In Appendix C we provide the details of this part, and prove the following result:
Lemma 1. Let the number of cores by bounded as , and let
. Then, the overall computation of
CCs for batches, each of size
, costs no more than
.
Allocating Updates to Cores Once we compute the CCs (i.e., the conflicts groups of the sampled updates), we have to allocate them across cores. Once a core has been assigned with CCs, it will process the updates included in these CCs, according to the order that each update has been labeled with. Due to Theorem 3, each connected component will contain at most updates. Assuming that the cost of the j-th update in the batch is
, the cost of a single connected component C will be
. To proceed with characterizing the maximum load among the P cores, we assume that the cost of a single update
, for
, is proportional to the out-degree of that update —according to the update-variable graph
— times a constant cost which we shall refer to as
. Hence,
, where
is the degree of the j-th left vertex of
. In Appendix D we establish that a near-uniform allocation of CCs according to their weights leads to the following guarantee.
Lemma 2. Let the number of cores by bounded as , and let
. Then, computing the stochastic updates across all
batches can be performed in time
, with high probability, where
is the per edge cost for computing one of the n updates defined on
.
Stitching the pieces together Now that we have described the sampling, conflict computation, and allocation strategies, we are ready to put all the pieces together and detail CYCLADES in full. Let us assume that we sample a total number of batches of size
, and that each update is sam- pled uniformly at random. For the i-th batch let us denote as
the connected components on the induced subgraph
. Due to Theorem 3, each connected component C contains a number of at most
updates, and each update carries an ID (the order of which it would have been sampled by the serial algorithm). Using the above notation, we give the pseudocode for CYCLADES in Alg. 2.
Note that the inner loop that is parallelized (i.e., the SU processing loop in lines 6 – 9), can be performed asynchronously; cores do not have to synchronize, and do not need to lock any memory variables, as they are all accessing non-overlapping subset of x. This also provides for better cache coherence. Moreover, each core potentially accesses the same coordinates several times, leading to good cache locality. These improved cache locality and coherence properties experimentally lead to substantial performance gains as we see in the next section.
Theorem 4. Let us assume any given update-variable graph with average, and max left degree
and
, such that
, and with induced max conflict degree
. Then, CYCLADES on
cores, with batch sizes
can execute
updates, for any constant
, selected uniformly at random with replacement, in time
with high probability.
Observe that CYCLADES bypasses the need to establish convergence guarantees for the parallel algorithm. Hence, it could be the case for many applications of interest that although we might not be able to analyze how “well” the serial SU algorithm might perform in terms of the accuracy of the solution, CY- CLADES can provide black box guarantees for speedup, since our analysis is completely oblivious to the qualitative performance of the serial algorithm. This is in contrast to recent studies similar to [DSZOR15], where the authors provide speedup guarantees via a convergence-to-optimal proof for an asynchronous SGD on a nonconvex problem. Unfortunately these proofs can become complicated especially on a wider range of nonconvex objectives.
In the following section we show that CYCLADES is not only useful theoretically, but can consistently outperform HOGWILD! on sufficiently sparse datasets.
Table 1: Details of datasets used in our experiments.
4.1 Implementation and Setup
We implemented CYCLADES in C++ and tested it on a variety of problems and datasets described below. We tested a number of stochastic updates algorithms, and compared against their HOGWILD! (i.e., asynchronous and lock-free) implementations — in some cases, there are no theoretical foundations for these HOGWILD! implementations, even if they work reasonably well in practice. Since CYCLADES is intended to be a general approach for parallelization of stochastic updates algorithms, we do not compare against algorithms designed and tailored for specific applications, nor do we expect CYCLADES to outperform every such highly-tuned, well-designed, specific algorithms. Our experiments were conducted on a machine with 72 CPUs (Intel(R) Xeon(R) CPU E7-8870 v3, 2.10 GHz) on 4 NUMA nodes, each with 18 CPUs, and 1TB of memory. We ran both CYCLADES and HOGWILD! with 1, 4, 8, 16 and 18 threads pinned to CPUs on a single NUMA node (i.e., the maximum physical number of cores possible, for a single node), so that we can avoid well-known cache coherence and scaling issues across different nodes [ZR14]. We note that distributing threads across NUMA nodes significantly increased running times for both CYCLADES and HOGWILD!, but was relatively worse for HOGWILD!. We believe this is due to the poorer locality of HOGWILD!, which results in more cross-node communication. In this paper, we exclusively focus our study and experiments on parallelization within a single NUMA node, and leave cross-NUMA node parallelization for future work, while referring the interested reader to a recent study of the various tradeoffs of ML algorithms on NUMA aware architectures [ZR14]. In our experiments, we measure overall running times which include the overheads for computing connected components and allocating work in CYCLADES. Separately, we also measure running times for performing the stochastic updates by excluding the CYCLADES coordination overheads. We also compute the objective value at the end of each epoch (i.e., one full pass over the data). We measure the speedups for each algorithm as time of the parallel algorithm to reach objective
where was chosen to be the smallest objective value that is achievable by all parallel algorithms on every choice of number of threads. That is,
where
is the model learned by algorithm A on T threads after e epochs. The serial algorithm used for comparison is HOGWILD! running serially on one thread.
In Table 1 we list some details of the datasets that we use in our experiments. The stepsizes and batch sizes used for each problem are listed in Table 2, along with dataset and problem details. In general, we chose the stepsizes to maximize convergence without diverging. Batch sizes were picked to optimize performance for CYCLADES.
Table 2: Stepsizes and batch sizes for the various learning tasks in our evaluation. We selected stepsizes that maximize convergence without diverging. We also chose batch sizes to maximize performance of CYCLADES. We further list the average size of connected components and the average number of connected components in each batch. Typically there are many connected components with small average size, which leads to good load balancing for CYCLADES.
4.2 Learning tasks and algorithmic setup
Least squares via SAGA The first problem we consider is least squares:
which we will solve using the SAGA algorithm [DBLJ14], an incrimental gradient algorithm with faster than SGD rates on convex, or strongly convex functions. In SAGA, we initialize gand iterate the following two steps
where x
and
x
In the above iteration it is useful to observe that the updates can be performed in a sparse and "lazy" way. That is for any updates where the sampled gradients
have non-overlapping support, we can still run them in parallel, and apply the vector of gradient sums at the end of a batch "lazily". We explain the details of the lazy updates in Appendix A.1. This requires computing the number of skipped gradient sum updates, say they were
of them for each lazily updated coordinate j, which may be negative in HOGWILD! due to re-ordering of updates. We thresholded
when needed in the HOGWILD! implementation, as this produced better convergence for HOGWILD!. Unlike other experiments, we used different stepsizes
for CYCLADES and HOGWILD!, as HOGWILD! would often diverge with larger stepsizes. The stepsizes chosen for each were the largest such that the algorithms did not diverge. We used the DBLP and NH2010 datasets for this experiment, and set A as the adjacency matrix of each graph. For NH2010, the values of b were set to population living in the Census Block. For DBLP we used synthetic values: we set b
z, where
x and
z were generated randomly. The SAGA algorithm was run for up to 500 epochs for each dataset.
Graph eigenvector via SVRG Given an adjacency matrix A, the top eigenvector of AA is useful in several applications such as spectral clustering, principle component analysis, and others. In a recent work, [JKM
15] proposes an algorithm for computing the top eigenvector of A
A by running intermediate SVRG steps to approximate the shift-and-invert iteration. Specifically, at each step SVRG is used to solve
According to [JKM15], if we initialize y
and assume
, we have to iterate the following updates
where after every T iterations we update y , and the stochastic gradients are of the form
We apply CYCLADES to SVRG with dense linear gradients (see App. A.1) for parallelizing this problem, which uses lazy updates to avoid dense operations on the entire model x. This requires computing the number of skipped updates, , for each lazily updated coordinate, which may be negative in HOG- WILD! due to re-ordering of updates. In our HOGWILD! implementation, we thresholded the bookkeeping variable
(described in App. A.1), as we found that this produced faster convergence. The rows of A are normalized by their
-norm, so that we may apply the SVRG algorithm of [JKM
15] with uniform sampling. Two graph datasets were used in this experiment. The first, DBLP [KON15], is an authorship network consisting of 1.4M authors and 4M publications, with 8.65M edges. The second, NH2010 [UF 14], is a weighted topological graph of 49 Census Blocks in New Hampshire, with an edge between adjacent blocks, for a total of 234K edges. We ran SVRG for 50 and 100 epochs for NH2010 and DBLP respectively.
Matrix completion via SGD In the matrix completion problem, we are given a partially observed matrix M, and wish to factorize it as M
UV where U and V are low rank matrices with dimensions
and
respectively. This may be achieved by optimizing
where is the set of observed entries, which can be approximated by SGD on the observed samples. The objective can also be regularized as:
The regularized objective can be optimized by weighted SGD, which samples and updates
and analogously for VIn our experiments, we chose a rank of r = 100, and ran SGD and weighted SGD for 200 epochs. We used the MovieLens 10M dataset [Gro09] containing 10M ratings for 10,000 movies by 72,000 users.
Word embedding via SGD Semantic word embeddings aim to represent the meaning of a word w via a vector v. In a recent work by [ALL
15], the authors propose using a generative model, and solving for the MLE which is equivalent to:
where is the number of times words w and
co-occur within
words in the corpus. In our experiments we set
following the suggested recipe of the aforementioned paper. We can approximate the solution to the above problem by SGD: we can repeatedly sample entries
from A and update the corresponding vectors v
. In this case the update is of the form as:
and identically for vThen, at the end of each full pass over the data, we update the constant C by its locally optimal value, which can be calculated in closed form:
In our experiments, we optimized for a word embedding of dimension r = 100, and tested on a 80MB subset of the English Wikipedia dump available at [Mah06]. The dataset contains 213K words and A has 20M non-zero entries. For our experiments, we run SGD for 200 epochs.
4.3 Speedup and Convergence Results
In this subsection, we present the bulk of our experimental findings. Our extended and complete set of results can be found in Appendix F.
Figure 3: Convergence of CYCLADES and HOGWILD! in terms of overall running time with 1, 8, 16, 18 threads. CYCLADES is initially slower, but ultimately reaches convergence faster than HOGWILD!.
Figure 4: Speedup of CYCLADES and HOGWILD! versus number of threads. On multiple threads, CYCLADES always reaches objective faster than HOGWILD!. In some cases CYCLADES is faster than HOGWILD! even on 1 thread, due to better cache locality. In Figs. 4(a) and 4(b), CYCLADES exhibits significant gains, since HOGWILD! suffers from asynchrony noise for which we had to use comparatively smaller stepsizes to prevent divergence.
Least squares When running SAGA for least squares, we found that HOGWILD! was divergent with the large stepsizes that we were using for CYCLADES (Fig. 5). Thus, in the multi-thread setting, we were only able to use smaller stepsizes for HOGWILD!, which resulted in slower convergence than CYCLADES, as seen in Fig. 3(a). The effects of a smaller stepsize for HOGWILD! are also manisfested in terms of speedups in Fig. 4(a), since HOGWILD! takes a longer time to converge to an objective value.
Figure 5: Convergence of CYCLADES and HOGWILD! on least squares using SAGA, with 16 threads, on DBLP dataset. HOGWILD! diverges with ; thus, we were only able to use a smaller step size
on multiple threads. For HOGWILD! on 1 thread (and CY-
Graph eigenvector The convergence of SVRG for graph eigenvectors is shown in Fig. 3(b). CY- CLADES starts off slower than HOGWILD!, but always produces results equivalent to the convergence on a single thread. Conversely, HOGWILD! does not exhibit the same behavior on multiple threads as it does serially—in fact, the error due to asynchrony causes HOGWILD! to converge slower on multiple threads. This effect is clearly seen on Figs. 4(b), where HOGWILD! fails to converge faster than the serial counterpart, and CYCLADES attains a significantly better speedup on 16 threads.
Matrix completion and word embeddings Figures 3(c) and 3(d) show the convergence for the matrix completion and word embeddings problems. CYCLADES is initially slower than HOGWILD! due to the overhead of computing connected components. However, due to better cache locality and
convergence properties, CYCLADES is able to reach a lower objective value in less time than HOGWILD!. In fact, we observe that CYCLADES is faster than HOGWILD! when both are run serially, demonstrating that the gains from (temporal) cache locality outweigh the coordination overhead of CYCLADES. These results are reflected in the speedups of CYCLADES and HOGWILD! (Figs. 4(c) and 4(d)). CYCLADES consistently achieves a better speedup (on 18 threads) compared to that of HOGWILD! (
on 18 threads).
4.4 Runtime Breakdown
Partitioning and allocation costs The cost of partitioning and allocation for CYCLADES is given in Table 3, relatively to the time that HOGWILD! takes to complete one epoch of stochastic updates (i.e., a single pass over the dataset). For matrix completion and the graph eigenvector problem, on 18 threads, CYCLADES takes the equivalent of 4-6 epochs of HOGWILD! to complete its partitioning, as the problem is either very sparse or the updates are expensive. For solving least squares using SAGA and word embeddings using SGD, the cost of partitioning is equivalent to 11-14 epochs of HOGWILD! on 18 threads. However, we point out that partitioning and allocation is a one-time cost which becomes cheaper with more stochastic update epochs. Additionally, we note that this cost can become amortized quickly due to the extra experiments one has to run for hyperparameter tuning, since the graph partitioning is identical across different stepsizes one might want to test.
Table 3: Cost of partitioning and allocation. The table shows the ratio of the time that CYCLADES consumes for partition and allocation over the time that HOGWILD! takes for 1 full pass over the dataset. On 18 threads, CYCLADES takes between 4-14 HOGWILD! epochs to perform partitioning. Note however, this computational effort is only required once per dataset.
Stochastic updates running time When performing stochastic updates, CYCLADES has better cache locality and coherence, but requires synchronization after each batch. Table 4 shows the time for each method to complete a single pass over the dataset, only with respect to stochastic updates (i.e., here we factor out the partitioning time). In most cases, CYCLADES is faster than HOGWILD!. In the cases where CYCLADES is not faster, the overheads of synchronizing outweigh the gains from better cache locality and coherency. However, in some of these cases, synchronization can help by preventing errors due to asynchrony that lead to worse convergence, thus allowing CYCLADES to use larger stepsizes and maximize convergence speed.
Table 4: Time, in seconds, to complete one epoch (i.e. full pass of stochastic updates over the data) by CYCLADES and HOGWILD!. Lower times are highlighted in boldface. CYCLADES is usually faster than HOGWILD!, due to its better cache locality and coherence properties.
4.5 Diminishing stepsizes
In the previous experiments we used constant stepsizes. Here, we investigate the behavior of CYCLADES and HOGWILD! in the regime where we decrease the stepsize after each epoch. In particular, we ran the matrix completion experiments with SGD (with and without regularization), where we multiplicatively updated the stepsize by 0.95 after each epoch. The convergence and speedup plots are given in Figure 6. CYCLADES is able to achieve a speedup of up to on
threads. On the other hand, HOGWILD! is performing worse comparatively to its performance with constant stepsizes (Figure 4(c)). The difference is more significant on regularized SGD, where we have to perform lazy updates (Appendix A.1), and HOGWILD! fails to achieve the same optimum as CYCLADES with multiple threads. Thus, on 18 threads, HOGWILD! obtains a maximum speedup of
, whereas CYCLADES attains a speedup of
.
Figure 6: Convergence and speedups for SGD and weighted SGD with diminishing stepsizes for the matrix completion on the MovieLens dataset. In this case, CYCLADES outperforms HOGWILD! by achieving up to 6-7x speedup, when HOGWILD! achieves at most 5x speedup for 16-18 threads. For the weighted SGD algorithm, we used lazy updates (Appendix A.1), in which case HOGWILD! on multiple threads gets to a worse optimum.
4.6 Binary Classification and Dense Coordinates
Figure 7: Filtering of features in URL dataset. with a total of 3,230,442 features before filtering. The maximum per-
centage of features filtered is less than 0.05%. In addition to the above experiments, here we explore settings where CYCLADES is expected to perform poorly due to the inherent density of updates (i.e., for data sets with dense features). In particular, we test CYCLADES on a classification problem for text based data, where a few features appear in most data points. Specifically, we run classifica-tion for the URL dataset [MSSV09] contains 2.4M URLs, labeled as either benign or malicious, and 3.2M features, including bag-of-words representa-
tion of tokens in the URL.
For this classification task, we used a logistic re-
gression model, trained using SGD. By its power-law nature, the dataset consists of a small number of extremely dense features which occur in nearly all updates. Since CYCLADES explicitly avoids all conflicts, for these dense cases it will have a schedule of SGD updates that leads to poor speedups. However, we observe that most conflicts are caused by a small percentage of the densest features. If these features are removed from the dataset, CYCLADES is able to obtain much better speedups. To that end, we ran CYCLADES and HOGWILD! after filtering the densest 0.016% to 0.048% of features. The number of features that are filtered are shown in Table 7.
Figure 8: Speedups of CYCLADES and HOGWILD! on 16 threads, for different percentage of dense features filtered. When only a very small number of features are filtered, CYCLADES is almost serial. However, as we increase the percentage from 0.016% to 0.048%, the speedup of CYCLADES improves and almost catches up with HOGWILD!.
The speedups that are obtained by CYCLADES and HOGWILD! on 16 threads for different filtering percentages are shown in Figure 8. Full results of the experiment are presented in Figure 9 and in App. F. CYCLADES fails to get much speedup when nearly all the features are used, however, as more dense features are removed, CYCLADES obtains a better speedup, almost equalling HOGWILD!’s speedup when 0.048% of the densest features are filtered.
Parallel stochastic optimization has been studied under various guises, with literature stretching back at least to the late 60s [CM69]. The end of Moore’s Law coupled with recent advances in parallel and distributed computing technologies have triggered renewed interest [ZLS09, ZWLS10, GNHS11, AD11, RT12, JST14] in the theory and practice of this field. Much of this contemporary work is built upon the foundational work of Bertsekas, Tsitsiklis et al. [BT89, TBA86]. [NRRW11] introduced HOGWILD!, a completely lock-free and asynchronous parallel stochastic gradient descent (SGD), in shared-memory multicore systems. Inspired by HOGWILD!’s success at achieving nearly linear speedups for a variety of machine learning tasks, several authors developed other lock-free and asynchronous optimization algorithms, such as parallel stochastic coordinate descent [LWR
14, LW15]. Additional work in first order optimization and beyond [DJM13, WSD
14, Hon14, HYD15, FAJ15], extending to parallel iterative linear solvers [LWS14, ADG14], has further demonstrated that linear speedups are generically possible in the asynchronous shared-memory setting. Moreover, [RHS
15] proposes an analysis for asynchronous parallel, but dense, SVRG, under assumptions similar to those found in [NRRW11]. The authors of [DSZOR15] offer a new analysis for the “coordinate-wise” update version of HOGWILD! us-
Figure 9: Convergence and speedups of CYCLADES and HOGWILD! on 1, 4, 8, 16, 18 threads, for different percentage of dense features filtered.
ing martingales, with similar assumptions to [NRRW11], that however can be applied to some non-convex problems. Furthermore, [LHLL15] presents an analysis for stochastic gradient methods on smooth, potentially nonconvex functions. Finally, [PXYY15] introduces a new framework for analyzing coordinate-wise fixed point stochastic iterations.
Recently, [MPP15] provided a new analysis for asynchronous stochastic optimization by interpreting the effects of asynchrony as noise in the iterates. This perspective of asycnhrony as noise in the iterates was used in [PPO
15] to analyze a combinatorial graph clustering algorithm.
Parallel optimization algorithms have also been developed for specific subclasses of problems, including L1-regularized loss minimization [BKBG11] and matrix factorization [RR13].
Other machine learning algorithms that have been parallelized using coordination and concurrency control, including non-parametric clustering [PGJ13], submodular maximization [PJG
14], and correlation clustering [PPO
15].
Sparse, graph-based parallel computation are supported by systems like GraphLab [LGK14] and PowerGraph [GLG
12]. These frameworks require computation to be written in a specific programming model with associative, commutative operations. GraphLab and PowerGraph support serializable execution via locking mechanisms This is in contrast to our partition-and-allocate coordination which allows us to provide guarantees on speedup.
Parameter servers [HCC13, LAP
14] are frameworks supporting distributed, asynchronous computation. Convergence is only guaranteed for some specific algorithms, namely SGD, but not in general as execution is not serializable. The focus of parameter servers is in the distributed setting, where the challenges are different than in the multicore setting.
We presented CYCLADES, a general framework for lock-free parallelization of stochastic optimization algorithms, while maintaining serial equivalence. Our framework can be used to parallelize a large family of stochastic updates algorithms in a conflict-free manner, thereby ensuring the parallelized algorithm produces the same result as its serial counterpart. Theoretical properties, such as convergence rates, are therefore preserved by the CYCLADES-parallelized algorithm, and we provide a single unified theoretical analysis that guarantees near linear speedups.
By eliminating conflicts across processors within each batch of updates, CYCLADES is able to avoid all asynchrony errors and conflicts, and leads to better cache locality and cache coherence than HOGWILD!. These features of CYCLADES translate to near linear speedups in practice, where it can outperform HOG- WILD!-type of implementations by up to a factor of , in terms of speedups
In the future, we intend to explore hybrids of CYCLADES with HOGWILD!, pushing the boundaries of what is possible in a shared-memory setting. We are also considering solutions for scaling out in a distributed setting, where the cost of communication is significantly higher.
BR is generously supported by ONR awards N00014-14-1-0024, N00014-15-1-2620, and N00014-13-1-0129, and NSF awards CCF-1148243 and CCF-1217058. XP’s work is also supported by a DSO National Laboratories Postgraduate Scholarship. This research is supported in part by NSF CISE Expeditions Award CCF-1139158, LBNL Award 7076018, and DARPA XData Award FA8750-12-2-0331, and gifts from Amazon Web Services, Google, SAP, The Thomas and Stacey Siebel Foundation, Adatao, Adobe, Apple, Inc., Blue Goji, Bosch, C3Energy, Cisco, Cray, Cloudera, EMC2, Ericsson, Facebook, Guavus, HP, Huawei, Informatica, Intel, Microsoft, NetApp, Pivotal, Samsung, Schlumberger, Splunk, Virdata and VMware.
[ACN08] Nir Ailon, Moses Charikar, and Alantha Newman. Aggregating inconsistent information: ranking and clustering. Journal of the ACM (JACM), 55(5):23, 2008.
[AD11] Alekh Agarwal and John C Duchi. Distributed delayed stochastic optimization. In Advances in Neural Information Processing Systems, pages 873–881, 2011.
[ADG14] Haim Avron, Alex Druinsky, and Anshul Gupta. Revisiting asynchronous linear solvers: Provable convergence rate through randomization. In Parallel and Distributed Processing Symposium, 2014 IEEE 28th International, pages 198–207. IEEE, 2014.
[ALL15] Sanjeev Arora, Yuanzhi Li, Yingyu Liang, Tengyu Ma, and Andrej Risteski. Rand-walk: A latent variable model approach to word embeddings. arXiv preprint arXiv:1502.03520, 2015.
[BKBG11] Joseph K Bradley, Aapo Kyrola, Danny Bickson, and Carlos Guestrin. Parallel coordinate descent for l1-regularized loss minimization. arXiv preprint arXiv:1105.5379, 2011.
[BT89] Dimitri P Bertsekas and John N Tsitsiklis. Parallel and distributed computation: numerical methods, volume 23. Prentice hall Englewood Cliffs, NJ, 1989.
[CM69] Daniel Chazan and Willard Miranker. Chaotic relaxation. Linear algebra and its applications, 2(2):199–222, 1969.
[CSAK14] Trishul Chilimbi, Yutaka Suzue, Johnson Apacible, and Karthik Kalyanaraman. Project adam: Building an efficient and scalable deep learning training system. In 11th USENIX Symposium on Operating Systems Design and Implementation (OSDI 14), pages 571–582, 2014.
[DBLJ14] Aaron Defazio, Francis Bach, and Simon Lacoste-Julien. Saga: A fast incremental gradient method with support for non-strongly convex composite objectives. In Advances in Neural Information Processing Systems, pages 1646–1654, 2014.
[DCM12] Jeffrey Dean, Greg Corrado, Rajat Monga, Kai Chen, Matthieu Devin, Mark Mao, Andrew Senior, Paul Tucker, Ke Yang, Quoc V Le, et al. Large scale distributed deep networks. In Advances in Neural Information Processing Systems, pages 1223–1231, 2012.
[DJM13] John Duchi, Michael I Jordan, and Brendan McMahan. Estimation, optimization, and parallelism when data is sparse. In Advances in Neural Information Processing Systems, pages 2832– 2840, 2013.
[DSZOR15] Christopher De Sa, Ce Zhang, Kunle Olukotun, and Christopher Ré. Taming the wild: A unified analysis of hogwild!-style algorithms. arXiv preprint arXiv:1506.06438, 2015.
[FAJ15] Hamid Reza Feyzmahdavian, Arda Aytekin, and Mikael Johansson. An asynchronous minibatch algorithm for regularized stochastic optimization. arXiv preprint arXiv:1505.04824, 2015.
[GLG12] Joseph E Gonzalez, Yucheng Low, Haijie Gu, Danny Bickson, and Carlos Guestrin. Powergraph: Distributed graph-parallel computation on natural graphs. In OSDI, pages 17–30, 2012.
[GNHS11] Rainer Gemulla, Erik Nijkamp, Peter J Haas, and Yannis Sismanis. Large-scale matrix factorization with distributed stochastic gradient descent. In Proceedings of the 17th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 69–77. ACM, 2011.
[Gro09] GroupLens. MoveLens 10m dataset, 2009.
[HCC13] Qirong Ho, James Cipar, Henggang Cui, Seunghak Lee, Jin Kyu Kim, Phillip B Gibbons, Garth A Gibson, Greg Ganger, and Eric P Xing. More effective distributed ml via a stale synchronous parallel parameter server. In Advances in neural information processing systems, pages 1223–1231, 2013.
[Hon14] Mingyi Hong. A distributed, asynchronous and incremental algorithm for nonconvex optimization: An admm based approach. arXiv preprint arXiv:1412.6058, 2014.
[HYD15] Cho-Jui Hsieh, Hsiang-Fu Yu, and Inderjit S Dhillon. Passcode: Parallel asynchronous stochastic dual co-ordinate descent. arXiv preprint arXiv:1504.01365, 2015.
[JKM15] Chi Jin, Sham M Kakade, Cameron Musco, Praneeth Netrapalli, and Aaron Sidford. Robust shift-and-invert preconditioning: Faster and more sample efficient algorithms for eigenvector computation. arXiv preprint arXiv:1510.08896, 2015.
[JST14] Martin Jaggi, Virginia Smith, Martin Takác, Jonathan Terhorst, Sanjay Krishnan, Thomas Hofmann, and Michael I Jordan. Communication-efficient distributed dual coordinate ascent. In Advances in Neural Information Processing Systems, pages 3068–3076, 2014.
[JZ13] Rie Johnson and Tong Zhang. Accelerating stochastic gradient descent using predictive variance reduction. In Advances in Neural Information Processing Systems, pages 315–323, 2013.
[KON15] KONECT. DBLP network dataset, May 2015.
[Kri16] Michael Krivelevich. The phase transition in site percolation on pseudo-random graphs. The Electronic Journal of Combinatorics, 23(1):1–12, 2016.
[KTF09] U Kang, Charalampos E Tsourakakis, and Christos Faloutsos. Pegasus: A peta-scale graph mining system implementation and observations. In Data Mining, 2009. ICDM’09. Ninth IEEE International Conference on, pages 229–238. IEEE, 2009.
[LAP14] Mu Li, David G Andersen, Jun Woo Park, Alexander J Smola, Amr Ahmed, Vanja Josifovski, James Long, Eugene J Shekita, and Bor-Yiing Su. Scaling distributed machine learning with the parameter server. In Proc. OSDI, pages 583–598, 2014.
[LGK14] Yucheng Low, Joseph E Gonzalez, Aapo Kyrola, Danny Bickson, Carlos E Guestrin, and Joseph Hellerstein. Graphlab: A new framework for parallel machine learning. arXiv preprint arXiv:1408.2041, 2014.
[LHLL15] Xiangru Lian, Yijun Huang, Yuncheng Li, and Ji Liu. Asynchronous parallel stochastic gradient for nonconvex optimization. arXiv preprint arXiv:1506.08272, 2015.
[LW15] Ji Liu and Stephen J Wright. Asynchronous stochastic coordinate descent: Parallelism and convergence properties. SIAM Journal on Optimization, 25(1):351–376, 2015.
[LWR14] Ji Liu, Steve Wright, Christopher Re, Victor Bittorf, and Srikrishna Sridhar. An asynchronous parallel stochastic coordinate descent algorithm. In ICML 2014, pages 469–477, 2014.
[LWS14] Ji Liu, Stephen J Wright, and Srikrishna Sridhar. An asynchronous parallel randomized kaczmarz algorithm. arXiv preprint arXiv:1401.4780, 2014.
[Mah06] Matt Mahoney. Large text compression benchmark, 2006.
[MPP15] Horia Mania, Xinghao Pan, Dimitris Papailiopoulos, Benjamin Recht, Kannan Ramchandran, and Michael I Jordan. Perturbed iterate analysis for asynchronous stochastic optimization. arXiv preprint arXiv:1507.06970, 2015.
[MSSV09] Justin Ma, Lawrence K Saul, Stefan Savage, and Geoffrey M Voelker. Identifying suspicious urls: an application of large-scale online learning. In Proceedings of the 26th Annual International Conference on Machine Learning, pages 681–688. ACM, 2009.
[NRRW11] Feng Niu, Benjamin Recht, Christopher Re, and Stephen Wright. Hogwild: A lock-free ap- proach to parallelizing stochastic gradient descent. In Advances in Neural Information Processing Systems, pages 693–701, 2011.
[PGJ13] Xinghao Pan, Joseph E Gonzalez, Stefanie Jegelka, Tamara Broderick, and Michael I Jordan. Optimistic concurrency control for distributed unsupervised learning. In Advances in Neural Information Processing Systems 26, pages 1403–1411. Curran Associates, Inc., December 2013.
[PJG14] Xinghao Pan, Stefanie Jegelka, Joseph E Gonzalez, Joseph K Bradley, and Michael I Jordan. Parallel double greedy submodular maximization. In Z. Ghahramani, M. Welling, C. Cortes, N.D. Lawrence, and K.Q. Weinberger, editors, Advances in Neural Information Processing Systems 27, pages 118–126. Curran Associates, Inc., December 2014.
[PPO15] Xinghao Pan, Dimitris Papailiopoulos, Samet Oymak, Benjamin Recht, Kannan Ramchandran, and Michael I Jordan. Parallel correlation clustering on big graphs. In Advances in Neural Information Processing Systems, pages 82–90, 2015.
[PXYY15] Z. Peng, Y. Xu, M. Yan, and W. Yin. ARock: an Algorithmic Framework for Asynchronous Parallel Coordinate Updates. arXiv preprint arXiv:1506.02396, 2015.
[RHS15] Sashank J Reddi, Ahmed Hefny, Suvrit Sra, Barnabás Póczos, and Alex Smola. On variance reduction in stochastic gradient descent and its asynchronous variants. arXiv preprint arXiv:1506.06840, 2015.
[RR13] Benjamin Recht and Christopher Ré. Parallel stochastic gradient algorithms for large-scale matrix completion. Mathematical Programming Computation, 5(2):201–226, 2013.
[RRTB12] Ben Recht, Christopher Re, Joel Tropp, and Victor Bittorf. Factoring nonnegative matrices with linear programs. In Advances in Neural Information Processing Systems, pages 1214–1222, 2012.
[RT12] Peter Richtárik and Martin Takáˇc. Parallel coordinate descent methods for big data optimization. arXiv preprint arXiv:1212.0873, 2012.
[SRB13] Mark Schmidt, Nicolas Le Roux, and Francis Bach. Minimizing finite sums with the stochastic average gradient. arXiv preprint arXiv:1309.2388, 2013.
[TBA86] John N Tsitsiklis, Dimitri P Bertsekas, and Michael Athans. Distributed asynchronous deterministic and stochastic gradient optimization algorithms. IEEE transactions on automatic control, 31(9):803–812, 1986.
[UF 14] UF Sparse Matrix Collection. DIMACS10/nh2010, 2014.
[WSD14] Yu-Xiang Wang, Veeranjaneyulu Sadhanala, Wei Dai, Willie Neiswanger, Suvrit Sra, and Eric P Xing. Asynchronous parallel block-coordinate frank-wolfe. arXiv preprint arXiv:1409.6086, 2014.
[YYH13] Hyokun Yun, Hsiang-Fu Yu, Cho-Jui Hsieh, SVN Vishwanathan, and Inderjit Dhillon. Nomad: Non-locking, stochastic multi-machine algorithm for asynchronous and decentralized matrix completion. arXiv preprint arXiv:1312.0193, 2013.
[ZCJL13] Yong Zhuang, Wei-Sheng Chin, Yu-Chin Juan, and Chih-Jen Lin. A fast parallel sgd for matrix factorization in shared memory systems. In Proceedings of the 7th ACM conference on Recommender systems, pages 249–256. ACM, 2013.
[ZLS09] Martin Zinkevich, John Langford, and Alex J Smola. Slow learners are fast. In Advances in Neural Information Processing Systems, pages 2331–2339, 2009.
[ZR14] Ce Zhang and Christopher Ré. Dimmwitted: A study of main-memory statistical analytics. Proceedings of the VLDB Endowment, 7(12):1283–1294, 2014.
[ZWLS10] Martin Zinkevich, Markus Weimer, Lihong Li, and Alex J Smola. Parallelized stochastic gradient descent. In Advances in Neural Information Processing Systems, pages 2595–2603, 2010.
Here we show that several algorithms belong to the Stochastic Updates (SU) family. These include the well-known stochastic gradient descent, iterative linear solvers, stochastic PCA and others, as well as combinations of weight decay updates, variance reduction methods, and more. Interestingly, even some combinatorial graph algorithms fit under the SU umbrella, such as the maximal independent set, greedy correlation clustering, and others. We visit some of these algorithms below.
Stochastic Gradient Descent (SGD) Given n functions , one often wishes to minimize the average of these functions:
A popular algorithm to do so —even in the case of non-convex losses— is the stochastic gradient descent:
In this case, the distribution D for each sample is usually a with or without replacement uniform sampling among the n functions. For this algorithm the conflict graph between the n possible different updates is completely determined by the support of the gradient vector
.
Weight decay and regularization Similar to SGD, in some cases we might wish to regularize the objective with an term and solve instead the following optimization:
In this case, the update is a weighted version of the “non-regularized" SGD:
The above stochastic update algorithm can be also be written in the SU language. Although here for each single update the entire model has to be updated with the new weights, we show below that with a simple technique it can be equivalently expressed so that each update is sparse and the support is again determined by the gradient vector .
First order techniques with variance reduction Variance reduction is a technique that is usually employed for (strongly) convex problems, where we wish to minimize the variance of SGD in order to achieve better rates. A popular way to do variance reduction is either through SVRG or SAGA, where a “memory” factor is used in the computation of each gradient update rule. For SAGA we have
where g , and y is updated every T iterations of the previous form to be equal to the last x
iterate. Again, although at first sight the above updates seem to be dense, we show below how we can equivalently rewrite them so that the update-conflict graph is completely determined by the support of the gradient vector
.
Combinatorial graph algorithms Interestingly, even some combinatorial graph problems can be phrased in the SU language: greedy correlation clustering (The Pivot Algorithm [ACN08]) and the maximal independent set (these are in fact identical algorithms). In the case of correlation clustering, we are given a graph G vertices joined with either positive or negative edges. Here the objective is to create a number of clusters so that the number of vertex pairs that are sharing negative edges within clusters, plus the number of pairs that are sharing positive edges across clusters, is minimized. For these cases, there exists a very simple algorithm that obtains a 3 approximation for the above objective: randomly sample a vertex, create a cluster with that vertex and its neighborhood, remove that cluster from the graph, and repeat. The above procedure is amenable to the following update rule:
where x is intialized to , and at each iteration we sample v uniformly among those with label
, and N(v) denotes the neighborhood of a vertex in G. Interestingly, we can directly apply the same guarantees of the main CYCLADES theorem here. An optimized implementation of CYCLADES for correlation clustering was developed in [PPO
15].
To reiterate, all of the above algorithms, various combinations of them, and further extensions can be written in the language of SU, as presented in Alg. 2.
A.1 Lazy Updates
For the cases of weight decay/regularization, and variance reduction, we can reinterpret their inherently dense updates in an equivalent sparse form. Let us consider the following generic form of updates:
where for all
. Each stochastic update therefore reads from the set
but writes to every coordinate. However, it is possible to make updates lazily only when they are required. Observe that if
updates are made, each of which have
, then we could rewrite these
updates in closed form as
This allows the stochastic updates to only write to coordinates in and defer writes to other coordinates. This procedure is described in Algorithm 3. With CYCLADES it is easy to keep track of
, since we know the serially equivalent order of each stochastic update. On the other hand, it is unclear how a HOGWILD! approach would behave with additional noise in
due to asynchrony. In fact, HOGWILD! could possibly result in negative values of
, and in practice, we find that it is often useful to threshold
by
.
Variance reduction with sparse gradients Suppose is sparse, such that
for all x and
. Then we can perform SVRG and SAGA using lazy updates, with
. Just-in-time updates for SAG (a similar algorithm to SAGA) were introduced in [SRB13]. For SAGA, the update Eq 2 becomes
SVRG with dense linear gradients Suppose instead that the gradient is dense, but has linear form , where
for
. The SVRG stochastic update on the jth coordinate is then
where as above. This fits into our framework with
, and
.
In this Appendix, we show how the sampling and shattering Theorem 2 can be restated for sampling with, or without replacement to establish Theorem 3.
sists of n i.i.d. Bernoulli random variables, each with probability p. In the second sequence , a ran- dom subset of B random variables is set to 1 without replacement. Finally, in the third sequence
, we draw B variables with replacement, and we set them to 1. Here, B is integer that satisfies the following bounds
Now, consider any function f, that has a “monotonicity" property:
Let us now define
for some number C, and let us further assume that we have an upper bound on the above probability
Our goal is to bound and
. By expanding
using the law of total probability we have
where , denotes the probability that
given that a uniformly random subset of b variables was set to 1. Moreover, we have
where (i) comes form the fact that is the same as the probability that that
given that a uniformly random subset of b variables where set to 1, and (ii) comes from the fact that since we sample without replacement in Y , we have that
always.
In the expansion of , we can keep the b = B term, and lower bound the probability to obtain:
since all terms in the sum are non-negative numbers. Moreover, since s are Bernoulli random variables, their sum
is Binomially distributed with parameters n and p. We know that the maximum of the Binomial pmf with parameters n and p occurs at
where B is the integer that satisfies the upper bound mentioned above:
. Furthermore, the maximum value of the Binomial pmf, with parameters n and p, cannot be less than the corresponding probability of a uniform element:
The above establish a relation between the without replacement sampling sequence , and the i.i.d. uniform sampling sequence
. Then, for the last sequence
we have
where (i) comes from the fact that is zero for b = 0 and b > B, (ii) comes by applying Hölder’s Inequality, and (iii) holds since f is assumed to have the monotonicity property:
for any sequence of variables . Hence, for any
In conclusion, we have upper bounded and
by
Application to Theorem 3: For our purposes, the above bound Eq. (10) allows us to assert Theorem 3
for with replacement, without replacement, and i.i.d. sampling, with different constants. Specifically, for any graph G, the size of the largest connected component in the sampled subgraph can be expressed as a function , where each
is an indicator for whether the ith vertex was chosen in the sampling process. Note that
is a monotone function, i.e.,
since adding vertices to the sampled subgraph may only increase (or keep constant) the size of the largest connected component. We note that the high probability statement of Theorem 2, can be restated so that the constants in front of the size of the connected components accomodate for a statement that is true with probability
, for any constant
. This is required to take care of the extra n factor that appears in the bound of Eq. 10, and to obtain Theorem 3.
As we will see in the following, the cost of computing CCs in parallel will depend on the number of cores so that uniform allocation across them is possible, and the number of edges that are induced by the sampled updates on the bipartite update-variable graph is bounded. As a reminder we denote as
the bipartite subgraphs of the update-variable graph
, that is induced by the sampled updates of the i-th batch. Let us denote as
the number of edges in
.
Following the sampling recipe of our main text (i.e., sampling each update per batch uniformly and with replacement), let us assume here that we are sampling updates in total, for some constant
. Assuming that the size of each batch is
, the total number of sampled batches will be
. The total number of edges in the induced sampled bipartite graphs is a random variable that we denote as
Observe that . Using a simple Hoeffding concentration bound we can see that
where is the max left degree of the bipartite graph
and
is its average left degree. Now assuming that
Hence, we get the following simple lemma:
Lemma 3. Let . Then, the total number of edges
across the
sampled subgraphs
is less than
with probability
.
Now that we have a bound on the number of edges in the sampled subgraphs, we can derive the complexity bounds for computing CCs in parallel. We will break the discussion into the not-too-many- and many-core regime.
The not-too-many cores regime. In this case, we sample subgraphs, allocate them across P cores, and let each core compute CCs on its allocated subgraphs using BFS or DFS. Since each batch is of size
, we need
batches to cover
updates in total. If the number of cores is
then the max cost of a single CC computation on a subgraph (which is ) is smaller than the average cost across P cores, which is O(Z/P). This implies that a uniform allocation is possible, so that P cores can share the computational effort of computing CCs. Hence, we can get the following lemma:
Lemma 4. Let the number of cores be
. Then, each core will not spend more than
time in computing CCs, with high probability.
The many-cores regime. When the uniform balancing of the above method will break, leaving no room for further parallelization. In that case, we can use a very simple “push-label” CC algorithm, whose cost on P cores and arbitrary graphs with E edges and max degree
is
, where
is the size of the longest-shortest path, or the diameter of the graph [KTF09]. This parallel CC algorithm is given below, where each core is allocated with a number of vertices
The above simple algorithm can be significantly slow for graphs where the longest-shortest path is large. Observe, that in the sampled subgraphs the size of the shortest-longest path is always bounded by the size of the largest connected component. By Theorem 3 that is bounded by
. Hence, we obtain the following lemma.
Since, we are interested in the overall running time for batches of the CC algorithm, we can see that the above lemma simply boils down to the following:
Corollary 1. For any number of cores , computing the connected component for all sampled graph
can be performed in time
.
Remark 2. In practice it seems to be that parallelizing the CC computation using the not-too-many core regime policy is significantly more scalable.
After we have sampled a single batch (i.e., a subgraph ), and computed the CCs for it, we have to allocate the connected components of that sampled subgraph across cores. Observe that each connected component will contain at most log n updates, each ordered according to the a serial predetermined order. Once a core has been assigned all the CCs, it will process all the updates included in the CCs according to the order that each update has been labeled with.
Now assuming that the cost of the i-th update is , the cost of a single connected component C will be
. We can now allocate the CCs accross cores so that the maximum core load is minimized, using the following 4/3-approximation algorithm (i.e., an allocation with max load that is at most 4/3 times the maximum between the max weight, and the sum of weights divided by P):
To proceed with characterizing the maximum load among the P cores, we assume that the cost of a single update is proportional to the out-degree of that update —according to the update-variable graph
— times a constant cost which we shall refer to as
. Hence,
, where
is the degree of the i-th left vertex of
.
imum weight among all CCs cannot be more than where
is the max left degree of the bipartite update-variable graph
.
Lemma 6. We can allocate CCs such that the maximum load among cores is with high probability, where
is the per edge cost for computing one of the n updates defined on
.
If then the average weight will be larger than the maximum divided by a log n factor, and a near-uniform allocation of CCs according to their weights possible. Since, we are interested in the overall running time for
batches, we can see that the above lemma simply boils down to the following:
Corollary 2. For any number of cores , computing the stochastic updates of the allocated connected component for all sampled graphs (i.e., batches)
can be performed in time
.
Here, we discuss how CYCLADES can guarantee nearly linear speedups when there is a sublinear number of high-conflict updates, as long as the remaining updates have small degree.
Assume that our conflict graph defined between the n update functions has a very high maximum degree
. However, consider the case where there are only
nodes that are of that high-degree, while the rest of the vertices have degree much smaller (on the induced subgraph by the latter vertices), say
. According to our main analysis, our prescribed batch sizes cannot be greater than
. However, if say
, then that would imply that B = O(1), hence there is not room for parallelization by CYCLADES. What we will show, is that by sampling according to
, we can on average expect a parallelization that is similar to the case where the outliers are not present in the conflict graph. For a toy example see Figure 10.
Figure 10: The above conflict graph has a vertex with high degree (i.e., ), and the remaining of the graph has maximum induced degree
. In this toy case, when we sample roughly
vertices, more often than not, the large degree vertex will not be part of the sampled batch. This implies that when parallelizing with CYCLADES these cases will be as much parallelizable as if the high degree vertex was not part of the graph. Each time we happen to sample a batch that includes the max. degree vertex, then essentially we lose all flexibility to parallelize, and we have to run the serial algorithm. What we establish rigorously is that “on average" the parallelization will be as good as one would hope for even in the case where the outliers are not present.
Our main result for the outlier case follows:
Lemma 7. Let us assume that there are outlier vertices in the original conflict graph G with degree at most
, and let the remaining vertices have degree (induced on the remaining graph) at most
. Let the induced update-variable graph on these low degree vertices abide to the same graph assumptions as those of Theorem 4. Moreover, let the batch size be bounded as
Then, the expected runtime of CYCLADES will be
Proof. Let denote the total work required for batch i if that batch contains no outlier notes, and
otherwise. It is not hard to see that
and
Hence, the expected computational effort by CYCLADES will be
where
Hence the expected running time will be proportional to , if
In this section, we present the remaining experimental results that were left out for brevity from our main experimental section. In Figures 11 and 12, we show the convergence behaviour of our algorithms, as a function of the overall time, and then as a function of the time that it takes to perform only the stochastic updates (i.e., in Fig. 12 we factor out the graph partitioning, and allocation time). In Figure 13, we provide the complete set of speedup results for all algorithms and data sets we tested, in terms of the number of cores. In Figure 14, we provide the speedups in terms of the the computation of the stochastic updates, as a function of the number of cores. Then, in Figures 15 – 18, we present the convergence, and speedups of the overal computation, and then of the stochastic updates part, for our dense feature URL data set. Finally, in Figure 19 we show the divergent behavior of HOGWILD! for the least square experiments with SAGA, on the NH2010 and DBLP datasets.
Our overall observations here are similar to the main text. One additional note to make is that when we take a closer look to the figures relative to the times and speedups of the stochastic updates part of CYCLADES (i.e., when we factor out the time of the graph partitioning part), we see that CYCLADES is able to perform stochastic updates faster than HOGWILD! due to its superior spatial and temporal access locality patterns. If the coordination overheads for CYCLADES are excluded, we are able to improve speedups, in some cases by up to 20-70% (Table 5). This suggests that by further optimizing the computation of connected components, we can hope for better overall speedups of CYCLADES.
Table 5: Speedups of CYCLADES at 16 threads. Two versions speedups are given for each problem: (1) with the overall running time, including the coordination overheads, and (2) using only the running time for stochastic updates. Speedups using only stochastic updates are up to 20% better, which suggests we could potentially observe larger speedups by further optimizing the computation of connected components.
Figure 11: Convergence of CYCLADES and HOGWILD! on various problems, using 1, 8, 16 threads, in terms of overall running time. CYCLADES is initially slower, but ultimately reaches convergence faster than HOGWILD!.
Figure 12: Convergence of CYCLADES and HOGWILD! on various problems, using 1, 8, 16 threads, in terms of running time for stochastic updates.
Figure 13: Speedup of CYCLADES and HOGWILD! on various problems, using 1, 4, 8, 16 threads, in terms of overall running time. On multiple threads, CYCLADES always reaches objective faster than HOGWILD!. In some cases (13(a), 13(e), 13(g)), CYCLADES is faster than HOGWILD! on even 1 thread, as CYCLADES has better cache locality.
Figure 14: Speedup of CYCLADES and HOGWILD! on various problems, using 1, 4, 8, 16 threads, in terms of running time for stochastic updates.
(d) 0.048% Figure 15: Convergence of CYCLADES and HOGWILD! on the malicious URL detection problem, using 1, 4, 8, 16 threads, in terms of overall running time, for different percentage of features filtered.
(d) 0.048% Figure 16: Convergence of CYCLADES and HOGWILD! on the malicious URL detection problem, in terms of running time for stochastic updates, for different percentage of features filtered.
(d) 0.048% Figure 17: Speedup of CYCLADES and HOGWILD! on the malicious URL detection problem, using 1, 4, 8, 16 threads, in terms of overall running time, for different percentage of features filtered.
(d) 0.048% Figure 18: Speedup of CYCLADES and HOGWILD! on the malicious URL detection problem, in terms of running time for stochastic updates, for different percentage of features filtered.
Figure 19: Convergence of CYCLADES and HOGWILD! on least squares using SAGA, with 16 threads, on the NH2010 and DBLP datasets. CYCLADES was able to converge using larger stepsizes, but HOGWILD! often diverged with the same large stepsize. Thus, we were only able to use smaller stepsizes for HOGWILD! in the multi-threaded setting.