Approximate Gradient Coding via Sparse Random Graphs

Zachary Charles, Dimitris Papailiopoulos, Jordan Ellenberg

Introduction

Deploying algorithms on distributed systems has become the de facto choice for scaling-out machine learning on large data sets. Distributed algorithms generally achieve substantial runtime speedups compared to single node algorithms. Unfortunately, these speedup gains often fall short of the theoretically optimal speedup when scaling beyond a few tens of compute nodes . This commonly observed behavior is referred to as the speedup saturation phenomenon. One of the causes of speedup saturation is the presence of stragglers. These are compute nodes whose runtime is substantially higher than the average runtime among all nodes.

Several methods for mitigating the effect of stragglers have been recently proposed. These approaches include replicating jobs across redundant nodes and dropping stragglers in the case that the underlying computation is robust to errors . Moreover, redundant compute nodes can help improve the performance of distributed model training algorithms, as demonstrated in .

Recently, tools from coding theory have gained traction in an effort to mitigate stragglers. Lee et al. proposed the use of techniques from coding theory to compensate for stragglers and communication bottlenecks in machine learning settings, especially for the computation of linear functions. Li et al. proposed using coding theory to reduce inter-server communication in the shuffling phase of MapReduce . Then, propose another coding-theoretic algorithm for speeding up distributed matrix multiplication in heterogeneous clusters. The use of codes for distributed matrix multiplication and linear operations on functions was also studied in , which analyzes the trade-off between the flexibility and sparsity of the code.

In , the authors propose gradient coding, a technique to exactly recover the sum of gradients from a subset of compute nodes. The authors show that kk gradients can be recovered from any k−sk-s compute nodes, as long as each node computes s+1s+1 gradients. In other words, the algorithm is robust to ss stragglers. Gradient coding is particularly relevant to synchronous distributed learning algorithms that involve computing sums of gradients, such as mini-batch stochastic gradient descent and full-batch gradient descent. While some of the gradient code constructions in are randomized, the authors in use deterministic codes based on expander graphs to achieve similar results.

Most of the above results focus on exact reconstruction of a sum of functions. In many practical distributed settings, we may only require approximate reconstruction of the sum. For example, parallel model training in machine learning settings has been shown to be robust to noise . In some scenarios, noisy gradients may even improve the generalization performance of the trained model . By only approximately reconstructing the desired function, we hope to increase the speed and tolerance to stragglers of our distributed algorithm. In fact, expander graphs, particularly Ramanujan graphs, can be used for such approximate reconstruction . Unfortunately, expander graphs, especially Ramanujan graphs, can be expensive to compute in practice, especially for large numbers of compute nodes. Moreover, the desired parameters of the construction may be constrained according to underlying combinatorial rules.

In this work, we use sparse graphs to create gradient codes capable of efficiently and accurately computing approximate gradients in a distributed manner. More generally, these codes can be used to approximately compute any sum of functions in a distributed manner. We formally introduce the approximate recovery problem using a coding–theoretic interpretation, and present and analyze two decoding techniques for approximate reconstruction: an optimal decoding algorithm that has polynomial-time complexity, and a fast decoding method that has linear complexity in the sparsity of the input.

We focus on two different codes that are efficiently computable and require only a logarithmic number of tasks per compute node. The first is the Fractional Repetition Code (FRC) proposed in . We show that FRCs can achieve small or zero error with high probability, even if a constant fraction of compute nodes are stragglers. However, we show that FRCs are susceptible to adversarial stragglers, where an adversary can force a subset of the nodes to become stragglers. To get around this issue, we also present the Bernoulli Gradient Code (BGC) and the regularized Bernoulli Gradient Code (rBGC), whose constructions are based on sparse random graphs. We show that adversarial straggler selection in general codes is NP-hard, suggesting that these random codes may perform better then FRCs against polynomial-time adversaries. We give explicit bounds on the error of BGCs and rBGCs that show that their potential tolerance to adversaries comes at the expense of a worse average-case error than FRCs. We provide simulations that support our theoretical results. These simulations show that there is a trade-off between the decoding complexity of a gradient code and its average- and worst-case performance.

Setup

2 Problem Statement

In this work, we consider a distributed master-worker setup of nn compute nodes, each of which is assigned a maximum of ss tasks. The compute nodes can compute locally assigned tasks and they can send messages to the master node.

The goal of the master node is to compute the sum of kk functions

The above setup is relevant to distributed learning algorithms, where we often wish to find some model x{\bf x} by minimizing

Approximate Gradient Coding: There are three components of an approximate gradient coding scheme:

The function assignment per compute node.

The messages sent from a compute node to the master.

The decoding algorithm used by the master to recover an approximate sum of gradients.

After assigning tasks to each compute node, we let the compute nodes run local computations for some maximum amount of time. Afterwards, we may have compute nodes that either failed to compute some functions or are still running. These are the straggler nodes. During the approximate reconstruction of the sum, we assume that the master node only has access to the output of the rr non-straggler nodes out of the nn total compute nodes. We want to use their output to compute the best approximation possible to f(x)f({\bf x}) given in (2.1). We assume that we can only take linear combinations of the outputs of the non-straggler nodes.

More formally, the task assignments are represented by a function assignment matrix G{\bf G}, a k×nk\times n matrix where the support of column jj indexes the functions assigned to compute node jj. The entries of column jj correspond to the coefficients of the linear combination of these local functions that the compute node sends back to the master once the compute node has completed its local computations.

Let A\mathbf{A} denote the k×rk\times r submatrix of G{\bf G} corresponding to the rr non-straggler compute nodes. The minimum recovery error for a given subset matrix A\mathbf{A} is given by

To better analyze this error, we define the optimal decoding error of a matrix A\mathbf{A}.

The optimal decoding error of a non-straggler matrix A\mathbf{A} is defined as

The optimal decoding error quantifies how close 1k{\bf 1}_{k} is to being in the span of the columns of A\mathbf{A}. Taking x=0r{\bf x}={\bf 0}_{r}, we see that for any A\mathbf{A}, 0≤err⁡(A)≤k0\leq\operatorname{err}(\mathbf{A})\leq k. It is worth noting that err⁡(A)\operatorname{err}(\mathbf{A}) is the absolute error incurred in our approximation. The multiplicative error is err⁡(A)/k\operatorname{err}(\mathbf{A})/k. Note that if err⁡(A)\operatorname{err}(\mathbf{A}) is small, then the overall minimum recovery error is small relative to ∥f∥22\|{\bf f}\|_{2}^{2}, since

For a given matrix A\mathbf{A}, let A+\mathbf{A}^{+} denote its pseudo-inverse. Properties of the pseudo-inverse imply

In general, we are interested in constructing function assignment matrices G{\bf G} such that submatrices A\mathbf{A} have small decoding error. Note that we can either consider the worst-case among all A\mathbf{A} or consider the setting where A\mathbf{A} is chosen uniformly at random. We will refer to these G{\bf G} matrices as approximate gradient codes.

Approximate gradient codes were constructed in using expander graphs. The authors show in particular that if G{\bf G} is the adjacency matrix of a Ramanujan graph, then the worst-case decoding error is relatively small. Unfortunately, such graphs may be expensive to compute in practice. To circumvent this issue, we use simplified random constructions.

Our main theorem shows that there is an efficiently computable code that has small or zero decoding error with high probability, even with a constant fraction of stragglers. We state an informal version of this theorem below. Theorem 8 below will provide a more general and formal statement, along with the proof.

We can assign s=O(log⁡k)s=O(\log k) tasks to each compute node in such a way that with probability at least 1−1k1-\frac{1}{k}, we can tolerate Θ(k)\Theta(k) randomly chosen stragglers within a multiplicative error of ϵ\epsilon where

In other words, for any kk and a constant fraction of stragglers rr, there is a code with sparsity Θ(log⁡(k))\Theta(\log(k)) that can exactly reconstruct the gradient with high probability. While this code achieves smaller error for most A\mathbf{A} than previously designed gradient codes, we show that this comes at the expense of the worst-case error, which can be Θ(k)\Theta(k). Here, the worst-case is taken over all possible sets of nodes that become stragglers. Moreover, this worst-case be computed efficiently by an adversary. On the other hand, we show that in general, adversarial straggler selection is NP-hard. In order to counter polynomial-time adversaries, we give another approximate gradient code that utilizes randomness. We also bound the decoding error of this code. We show the following informal theorem.

We can randomly assign O(log⁡k)O(\log k) tasks to each compute node in such a way that with probability at least 1−1k1-\frac{1}{k}, we can tolerate δk\delta k randomly chosen stragglers within a multiplicative error of ϵ\epsilon where

Theorem 24 below gives a more general and formal statement, along with the proof. In comparison, work in derives worst-case bounds on err⁡(A)\operatorname{err}(\mathbf{A}) when G{\bf G} is the adjacency matrix of an ss-regular expander graph. Given such a G{\bf G}, denotes its eigenvalues as λ1≥…≥λk\lambda_{1}\geq\ldots\geq\lambda_{k}. We will let λ(G):=max⁡{∣λ2∣,∣λk∣}\lambda({\bf G}):=\max\{|\lambda_{2}|,|\lambda_{k}|\}. Then the aforementioned work proves the following theorem.

Suppose G{\bf G} is a log⁡(k)\log(k)-regular expander. Then we can tolerate any δk\delta k stragglers within a multiplicative error of ϵ\epsilon where

In particular, if G{\bf G} is a Ramanujan graph, then this becomes ϵ=O(δk/(1−δ)s)\epsilon=O(\delta k/(1-\delta)s). This comes at the expense of having a more computationally difficult construction, as expander graphs, especially Ramanujan graphs, can be difficult to compute.

Decoding: We would like to note that the performance of a gradient code depends in part on the decoding algorithm, i.e., how we use the output from the non-stragglers to approximate the desired output. In our setting, we want to use the received non-straggler matrix A\mathbf{A} to approximate 1k{\bf 1}_{k}. We give two possible methods below. We will refer to these as decoding methods because of the parallels to coding theory.

For the one-step decoding error, we will generally consider ρ=krs\rho=\frac{k}{rs}. If G{\bf G} has ss entries in each column and row, then we would expect A\mathbf{A} to have roughly rsk\frac{rs}{k} entries in each row. If this holds exactly, then setting ρ=krs\rho=\frac{k}{rs} will allow us to exactly reconstruct the gradient.

A decoding method analogous to the one-step decoding method was previously used in . Note that the one-step decoding method is more efficient to compute than the optimal decoding, especially when A\mathbf{A} is ill-conditioned or kk is large. Moreover, we can apply the one-step decoding method even if we do not have direct access to A\mathbf{A} but can compute matrix-vector product Ax\mathbf{A}{\bf x}. The one-step decoding method allows us to avoid putting the entire matrix A\mathbf{A} in to memory of the master compute node in settings where this is not possible.

It is straightforward to see that if v{\bf v} is the optimal decoding vector of A\mathbf{A}, then ∥v−1k∥22=err⁡(A)\|{\bf v}-{\bf 1}_{k}\|_{2}^{2}=\operatorname{err}(\mathbf{A}). On the other hand, if v{\bf v} is the one-step decoding vector of A\mathbf{A} then ∥v−1k∥22≥err⁡(A)\|{\bf v}-{\bf 1}_{k}\|_{2}^{2}\geq\operatorname{err}(\mathbf{A}). We define the one-step decoding error of A\mathbf{A} as follows.

For a given ρ>0\rho>0, the one-step error of A\mathbf{A} is defined by

Fractional Repetition Codes

We would like to devise a code that achieves small error with high probability in the setting that our stragglers are chosen randomly. In fact, this can be achieved by the fractional repetition code (FRC) used in . Note that only considers this code for exact reconstruction of the gradient over all subsets of stragglers. This code can still be used when we only want approximately reconstruct the sum of kk gradients with high probability.

This scheme works by replicating certain tasks between compute nodes. Suppose that we have kk tasks and kk compute nodes and we want each compute node to compute ss tasks. Without loss of generality, we suppose that ss divides kk. The assignment matrix Gfrac{\bf G}_{\text{frac}} for this scheme is then defined by

We assume that the k×rk\times r matrix Afrac{\bf A}_{\text{frac}} of non-stragglers has columns that are sampled uniformly without replacement from the kk columns of Gfrac{\bf G}_{\text{frac}}. We first compute the expected one-step decoding error. Let ai{\bf a}_{i} denote column ii of Afrac{\bf A}_{\text{frac}}.

Fix ai{\bf a}_{i}. Since ai{\bf a}_{i} has ss non-zero entries that are all 11, aiTai=s{\bf a}_{i}^{T}{\bf a}_{i}=s. Next, suppose j≠ij\neq i. By the construction of Gfrac{\bf G}_{\text{frac}}, there are only s−1s-1 columns of Gfrac{\bf G}_{\text{frac}} that are not orthogonal to ai{\bf a}_{i}. Note that aj{\bf a}_{j} is a duplicate of ai{\bf a}_{i} with probability s−1k\frac{s-1}{k}. If this holds, then aiTaj=s{\bf a}_{i}^{T}{\bf a}_{j}=s, and it is 0 if this does not hold. Therefore, for i≠ji\neq j,

Setting ρ=krs\rho=\frac{k}{rs} in the one-step decoding method, we have

Between step 1 and step 2 we used the fact that the columns of Afrac\mathbf{A}_{\text{frac}} all have ss non-zero entries so 1kTAfrac=s1r{\bf 1}_{k}^{T}\mathbf{A}_{\text{frac}}=s{\bf 1}_{r}. Applying Lemma 4,

Next, we consider the optimal decoding error of Afrac\mathbf{A}_{\text{frac}}. Note that each column of Afrac\mathbf{A}_{\text{frac}} must be equal to one of the following k/sk/s distinct vectors,

There are ss copies of each vi{\bf v}_{i} in Gfrac{\bf G}_{\text{frac}} and Afrac\mathbf{A}_{\text{frac}} has a set of columns given by sampling rr of these without replacement. It is straightforward to see that err⁡(Afrac)=αs\operatorname{err}(\mathbf{A}_{\text{frac}})=\alpha s, where α\alpha is the number of ii such that vi{\bf v}_{i} is not a column of Afrac\mathbf{A}_{\text{frac}}.

Let Y1,…,Yk/sY_{1},\ldots,Y_{k/s} denote the random variables where YiY_{i} indicates whether vi{\bf v}_{i} is not a column of A\mathbf{A}. Note that we then have

Each YiY_{i} is 1 iff none of the ss columns in the iith block of Gfrac{\bf G}_{\text{frac}} are sampled as part of the rr non-stragglers. Therefore,

Combining (3.1) and (3.2), we get the following theorem.

We would now like high-probability bounds on err⁡(A)\operatorname{err}(\mathbf{A}). By (3.1), this reduces to bounding how many of the YiY_{i} are non-zero. This can be done via standard techniques concerning with-replacement sampling.

Fix T⊆{1,2,…,k/s}T\subseteq\{1,2,\ldots,k/s\} such that ∣T∣=α+1|T|=\alpha+1. Then

Note that the probability that we have no more than α\alpha of the vi{\bf v}_{i} missing from the columns of A\mathbf{A} is the probability that err⁡(Afrac)≤αs\operatorname{err}(\mathbf{A}_{\text{frac}})\leq\alpha s. Therefore,

While this exact expression is complicated, this result easily shows that if s=Ω(log⁡(k))s=\Omega(\log(k)), then with probability at least 1−1k1-\frac{1}{k}, err⁡(A)\operatorname{err}(\mathbf{A}) is relatively small. Recall that the number of non-stragglers r=(1−δ)kr=(1-\delta)k for δ∈(0,1)\delta\in(0,1).

We wish to show that for s≥(1+11+α)log⁡(k)/(1−δ)s\geq(1+\frac{1}{1+\alpha})\log(k)/(1-\delta), the right-hand side of this equation is at most 1k\frac{1}{k}. Manipulating, this is equivalent to ss satisfying

Since s≥(1+11+α)log⁡(k)/(1−δ)s\geq(1+\frac{1}{1+\alpha})\log(k)/(1-\delta), we have

Letting β=(α+2)log⁡(k)/r\beta=(\alpha+2)\log(k)/r, (3.4) implies that (3.3) holds if

Since this occurs for all β≥0\beta\geq 0, the desired result is shown.∎

Theorem 8 implies that with probability at least 1−1k1-\frac{1}{k}, an FRC will have multiplicative error ϵ\epsilon where

Therefore, this implies Theorem 1. While FRCs have demonstrably small optimal decoding error when the stragglers are selected randomly, we will later show that it does not perform well when the stragglers are selected adversarially. In order to improve our tolerance to adversarial stragglers, we will develop a coding scheme based on random graphs.

Adversarial Stragglers

While FRCs have small average-case error, their worst-case error is large. Even worse, it is computationally efficient to find these worst-case straggler sets. In fact, they can be found in linear time in the number of compute nodes. Recall that the assignment matrix Gfrac{\bf G}_{\text{frac}} for FRC is defined by

As previously noted, each column of Afrac\mathbf{A}_{\text{frac}} has k/sk/s distinct possibilities,

Furthermore, the optimal decoding error increases by ss if and only if all of the columns in one of the k/sk/s blocks of Gfrac{\bf G}_{\text{frac}} are all stragglers. Therefore, if one were to select k−rk-r stragglers adversarially, they would pick all of the ss columns from one block, then all of the ss columns from another block, and continue until they had selected k−rk-r stragglers. This corresponds to picking rr non-stragglers corresponding to every column of r/sr/s of the blocks in Gfrac{\bf G}_{f}rac. Here, we assume that ss divides rr for simplicity.

If Gfrac{\bf G}_{f}rac is given as in (4.1), then we can simply select the first rr columns of Gfrac{\bf G}_{\text{frac}} to be non-stragglers. If Gfrac{\bf G}_{\text{frac}} is permuted, then we can simply select all columns corresponding to r/sr/s blocks. There are therefore (k−r)/s(k-r)/s blocks missing from A\mathbf{A}. Each contributes ss to the optimal decoding error. This implies that we have an overall error of k−rk-r. The argument above shows that this is the worst-case error possible.

Note that the adversary can find this set in O(k)O(k) operations if they have full-knowledge that an FRC scheme is being used with presentation as in (4.1). Even if they do not have this knowledge, an adversary can check for this coding scheme and find the worst-case straggler set in O(k2)O(k^{2}) operations if they only have access to the matrix Gfrac{\bf G}_{\text{frac}}. This implies the following theorem.

Suppose that we assign tasks using a Fractional Repetition Code. In the worst-case, the non-straggler matrix A\mathbf{A} will satisfy

Moreover, worst-case straggler sets can be found in quadratic time.

Suppose that r=(1−δ)kr=(1-\delta)k for some constant δ\delta. Then, the adversarial optimal decoding error is Θ(k)\Theta(k). This is in stark contrast to Theorem 8, which shows that if the stragglers are selected randomly and s=Ω(log⁡k)s=\Omega(\log k), then with high probability err⁡(A)=O(log⁡k)\operatorname{err}(\mathbf{A})=O(\log k). Also note that since err⁡1(A)≥err⁡(A)\operatorname{err}_{1}(\mathbf{A})\geq\operatorname{err}(\mathbf{A}), the adversarial one-step decoding error is Ω(k−r)\Omega(k-r).

2 Adversarial Straggler Selection is NP-hard

In this section, we show that in general, adversarial straggler selection is NP-hard. This demonstrates that adversaries with polynomial-time computations may not be able to find a set of stragglers that maximizes the decoding error. In such cases, the average-case error may be a more useful indicator of how well a gradient code performs.

To show that general adversarial selection is NP-hard, we first define two problems.

The kk-densest subgraph problem (DkkS) asks, given a graph (V,E)(V,E), what kk-vertex subgraph contains the most edges.

As shown in , this problem is NP-hard, even if we restrict to regular graphs. We now formally define the adversarial straggler problem.

Fix a constant ρ>0\rho>0. The rr-adversarial straggler problem (rr-ASP) asks, given a square matrix G∈n×n{\bf G}\in{}^{n\times n}, which column-submatrix A{\bf A} maximizes

Note that this is the form that one-step decoding takes. We will show that for any ρ∈(0,23)\rho\in(0,\frac{2}{3}), this problem is NP-hard, even when we restrict to G∈{0,1}k×k{\bf G}\in\{0,1\}^{k\times k} with at most ss non-zero entries in each column.

For any ρ∈(0,23)\rho\in(0,\frac{2}{3}), the adversarial straggler problem is NP-hard. This holds even if we restrict to matrices G∈k×k{\bf G}\in{}^{k\times k} with entries in {0,1}\{0,1\} and at most s≥2s\geq 2 non-zero entries per column.

In fact, the proof of our theorem also shows that if we instead consider all matrices G∈k×n{\bf G}\in{}^{k\times n} where k≥nk\geq n, then rr-ASP is NP-hard for any ρ>0\rho>0.

We will give a reduction from DkkS on dd-regular graphs to rr-ASP where G{\bf G} is boolean with at most dd non-zero entries per column.

Let (V,E)(V,E) be a dd-regular graph on nn vertices. Note that ∣E∣=nd|E|=nd. We want to solve DkkS for (V,E)(V,E). Let M{\bf M} denote the adjacency matrix of (V,E)(V,E). Note that DkkS is equivalent to

Let B{\bf B} denote the unsigned incidence matrix of (V,E)(V,E). That is, B{\bf B} is a ∣E∣×∣V∣|E|\times|V| boolean matrix where the row corresponding to edge ee has a 11 in column vv iff ee is incident to vv. We will let C{\bf C} denote the ∣E∣×∣E∣|E|\times|E| matrix given by adding ∣E∣−∣V∣=n(d−1)|E|-|V|=n(d-1) zero columns to B{\bf B}. Note that C{\bf C} is a square nd×ndnd\times nd boolean matrix with at most dd non-zero entries in each column since (V,E)(V,E) is dd-regular.

Let r=k+(n−1)dr=k+(n-1)d. Consider rr-ASP on C{\bf C}. This is equivalent to finding a vector x∈{0,1}∣E∣{\bf x}\in\{0,1\}^{|E|} with ∥x∥0=r\|{\bf x}\|_{0}=r that maximizes

Let x=(yz){\bf x}=\begin{pmatrix}{\bf y}\\ {\bf z}\end{pmatrix} where y∈{0,1}n,z∈{0,1}n(d−1){\bf y}\in\{0,1\}^{n},{\bf z}\in\{0,1\}^{n(d-1)}. Note that y{\bf y} corresponds to which of the columns of B{\bf B} we select, while z{\bf z} corresponds to columns of 0{\bf 0} we select. Recall that ∥y∥0+∥z∥0=r=t+n(d−1)\|{\bf y}\|_{0}+\|{\bf z}\|_{0}=r=t+n(d-1).

Note that BTB=M+Id{\bf B}^{T}{\bf B}={\bf M}+{\bf I}d. This implies

Therefore, rr-ASP in this setting is equivalent to maximizing, over y∈{0,1}n,z∈{0,1}n(d−1){\bf y}\in\{0,1\}^{n},{\bf z}\in\{0,1\}^{n(d-1)} such that ∥y∥0+∥z∥0=r=k+n(d−1)\|{\bf y}\|_{0}+\|{\bf z}\|_{0}=r=k+n(d-1), the quantity

Note that if we fix a binary y{\bf y} such that ∥y∥0=a\|{\bf y}\|_{0}=a, then

Therefore, maximizing this quantity corresponds to finding the aa-densest subgraph of (V,E)(V,E). We now must show that when we maximize this over y{\bf y} and z{\bf z}, then the solution will always have ∥y∥0=k\|{\bf y}\|_{0}=k. Since r=k+n(d−1)r=k+n(d-1), it suffices to show that y{\bf y} is as sparse as possible.

To show that this is the case, we will show that for ρ∈(0,23)\rho\in(0,\frac{2}{3}), increasing the sparsity of y{\bf y} by 1 will only decrease the objective function. Suppose that ∥y∥0=a\|{\bf y}\|_{0}=a and it has support SS. Say that y′{\bf y}^{\prime} satisfies ∥y′∥0=a+1\|{\bf y}^{\prime}\|_{0}=a+1 and it has support S′S^{\prime} where S⊆S′S\subseteq S^{\prime}. Let T,T′T,T^{\prime} denote the vertex subgraphs of (V,E)(V,E) corresponding to S,S′S,S^{\prime}, and let e(S),e(S′)e(S),e(S^{\prime}) denote the number of edges in these subgraphs. Note that yTMy=2e(S){\bf y}^{T}{\bf M}{\bf y}=2e(S). We then have

Note that since (V,E)(V,E) is dd-regular, e(S′)≤e(S)+de(S^{\prime})\leq e(S)+d. Therefore,

For ρ∈(0,23)\rho\in(0,\frac{2}{3}), this quantity is negative. Therefore, increasing the sparsity of y{\bf y} will decrease the objective function f(y)f({\bf y}). Therefore, the maximum of the rr-ASP problem applied to C{\bf C} will have y{\bf y} as sparse as possible. Since r=k+n(d−1)r=k+n(d-1) and ∥z∥0≤n(d−1)\|{\bf z}\|_{0}\leq n(d-1), this implies that the maximum occurs at ∥y∥0=k\|{\bf y}\|_{0}=k. Let SS denote the support of y{\bf y}. The objective function in (4.2) is then equal to

This is clearly maximized when SS is the set of vertices forming the densest kk-subgraph.∎

Bernoulli Gradient Codes

In this section we will consider the case that G{\bf G} has entries that are Bernoulli random variables. For a given s,ks,k, we will refer to the Bernoulli coding scheme as setting, for i∈{1,…,k},j∈{1,…,n}i\in\{1,\ldots,k\},j\in\{1,\ldots,n\}, Gi,j=Bernoulli(s/k){\bf G}_{i,j}=\text{Bernoulli}(s/k). Intuitively, by injecting randomness in to the construction of G{\bf G}, we improve our tolerance to adversarial stragglers. This comes as the cost of worse average-case error. While shows that if G{\bf G} is a Ramanujan graph then we have strong bounds on its adversarial decoding error, such graphs are notoriously tricky to compute. By using Bernoulli coding, we sacrifice a small amount of error in order to achieve a much simpler, efficiently computable coding scheme.

Suppose that the stragglers are selected uniformly at random. Then, the non-straggler submatrix A\mathbf{A} also has Bernoulli random entries. Note that the expected number of tasks assigned to each compute node is ss. This construction will allow us to derive high-probability bounds on the decoding error for s>log⁡(k)s>\log(k). We will later show that we can enforce the desired sparsity ss of each column and maintain the same error. Moreover, enforcing this desired sparsity will let us extend these error bounds to the setting where s<log⁡(k)s<\log(k). In order to get a handle on the decoding error, we first develop a method to bound the optimal and one-step decoding errors.

Suppose we have a function assignment matrix G{\bf G} such that the sparsity of each column is exactly or approximately bounded by ss. After performing the local computations on each compute node, we have access to a k×rk\times r submatrix A\mathbf{A} of the rr non-stragglers. We assume that r=(1−δ)kr=(1-\delta)k for some δ≥0\delta\geq 0.

We would like to derive high probability bounds on err⁡(A)\operatorname{err}(\mathbf{A}) in order to bound the optimal decoding error of A\mathbf{A}, as in (2.3). Unfortunately, it is not straightforward to directly bound this error for a random matrix A\mathbf{A} since it involves the pseudo-inverse of A\mathbf{A}. Instead, we will use an algorithmic approach to bound the optimal decoding error with high probability. The following lemma is adapted from .

Let u0=1k{\bf u}_{0}={\bf 1}_{k}, and define

Moreover, for all tt, ∥ut∥22≥err⁡(A)\|{\bf u}_{t}\|_{2}^{2}\geq\operatorname{err}(\mathbf{A}).

We refer to the ut{\bf u}_{t} as the algorithmic decoding error of A\mathbf{A}. To prove Lemma 12, we will use the following lemma, adapted from .

If u{\bf u} is in the column span of A\mathbf{A} and ν≥∥A∥22\nu\geq\|\mathbf{A}\|_{2}^{2} then

Fix some t≥1t\geq 1. We can decompose 1k{{\bf 1}_{k}} as v+w{\bf v}+{\bf w} where v{\bf v} is the orthogonal projection of 1k{\bf 1}_{k} on to the column span of A\mathbf{A} and w{\bf w} is in the nullspace of AT\mathbf{A}^{T}. Note that this implies that (I−AAT/ν)w=w({\bf I}-\mathbf{A}\mathbf{A}^{T}/\nu){\bf w}={\bf w}. Therefore,

Since v{\bf v} is in the span of A\mathbf{A}, (I−AATν)tv\left({\bf I}-\frac{\mathbf{A}\mathbf{A}^{T}}{\nu}\right)^{t}{\bf v} is also in the span of A\mathbf{A} and orthogonal to w{\bf w}. By Lemma 13,

By construction, ∥w∥22=min⁡x∥Ax−1k∥22\|{\bf w}\|_{2}^{2}=\min_{{\bf x}}\|\mathbf{A}{\bf x}-{\bf 1}_{k}\|_{2}^{2}, completing the proof.∎

Note that the ut{\bf u}_{t} are defined as the iterates of projected gradient descent. Consider the setting where ν=∥A∥22\nu=\|\mathbf{A}\|_{2}^{2}. The matrix P=AAT/∥A∥22{\bf P}=\mathbf{A}\mathbf{A}^{T}/\|\mathbf{A}\|_{2}^{2} is a projection operator (ie. P2=P{\bf P}^{2}={\bf P}), and it projects a vector on to the column-span of A\mathbf{A}. By letting ut=ut−1−Put−1{\bf u}_{t}={\bf u}_{t-1}-{\bf P}{\bf u}_{t-1}, Lemma 12 one can show that this eventually converges to u0−AA+u0{\bf u}_{0}-\mathbf{A}\mathbf{A}^{+}{\bf u}_{0}. In other words, we eventually converge to the component of u0{\bf u}_{0} that is orthogonal to the range of A\mathbf{A}. Taking u0=1k{\bf u}_{0}={\bf 1}_{k}, this eventually converges to err⁡(A)\operatorname{err}(\mathbf{A}).

We can better understand ut{\bf u}_{t} by taking a combinatorial view. Note that A\mathbf{A} encodes a bipartite graph with kk left vertices and rr right vertices, where Aij\mathbf{A}_{ij} is 1 iff there is an edge between vertex ii on the left and vertex jj on the right. Column jj of A\mathbf{A} corresponds to the incidence of the jjth right vertex. In particular, the degree of vertex jj on the right equal the number of tasks computed by compute node jj. We can compute ∥ut∥22\|{\bf u}_{t}\|_{2}^{2} in terms of walks on this bipartite graph.

1kT(AAT)t1k{\bf 1}_{k}^{T}(\mathbf{A}\mathbf{A}^{T})^{t}{\bf 1}_{k} equals the number of paths of length 2t2t from a left vertex to a right vertex.

Note that (AAT)ij(\mathbf{A}\mathbf{A}^{T})_{ij} is the number of paths of length 2 from the vertex ii to vertex jj, where i,ji,j are both left vertices. More generally, (AAT)ijt(\mathbf{A}\mathbf{A}^{T})^{t}_{ij} counts the weighted number of paths of length 2t2t from vertex ii to vertex jj. Therefore, 1k(AAT)t1k{\bf 1}_{k}(\mathbf{A}\mathbf{A}^{T})^{t}{\bf 1}_{k} is the weighted number of paths of length 2t2t from a left vertex to a left vertex.∎

Let ata_{t} denote the weighted number of walks in the associated bipartite graph of A\mathbf{A} of length 2t2t starting and ending at a left vertex. Then

While ut{\bf u}_{t} may be difficult to bound for sufficiently large tt, we can handle u1{\bf u}_{1} more directly. Moreover, as theory and simulations will show, even u1{\bf u}_{1} will give us good bounds on err⁡(A)\operatorname{err}(\mathbf{A}).

2 One-step Error of Bernoulli Gradient Codes

This approach is analogous to bounding u1{\bf u}_{1}, as the following lemma shows.

Recall that for a given ν\nu, u1{\bf u}_{1} is given by

Suppose we have a random Erdős-Rényi graph G(n,p)G(n,p) with adjacency matrix B{\bf B} where np≥log⁡(n)np\geq\log(n). For any α≥1\alpha\geq 1 there exists a universal constant C1=C1(α)C_{1}=C_{1}(\alpha) such that with probability at least 1−n−α1-n^{-\alpha},

More generally, assume that B{\bf B} is a n×nn\times n adjacency matrix where Bi,j{\bf B}_{i,j} is Bernoulli with probability pi,jp_{i,j}. This is sometimes referred to as the inhomogeneous Erdős-Rényi model G(n,(pi,j))G(n,(p_{i,j})). Let p=max⁡i,jpi,jp=\max_{i,j}p_{i,j}. As discussed in , Lemma 18 extends to this setting using this definition of pp (see section 1.1). While this result applies directly to n×nn\times n adjacency matrices, we can easily extend this to A\mathbf{A}. This will first require a basic lemma about the spectral norm of a structured block matrix.

Let D{\bf D} be a n1×n2n_{1}\times n_{2} matrix. Suppose that C{\bf C} is a n×nn\times n block matrix of the form

Standard properties of singular values imply that ∥DTD∥2=∥DDT∥2=∥D∥22\|{\bf D^{T}D}\|_{2}=\|{\bf DD^{T}}\|_{2}=\|{\bf D}\|_{2}^{2}. Moreover,

Since the eigenvalues of a block diagonal matrix are given by the eigenvalues of all the blocks,

Let A\mathbf{A} be a k×rk\times r matrix where k≥rk\geq r and Ai,j\mathbf{A}_{i,j} is Bernoulli with probability s/ks/k. Then for all α≥1\alpha\geq 1, there exists a universal constant C2=C2(α)C_{2}=C_{2}(\alpha) such that with probability at least 1−(k+r)−α1-(k+r)^{-\alpha},

A\mathbf{A} encodes the structure of a bipartite graph with k+rk+r vertices. After relabeling, we can denote these vertices as v1,…,vk,vk+1,…,vk+rv_{1},\ldots,v_{k},v_{k+1},\ldots,v_{k+r} where the bipartite blocks are given by {v1,…,vk},{vk+1,…,vk+r}\{v_{1},\ldots,v_{k}\},\{v_{k+1},\ldots,v_{k+r}\}. The adjacency matrix B{\bf B} is therefore of the form

Note that B{\bf B} comes from an inhomogeneous Erdős-Rényi graph G(k+r,(pi,j))G(k+r,(p_{i,j})) where pi,jp_{i,j} is zero if ii and jj are both in {1,…,k}\{1,\ldots,k\} or {k+1,…,k+r}\{k+1,\ldots,k+r\}, and s/ks/k otherwise. Therefore, p=max⁡i,jpi,j=s/kp=\max_{i,j}p_{i,j}=s/k. By Lemma 18 (and the discussion following it), for all α>0\alpha>0 there exists some universal constant C1=C1(α)C_{1}=C_{1}(\alpha) such that with probability at least 1−(k+r)−α1-(k+r)^{-\alpha},

This last equality holds by Lemma 19. Taking C2=2C1C_{2}=\sqrt{2}C_{1} we conclude the proof.∎

Combining this with Lemma 16, we get the following theorem.

Suppose that s≥log⁡(n)s\geq\log(n). Then for any α≥1\alpha\geq 1, there is a universal constant C2=C2(α)C_{2}=C_{2}(\alpha) such that for ρ=krs\rho=\frac{k}{rs}, with probability at least 1−(k+r)−α1-(k+r)^{-\alpha},

Empirically, the same bound holds for other methods of generating G\mathbf{G}. If we choose the non-zero support of each column by selecting ss indices with or without replacement from {1,…,k}\{1,\ldots,k\}, then we conjecture that the same theorem holds. Unfortunately, standard concentration inequalities are not enough to prove this result in such settings.

3 Regularized Bernoulli Gradient Codes

Both of these issues have the same cause: vertices whose degree is too large. Fortunately, this issue of enforcing concentration of sparse graphs has been studied and partially resolved in . They show that by appropriate regularization of graphs, we can improve their concentration in the sparse setting.

Let B{\bf B} be a random graph from the inhomogeneous Erdős-Rényi model G(n,(pi,j))G(n,(p_{i,j})) and let p=max⁡i,jpi,jp=\max_{i,j}p_{i,j}. For any α≥1\alpha\geq 1, the following holds with probability at least 1−n−α1-n^{-\alpha}. Take all vertices of B{\bf B} with degree larger than 2np2np and reduce the weights of the edges incident to those vertices in any way such that they have degree at most npnp. Let B′\mathbf{B}^{\prime} denote the resulting graph. Then

Here C3C_{3} is a universal constant. Note that this regularization can be performed analogously on A\mathbf{A}. To form A′\mathbf{A}^{\prime}, we simply look at all columns with degree more than 2s2s and change entries in those columns from 11 to until these columns have degree ss. This satisfies the criterion in the above theorem. We can then use an almost identical version of the proof of Theorem 20 to prove the following theorem.

There is a universal constant C4=C4(α)C_{4}=C_{4}(\alpha) such that for any α≥1\alpha\geq 1, s≥1s\geq 1, with probability at least 1−(k+r)−α1-(k+r)^{-\alpha},

We can combine this with Lemma 16 to derive the following theorem concerning err⁡(A′)\operatorname{err}(\mathbf{A}^{\prime}). As before, this bound applies for both the one-step decoding and the optimal decoding.

For any α≥1,s≥1\alpha\geq 1,s\geq 1, and letting ρ=krs\rho=\frac{k}{rs}, with probability at least 1−(k+r)−α1-(k+r)^{-\alpha},

By regularizing in the above manner, we ensure that each compute node computes at most 2s2s tasks and that our error bound works for all ss. Note that in practice, we cannot form A′\mathbf{A}^{\prime} from A\mathbf{A} as we don’t know A\mathbf{A} a priori. Therefore we cannot tell the compute nodes to compute the functions corresponding to A′\mathbf{A}^{\prime}. Instead, we can regularize G\mathbf{G} in the same manner to obtain G′\mathbf{G}^{\prime} in the following way such that we can apply Theorem 24 above. We refer to this code as the regularized Bernoulli Gradient Code, (rBGC).

The construction is simple. We initialize G{\bf G} with each entry Bernoulli(s/k)(s/k). For each column jj with more than 2s2s non-zero entries, we randomly set entries to 0 until it has ss non-zero entries. A detailed algorithm is provided below.

Note that the error incurred by an rBGC corresopnds to a multiplicative error ϵ\epsilon where

Simulations

In this section we compare the empirical decoding error of Fractional Repetition Codes (FRCs) and Bernoulli Gradient Codes (BGC). Recall that we gave two decoding methods, one that corresponding to the optimal decoding error

and one corresponding to the one-step decoding error

We compare FRCs and BGCs to a coding scheme proposed in . There, Raviv et al. consider the scheme where G{\bf G} is the adjacency matrix of an ss-regular expander graph with kk vertices. They show that for all k×rk\times r submatrices A\mathbf{A},

Here, λ(G)=max⁡{∣λ2∣,∣λk∣}\lambda({\bf G})=\max\{|\lambda_{2}|,|\lambda_{k}|\}, where the eigenvalues of G{\bf G} are given by

We would like to construct G{\bf G} to have λ(G)\lambda({\bf G}) as small as possible. This is achieved by Ramanujan graphs. In practice, constructing expander graphs with small values of λ\lambda is difficult. By taking a random ss-regular graph, however, we can obtain can expander graph with high probability . As k→∞k\to\infty, λ\lambda tends to the optimal value. In order to generate empirical data, we consider the setting where G{\bf G} is the adjacency matrix of a random ss-regular graph.

Below, we plot the one-step and optimal decoding error err⁡(A)\operatorname{err}(\mathbf{A}) and err⁡1(A)\operatorname{err}_{1}(\mathbf{A}) for these three schemes when k=100k=100 and the fraction of stragglers δ\delta varies. In order to normalize the error, we plot err⁡(A)/k\operatorname{err}(\mathbf{A})/k and err⁡1(A)/k\operatorname{err}_{1}(\mathbf{A})/k. We take ρ=krs\rho=\frac{k}{rs} in the one-step decoding.

We see that under one-step decoding, FRCs and ss-regular expanders perform extremely comparably. In this setting, BGCs seem to sacrifice some accuracy for simplicity. However, FRCs are also computationally simple and perform as well as taking ss-regular expanders in the average case under one-step decoding. For optimal decoding, FRCs perform significantly better than ss-regular expanders or BGCs, as the following plots show.

These plots show that if we instead consider optimal decoding, then FRCs greatly outperform the other two methods. In particular, FRCs can achieve zero optimal decoding error even with a non-trivial fraction of stragglers. If s=10s=10, then we can achieve close to zero error even with half of the compute nodes being stragglers.

Finally, we compare the one-step and optimal decoding error for the BGCs, FRCs, and ss-regular graphs. The results are plotted below.

2 Algorithmic Decoding Error of Bernoulli Gradient Codes

In this section we give empirical one-step error rates of BGCs for varying sizes of rr and sparsity ss of the matrix A\mathbf{A} . Recall that we defined the algorithmic decoding error of A\mathbf{A} by a sequence of vectors ut{\bf u}_{t}. Here, ∥u1∥22\|{\bf u}_{1}\|_{2}^{2} corresponds to the one-step decoding error, while ∥ut∥22\|{\bf u}_{t}\|_{2}^{2} converges to the optimal decoding error.

Let G{\bf G} be constructed via a BGC. We fix k=100k=100 and take varying values of δ\delta and ss, letting r=(1−δ)kr=(1-\delta)k. We then calculate the average value of ∥ut∥22/k\|{\bf u}_{t}\|_{2}^{2}/k based on a Monte Carlo simulation for increasing values of tt. We set ρ=∥A∥22\rho=\|\mathbf{A}\|_{2}^{2}. The results are below.

Conclusion and Open Problems

In this work, we formally described the approximate gradient coding problem and gave two different decoding methods for such codes. We analyzed two efficiently computable gradient codes, FRCs and BGCs, and gave explicit bounds for their decoding error. While FRCs exhibit extremely low average-case error, they are susceptible to adversaries, even polynomial-time adversaries. This is in contrast to our result that adversarial straggler selection is NP-hard. BGCs are constructed via sparse random graphs and are potentially less susceptible to polynomial-time adversaries.

While the problem of approximate gradient coding can be stated in relatively simple terms, our work shows that the problem is not simple. Bounding the error of gradient codes, even relatively straightforward codes such as BGCs, can be an arduous task. This is especially true in the context of optimal decoding error. Still, approximate gradient codes have exciting connections to coding theory, concentration of random graphs, expander graphs, and many other interesting combinatorial and algebraic objects. This work is intended to be a starting point towards understanding the approximate gradient coding problem. There are many remaining open problems, some directly continuing this work, others more tangentially related.

Tighter bounds on the optimal decoding error: For both BGCs and ss-regular expander graphs, our empirical results show that there is a significant gap between the one-step and the optimal decoding error. So far, the only known results on the error of these codes concern their one-step decoding error. Better bounds on their optimal decoding error and, more generally, better methods for bounding the optimal decoding error would have great implications for the analysis and design of gradient codes. Unfortunately, such bounds are not straightforward. They require greater care and may require analysis of second- and higher-order moments or a better understanding of the pseudo-inverse of random matrices.

Algorithmic error and weighted walk counting: One potential method towards better bounds on the optimal decoding error comes from Lemma 12 above. As we show, one can bound the optimal decoding error by a weighted alternating sum involving the number of walks on a bipartite graph. Tight bounds on the number of walks in a random bipartite graph or deterministic constructions for bipartite graphs with more explicit fomrulas for the number of walks could lead to much better bounds on the error.

Approximate gradient coding capacity: Our work gives deterministic and randomized codes that achieve varying worst-case and average-case errors. In general, we know very little about how these error rates behave. One can ask: what is the information theoretic limit of an approximate gradient code, e.g., what is the optimal tradeoff between the recovery error, the probability of recovery, and the sparsity of the code?

Acknowledgements

The first author was supported in part by the National Science Foundation grant DMS-1502553.

References