Computer Science
Computer Science-2021.gz:143178
Computer Science
21067c4181f87422665877dafeb33952b4c036c6
Masked Training of Neural Networks with Partial Gradients

State-of-the-art training algorithms for deep learning models are based on stochastic gradient descent (SGD). Recently, many variations have been explored: perturbing parameters for better accuracy (such as in Extragradient), limiting SGD updates to a subset of parameters for increased efficiency (such as meProp) or a combination of both (such as Dropout). However, the convergence of these methods is often not studied in theory. We propose a unified theoretical framework to study such SGD variants -- encompassing the aforementioned algorithms and additionally a broad variety of methods used for communication efficient training or model compression. Our insights can be used as a guide to improve the efficiency of such methods and facilitate generalization to new applications. As an example, we tackle the task of jointly training networks, a version of which (limited to sub-networks) is used to create Slimmable Networks. By training a low-rank Transformer jointly with a standard one we obtain superior performance than when it is trained separately.


Introduction
Deep learning models are being used successfully in an increasing variety of scenarios. Consequently, new variants of SGD-the traditional training method for neural networks-have been designed, encouraged by various goals such as improving training efficiency (Sun et al., 2017) accuracy (Korpelevich, 1976), or imposing additional properties on the trained model (e.g. being low rank Wang et al., 2021). In distributed training, compressed versions of gradients are used in order to reduce communication costs (Alistarh et al., 2017). Dropout (Srivastava et al., 2014), a method that computes the gradient after deactivating a random subset of neurons in the network, is widely used and is known to yield models with better performance. The Slimmable Nets approach (Yu and Huang, 2019b; allows adjusting the width of a neural network dynamically during training and inference. While extensive literature exists on theoretical convergence bounds of SGD (Bottou et al., 2018;Stich et al., 2021;, variants of SGD, such as those we discussed earlier, often lack a theoretical analysis even though they perform well in practice. However, theoretical understanding of a method can significantly ease and guide its adaptation to different tasks as well as its combination with other methods.
In this paper, we propose a unified theoretical framework to study variants of SGD that rely on a combination of parameter perturbation and gradient masking.
In particular, we theoretically analyze convergence of these algorithms under a generic template called partial SGD and identify a set of criteria that when satisfied yield a theoretical convergence guarantee.
Our result applies to a wide range of existing methods such as the Extragradient method (Korpelevich, 1976), Dropout (Srivastava et al., 2014), extensions of Slimmable Nets , partial backpropagation methods such as meProp (Sun et al., 2017) and parameter freezing methods such as layerwise training (Bengio et al., 2007), wide-and-deep networks (Cheng et al., 2016), weight pruning (Lin et al., 2019), as well as distributed independent subnet training (Yuan et al., 2019), among others. We evaluate some of these methods based on our criteria and obtain rigorous convergence rates as well as insights on how these algorithms might be further improved.
More importantly, our results can also be used as a guideline to create new training methods (e.g. choices can guarantee satisfaction of said criteria. As an example, we propose a training scheme to address the fundamental task of simultaneous training of two networks-a core network together with a larger architecture containing it. This includes the case of joint training of arbitrary combinations formed by two different neural networks, in which case the larger network is the union of the two. Figure 1 illustrates several example cases. Interestingly our designed method is an unrolled version of slimmable training. However, whereas slimmable training was limited to training sub-networks with reduced width we apply our method to more generalized scenarios. Joint training can have various motivations including but not limited to allowing weight sharing across different networks, improving training speed, or improving final accuracy. To demonstrate the practical effectiveness of our method, we train a low-rank core network for a Transformer architecture (Vaswani et al., 2017) together with the larger original architecture. As a result of joint training, the trained low-rank model has superior stand-alone performance than when it is trained alone. The gain is particularly pronounced for significant model size reductions (32x rank reduction) where computational cost savings are highest (17.95 vs. increase to 24.03 BLEU score). Furthermore, the larger architecture can be converted to a full-rank standard Transformer matching the performance of the highlyoptimized original Transformer model.

Contributions
Our main contributions can be summarized as follows: • We provide a rigorous theoretical analysis of partial SGD-a generic template encompassing training schemes that involve a combination of parameter perturbation and gradient masking. • We present and discuss a host of existing methods that fit our theoretical framework. Our detailed discussion illustrates how our insights can guide future design decisions or lead to improvements for existing methods (showcased by designing a training method that jointly trains a full model and a reduced capacity model of much smaller size). • We generalize slimmable training to go beyond just reducing width but allowing arbitrary subnetworks, and show the effectiveness of joint training in various practical scenarios, including training Transformer models together with low-rank variants on NLP tasks.

Related Work
The theoretical framework developed in this work covers a broad set of training methods used in a wide variety of settings. In distributed training, a worker can be responsible for optimizing a subnetwork while the local updates are expected to contribute to optimization of the full network (Yuan et al., 2019). Even in the data-parallel setting where each worker optimizes the full model but on its own local dataset, a compressed (masked) version of gradient is often used for communication efficiency (Aji and Heafield, 2017;Dryden et al., 2016). A similar technique is applied in (Sun et al., 2017) to improve speed of single-node training. Moreover, certain parameter perturbations seem to be effective in improving a model's ability to generalize, such as in extragradient methods (Korpelevich, 1976). A combination of masking and parameter perturbation can be seen in Dropout (Srivastava et al., 2014), a widely used technique which also fits our framework.
In this work, we show convergence bounds for algorithms that conform to our partial SGD template in smooth non-convex settings which is widely used in the SGD convergence literature (Arjevani et al., 2020;Bottou et al., 2018). The convergence of such algorithms is also investigated under NTK assumptions (Jacot et al., 2021) for shallow neural networks (Liao and Kyrillidis, 2021) but only for random masking applied for both gradient computation and masking. In contrast, we allow arbitrary parameter perturbations for gradient computation, as well as arbitrary gradient masking which might not be random nor necessarily corresponding to said perturbation. Other works investigate convergence of instances of our generic template, such as Dropout (Jacot et al., 2021;Senen-Cerda and Sanders, 2020a,b), or gradient compression (Alistarh et al., 2018;Stich and Karimireddy, 2020;Stich et al., 2018).
Our framework can also be used to guide the design of new methods. We illustrate this by designing a method for joint training. The resulting method resembles an unrolled version of Slimmable training (Yu and Huang, 2019b;. Slimmable networks are trained such that the width can be chosen dynamically based on available resources during inference. Dynamic sparsity neural networks (Wu et al., 2021) extend this paradigm to subnetworks with different levels of sparsity, allowing removal of individual weights instead of neurons. In separate work simultaneous to ours, Peste et al. (2021) apply a similar method, also used in (Jin et al., 2016), to train sparse models. They theoretically prove convergence in the case when sparse minimizers exist, such as in overparameterized networks. While we only perturb the parameters for computing the gradient vector and apply the updates on the original values, their method applies the perturbation permanently; zeroing the masked parameters whereas we keep them unchanged. Moreover, our setting is more general since we allow perturbations other than masking.
An example of new applications considered in our work is training a network jointly with its low-rank variant. Previous work in this area includes adding regularization to the objective loss to encourage low-rank learning (Wen et al., 2017). Another approach is used in (Wang et al., 2021) to train the low-rank variant by initially using the full network to jump-start training. In contrast, our method continuously trains both the full network and the low-rank variant without any changes to the loss.
It is also possible to obtain a good small network from a larger network using methods such as knowledge distillation (Hinton et al., 2015;Lin et al., 2020) or model pruning (Han et al., 2015;Lin et al., 2019;Zhu and Gupta, 2017). Distillation improves the training of a student network (here the small network) by using the outputs of a teacher network (here the larger network). However, this requires training the small and large networks separately, which is more costly than our method. On the other hand, model pruning meth-Algorithm 1 partial SGD 1: for t = 0, . . . , T do

2:
Choose a mask p t , and

3:
a perturbation δx t for the current step t 4:x t ← x t + δx t perturb parameters

5:
Take a stochastic gradient g t of ∇f (x t ) 6: x t+1 ← x t − γ t p t g t 7: end for ods allow extracting a small network with good performance from a large network. While these methods can be fast and sometimes remove the need for training the small network, it is usually not possible to impose a structure on the small network. In contrast, our method allows a specifying a precise pre-defined architecture as the small network. A different line of work, looks for lottery ticket sub-networks in a normally trained network that can be used separately or trained from scratch to obtain the same performance (Frankle and Carbin, 2018;Frankle et al., 2020). However, these sub-networks often lack a hardware-compatible structure that can hinder obtaining a performance boost. In contrast, joint training can intuitively be seen as shaping the lottery ticket.
Previous work successfully use joint training for neural architecture search where multiple networks are trained at once and the right architecture is determined by comparing their performance (Cai et al., 2019;Yu et al., 2020. As an example of fusing two network together, Wide-and-deep networks (Cheng et al., 2016) consist of a wide and another deep but narrow network with the output being the sum of the two networks. The wide part is a linear model that e.g. uses carefully selected features as well as their cross-product as input, at a very low inference latency cost. On the other hand, the deep part works on the raw features which allows the wide part to memorize more complex patterns of interactions between features while the deep part can help generalization (Cheng et al., 2016). Guo et al. (2017) extend these networks by removing the need for manual feature engineering.
Finally, in another line of research, the implicit bias caused by applying these methods is investigated (Hooker et al., 2020). We leave further research of this aspect of our method to future work.

Convergence Analysis
We consider the optimization of the full network parameters x. In formal terms, we consider finding the minima of the empirical loss f : R d → R : (1)

Partial SGD
We start by introducing partial SGD (Algorithm 1), a generic template designed to fit various training algorithms that apply a combination of gradient masking, and parameter perturbation for gradient computation.
In particular, we make the following changes compared to vanilla SGD: 1. We allow a time-dependent binary mask p t in each step to be chosen arbitrarily from a set of binary masks P ⊆ {0, 1} d . Selecting the all-one vector in every step recovers vanilla SGD. Another example is a method that picks a random mask each time. 2. We allow arbitrary perturbation δx t of the current parameters for calculating the loss and its gradient. Naturally, setting δx t = 0 recovers vanilla SGD while setting δx t = −(1 − p t ) x t would mean applying the gradient of the sub-network induced by the mask p t .
Partial SGD can represent various training schemes.
As an example consider the case of applying dropout with probability µ over the network. In this case p t is a random mask where each element (or each group of elements if the dropout is applied to neurons instead of individual weights) is one with probability µ. The perturbation δx t should be set equal to −(1 − p t ) x t (similar to alternating training scheme) to compensate for the masking of weights during forward propagation while p t limits the parameter update during backward propagation.

Assumptions & Definitions
We focus on the non-convex setting and assume the function f to be L-smooth.
Assumption 1 (L-smoothness). The function f : R d → R is differentiable and there exists a constant L > 0 such that: We assume that for every point in x ∈ R d we can query a stochastic gradient g(x) of f (x), that is for a zero-mean stochastic noise vector ξ : We assume that the noise is bounded. Since we are interested in masking the gradient for partial training, we use a modified assumption over the set of allowed masks P ⊆ {0, 1} d .
There exist parameters M ≥ 0, σ 2 ≥ 0 such that for any mask p ∈ P: Remark 1. When P = {1}, the assumption becomes the same as the standard assumption used for analyzing SGD convergence in previous work (e.g. Bottou et al., 2018). When the size of P is larger, the assumption becomes stronger. For example, if where M core is a sub-network, the norm of noise over the sub-network is separately bounded by the norm of the gradient of the sub-network parameters. In its strongest form, i.e. when P contains all the possible masks, the assumption implies that the noise over each parameter is separately bounded by the norm of that parameter's gradient which is still a reasonable assumption.

Main Result
We state the following main convergence theorem for non-convex objectives: Theorem 1. Let Assumptions 1-2, hold, and let the stepsize γ t = α t γ base in Algorithm 1 with γ base = min where p t denotes the binary mask andx t the perturbed parameters. Then, . Then We highlight that the bounds proven by this theorem depend on the values of the stepsize scaling α t and gradient alignment q t . In particular, if the values of α t are sufficiently large, the first part of the theorem shows convergence of the partially masked core networks. Moreover, sufficiently small q ensures convergence of the full network. Note that these two values are inversely proportional (q t = ∇f (xt) αt pt ∇f (xt) ) so that usually a large α t results in a small q t and vice-versa.
In reality, the values q t and α t also depend on the selection of masks which vary depending on training scheme and application. The above theorem holds under the most general set of assumptions for widest applicability. More informative upper bounds on the value q can be obtained in relevant applications. Note that Theorem 1 naturally recovers the standard SGD convergence theorem (Bottou et al., 2018) as a special case, by setting p t = 1 d . In this case α t = q t = 1 and we recover the best known SGD bounds.
We also remark that while the theoretical result assumes that the learning rate is multiplied by α t , in practice it is not necessary to compute an exact value for α t in each step. Instead, a lower bound α can be tuned as a hyper-parameter (which might also be different for different masks). Even simpler, in our experiments, we observed that no tuning is necessary, and using the same learning rate as for the standard training of the full network performs very well.
We leave the proof of the theorem (leveraging techniques from the proof of BiasedSGD (Ajalloeian and Stich, 2020)) to Appendix A. In the following we propose a set of criteria that can be used to ensure the value q for a training algorithm is small. As such they can be used both as a guide for developing new methods as well as proving convergence of existing methods.
Criterion 1 (Gradient norm preservation against masking). To ensure a small q value, the binary masks applied on the gradient vector should not drastically reduce its norm, i.e. the ratio ∇f (xt) pt ∇f (xt) ≤ c norm should be bounded by a small constant c norm . Note that this criterion is automatically satisfied with c norm = 1 when no masking is done.
Criterion 2 (Gradient norm preservation against perturbation). When applying perturbations before computing the gradient, the training algorithm should ensure that the perturbation does not lead to a drastic decrease in gradient norm, i.e., there should exist a constant c sim such that pt ∇f (xt) pt ∇f (xt) ≤ c sim . This holds with c sim = 1 when no perturbation is done.
Criterion 3 (Gradient alignment). The gradient vectors computed with and without perturbation should be aligned. More formally, there should exist an upper bound c align such that pt ∇f (xt) pt ∇f (xt) pt ∇f (xt),pt ∇f (xt) ≤ c align . This criterion also automatically holds with c align = 1 when no perturbation is applied, i.e. when x t =x t .
We will now example various use-cases of these criteria.
meProp meProp is a training scheme which only uses the top-k elements of the gradient vector for optimization (Sun et al., 2017). Since no perturbation is applied, Criteria 2 and 3 are satisfied. Choosing elements with the highest value in the gradient vector ensures Criterion 1 as the upper bound c norm ≤ d k holds. Note that if instead of proving the existing method we were looking for a method which only uses a portion of the gradient vector, this criterion would guide us to choose the elements with the highest value, guiding us toward the right method. For completeness, we point out that, in practice, meProp applies the topk approximation layer-wise during the backward pass. This speeds up the back-propagation process but leads to using an incorrect gradient in the lower layers, thus only being an approximation of our variant using the actual gradient.
Extragradient Method In this method, the gradient is calculated after making a small step (with step size η s ) in the direction of the gradient, i.e. δx t = η s ∇f (x t ). Setting p t = 1, recovers the Extragradient method from Algorithm 1 which is a more generalized version that allows gradient masking as well as parameter perturbations that are not in the direction of the gradient. Since no masking is done, criterion 1 is automatically satisfied. In order to show the other criteria are also satisfied, we introduce the following assumption and lemma.
Assumption 3 (bounded perturbation). For a Lsmooth function, i.e. satisfying Assumption 1, the training algorithm makes perturbations such that Note that by choosing a small perturbation coefficient, in particular η s ≤ 1 2L , the assumption holds for the extragradient method since δx t = η s ∇f (x t ) . The following lemma guarantees the other criteria.
Lemma 2. If Assumptions 1 and 3 hold, c align ≤ √ 10 and c sim ≤ √ 10 2 . We postpone the proof of the above lemma to the Appendix B. Note that the above lemma guarantees q ≤ 10 for the extragradient method yielding convergence bounds with the same complexity as previously known results (Xu et al., 2019). Assumption 3 can also be useful in other settings, especially because it can be verified during training. Therefore, it is possible to design training algorithms which determine the perturbation and the mask based on whether this assumption holds. We now provide one possible example in the settings of model parallel training.
Model-Parallel Training One of the recently introduced methods for model-parallel distributed training of a network across several workers is independent subnet training (Yuan et al., 2019). In this method, neurons in each layer of the network are randomly partitioned into k disjoint sets (equal to the number of workers), partitioning the whole network into k disjoint parts. Each worker trains one part of the network by independently performing SGD steps on its personal core part for a limited number of steps. Next, the new weights are communicated, and the network is again randomly re-partitioned, each worker receiving a new part of the network. From the perspective of a single worker, the training scheme matches the use of a fixed dropout mask for several steps, which exactly fits our Algorithm 1. Moreover, because of the disjoint partitioning, the result is identical if the worker steps were interleaved instead of being run in parallel. More specifically, if p i,k corresponds with the mask for worker i at step k, the sequence p t can be set to p 1,1 , p 2,1 , . . . , p k,1 , p 1,2 , . . .. Hence, Theorem 1 can be used to analyze the convergence of this scheme. It might be possible to evaluate the satisfaction of the above criteria using theoretical arguments or practical measurements. However, here we want to point toward another application of these criteria. In particular, we note that currently the algorithm requires tuning the number of local steps on each worker. Another approach is to verify Assumption 3 and change the partitioning whenever it is violated. Note that this is possible with minimal communication (norm of the weights) between workers. Even the communication might not be necessary since the norm of the weights does not significantly change in a single partitioning. We leave the practical investigation into this as a future work.
Dropout In the case of dropout, each element of the mask p t (or each group of elements corresponding to the weights connected to a specific neuron) is i.i.d. chosen from a Bernoulli distribution with mean µ. In this case, the expected value of ∇f (xt) 2 pt ∇f (xt) 2 is 1 µ which means Criterion 1 is on average satisfied. We use a practical approach to ensure the other criteria holds. Note that it might also be possible to show the other criteria are also satisfied in theory by making the right assumptions which we leave as a future work. We measure the values upper bounded in each criterion throughout training of a ResNet-18 on CI-FAR10 with and without Dropout. The results are plotted in Figure 2. It can be seen that when applying dropout, both Criterion 2 and 3 hold in practice. We now provide possible explanations as to why this happens.
Assuming a positive correlation between gradient's norm and convergence, it is intuitive that replacing an optimized parameter with a random value (such as zero) would increase gradient norm. As a simple example, consider a 1-dimensional quadratic function (x−a) 2 where a is a large positive number. After some optimization steps, x will be close to a and replacing it with zero would increase the gradient's norm. While this is not a formal proof, it gives an intuition as to why Criterion 2 would be satisfied.
However, it is not directly clear why running SGD with dropout results in the last criterion to be satisfied. In wherext is obtained by applying a random Dropout mask (masking neurons instead of weights), measured while training a ResNet-18 on CIFAR10 with and without dropout. Observably, applying dropout improves gradient alignment. particular, Figure 3 shows that this criterion is not satisfied when running SGD without dropout. We hypothesize that this phenomena is related to the findings of previous work (Dandi et al., 2021;Nichol et al., 2018) which shows that SGD imposes an implicit regularization to increase the dot product of consecutive mini-batches. In particular, since the proof in (Nichol et al., 2018) allows for a different loss functions per mini-batch, the result is applicable to our case as well and means that SGD with dropout promotes alignment between gradients of random sub-networks. Intuitively, if the gradients of any pair of sub-networks are aligned with each other, it can be expected that they are also aligned with the full network, for example due to existence of sub-networks obtained as a result of pruning that are able to produce similar output as the full network.

Alternating Training Scheme
We now showcase how it is possible to use the criteria we introduced as guidelines for designing new methods. In particular, we design an algorithm for training Take stochastic gradient g t of ∇f (p t x t ) 8: x t+1 ← x t − γ t p t g t 9: end for a given network M super , which we refer to as supernetwork, jointly with one of its sub-networks M core , which we refer to as the core network. First, note that any algorithm that trains the full network on some steps and the sub-network on other steps fits the partial SGD template since the parameters of M core can be simply extracted by applying a binary mask 1 Mcore over x, i.e. 1 Mcore x. In order to choose between different switching patterns we compare them in terms of our criteria. In particular, relying on the implicit regularization of SGD that promotes alignment between consecutive mini-batches that we discussed in analyzing dropout, the maximum alignment should be obtained when consecutively switching between training M core and M super . This yields Algorithm 2 which we refer to as Alternating Training Scheme (ATS). Note that here we focus on the case where M core is predetermined. However, if this was not the case, Criterion 1 would point toward selecting the sub-network containing largest elements of the gradient vector.
ATS is clearly a special case of partial SGD using the same mask sequence 1 Msuper , 1 Mcore , 1 Msuper , . . . as p t and δx t = −x t (thus zeroing weights not part of the core network). In order to evaluate ATS in terms of our criteria, we follow a similar approach as for Dropout and make the following observations based on training a Transformer jointly with its subnetwork with half the full width: Large gradient overlap Let r be the ratio of parameters in the subnetwork to the number of parameters in the full network. For example, in our experiment r = 0.5. Given the random initialization the expected value for ∇f (xt) 2 pt ∇f (xt 2 is 1 r when t = 0. Figure 4a shows that when training using ATS, this quantity remains low and does not increase during training. In fact, it can be seen that when using ATS, the overlap value is significantly improved compared to standard training. Figure 4b shows that even when running SGD, the norm of the gradient does not decrease due to applying perturbation. In fact, applying ATS results in less increase in gradient norm as a re-sult of perturbation. However, whether running SGD or ATS the ratio is upper bounded for example by 1.

Gradient
alignment Finally, we measure pt ∇f (xt) pt ∇f (xt) pt ∇f (xt),pt ∇f (xt) in practice and demonstrate that, as expected, using ATS lowers this value (thus improves alignment) fulfilling Criterion 3. The result is plotted Figure 4c.
The convergence bound obtained for ATS from our observations is within a small constant of vanilla SGD. On the other hand, in Section 4, we observe that the same number of iterations as in standard training is typically sufficient in practice.
Applying ATS to small-width subnetworks recovers the setting of slimmable nets (Yu and Huang, 2019b;. While the original papers apply gradient updates of narrow and wide widths at the same timestep, our scheme unrolls this by updating the small and large parts sequentially. Therefore, the convergence result for ATS also informs the sequential version of slimmable nets, and proves that the q t parameter characterizes the successful joint training. As we discussed earlier, the sequential version benefits from implicit SGD regularization to keep the gradients of the sub-network and full network aligned. We also point out that while at first glance the algorithm seems tailored for training a network jointly with one of its sub-networks, the same method can be used to train a pair of arbitrary networks, by using one as the core network, while building the super network M super to be the combination of the two. There are various ways to build M super . In its simplest form, this can be done by creating a super-network that has a copy of each network and outputs the sum of their outputs. Wide-and-deep networks are an example of using this simple combination. This can be seen by letting M core correspond to the deep network while the wide network acts as the extension network. Using ATS in this setting can allow the wide part to become an extension to the deep part which can focus on solving cases where feature interactions are necessary, which was the intuition behind the design of these networks (Cheng et al., 2016). Furthermore, the deep part can be used as a standalone network when necessary.
A more sophisticated combination is summing the output of both models in all hidden layers, instead of just in the output layer. This is the combination scheme we use in our experiments for training a low-rank model. These cases are illustrated in Figure 1.
While we have so far focused on training two networks, the scheme can be extended to train several more networks as a hierarchy, to allow more flexibility and finegrained control over the amount of resource usage.
Figure 4: Measurement of quantities affecting convergence rate of Theorem 1 during standard training of a Transformer vs. joint training together with its subnetwork with half width using ATS. In all plots, a mini-batch gradient is used to estimate the mentioned quantities, instead of the full gradient.

Experiments
We consider the application of alternating training scheme in two use cases. In Section 4.1, we show the effectiveness of ATS by training a standard Transformer together with a Transformer with a low-rank architecture. We show that the low-rank model trained with ATS is able to match or in some cases even outperform training the low-rank variant separately. At the same time the full-rank obtains a comparable performance while the total training time is less than training both models separately. In Section 4.2, we show that ATS can also be used to train a Transformer together with its small-width sub-network with reduced width and observe similar results to the low-rank training. We trained our models using Adam and trained for 22 epochs on WMT17 (Bojar et al., 2017) and for 30 epochs on IWSLT14 (Cettolo et al., 2014). We report a detailed list of hyper-parameters in Appendix D.

Low-Rank Training
In this section we demonstrate how our alternating training scheme can be used to train a low-rank model. In particular, we build a super-model composed of a low-rank as well as a full-rank Transformer by replacing the linear transformations (e.g. fully connected layers) in the feed-forward modules and key/query projection in the attention layers of a standard Transformer, with low-rank fully connected (LFC) layer: where U ∈ R k×fin , V ∈ R fout×k , and W ∈ R fout×fin are the parameters. We set k = r min(f in , f out ) for all layers where r is the rank reduction ratio. The lowrank variant is the sub-network which only contains U and V parameters of each LFC layer as well as all other parameters in the super-network that are not in a LFC layer. Note that in this case, the super-network is equivalent to a full-rank variant and can be converted Table 1: BLEU scores of Transformer trained jointly with its low-rank variant using ATS on the IWSLT14 (top) and WMT17 (bottom) machine translation datasets respectively. The sub-network corresponds to the low-rank variant with rank reduced by factor r. The baseline (full network with standard training) shows the performance of a standard Transformer. In other rows, the full network corresponds to the super-network which can be converted to a standard Transformer.
(a) IWSLT14 dataset. to a standard Transformer after the training.
We compared the performance of the trained low-rank and full-rank models with the performance of the same model trained separately using the standard optimizer on IWSLT14 dataset in Table 1a. Observably, the lowrank model trained in our scheme has a superior performance for lower values of r while it matches the performance of standard training for larger r. At the same time, the full-rank model has a much higher performance near that of the standard training of the same model, showing the success of ATS in joint training. We repeated the same experiment on WMT17 and obtained similar results which we reported in Table 1b.

Small-Width Training
In order to show that our model can also be used for training a network together with its sub-network, we train a Transformer with its small-width variant. As in the low-rank settings, ATS obtains core networks with similar or even superior performance to solo training as well as super networks with comparable performance. We report our result in Appendix C and also compare per-step computation cost of our method with slimmable training and standard training in FLOPs. It can be seen that ATS is significantly more efficient than slimmable training and even standard training of the super model.

Future Work
Our theoretical framework is widely applicable to a variety of existing and novel training scenarios. Hence, it can be used to analyze other partial training schemes and gain insights useful to improve such schemes. For example, a future direction would be using the analysis done in this work on independent subnet training to allow dynamic switching between local training and global coordination automatically. We have also used theoretical insights of our results to design a joint training method for two arbitrary neural networks. While we applied our method to train Transformers on translation tasks, applications in other areas or for other architectures is grounds for future work. Finally, other training schemes can be designed relying on the proposed set of criteria identified in our work.

Conclusion
In this work, we developed a theoretical framework to analyze convergence of SGD variants that apply parameter perturbation and gradient masking, and showed that our settings cover a large number of scenarios involving partial training. Moreover, we presented a new simultaneous training scheme for arbitrary network pairs, and showed the efficacy of our scheme for training a Transformer together with its low-rank variant, and alternatively its subnetwork of reduced width.
Hence c sim ≤ √ 10 2 . To prove the bound for alignment note that: Where in the last inequality we used the bound for c sim which in turn shows c align ≤ √ 10.

C Small-Width Training Results
We obtain the small-width variant by reducing the width of the feed-forward modules and the key/query projections in attention layers by a factor r. In particular, we reduce the number of neurons in the hidden layer of the feed-forward modules as well as the key/query embedding dimension of the attention layers by the factor r.
In contrast to the low-rank setting where we use an additive combination of the full-rank and low-rank model,  we use the standard Transformer as the super-network and train it jointly with its sub-network corresponding to the small-width variant. Table 2a includes the performance of both the full-width and the small-width models trained with this scheme in terms of the BLEU score on IWSLT14 dataset. Furthermore, the performances of the same models with standard training are also reported. It can be clearly seen that training with this scheme yields better small-width models. Additionally, while the full-width models have a lower performance when trained with ATS than when trained standardly, their performance are still comparable. We also perform the same experiment on WMT17 dataset and report the results in Table 2b and similarly observe that using ATS, results in a small network matching the performance of standard training and a full model with comparable performance while the cost of training is less than training these two models separately.
We would like to point out that in comparison to low-rank models, small-width models have a lower performance on the WMT17 dataset for small values of r while the number of parameters remain comparable. In particular, standard training of a low-rank Transformer with r = 0.015625 (which has the same number of parameter as low-width Transformer with r = 0.03125) yields 22.10 BLEU score (vs 20.47 BLEU score). This encourages using low-rank models instead of low-width models.
For completeness, given the similarity of our method and slimmable training we compare the two by performing the small-width experiments with r = 0.5 on a ResNet-18 over CIFAR10 datasets. The results are reported in Table 3. We additionally reported an estimate of the number of FLOPs per epoch performed by each method. It can be seen that while the performance of both methods are similar, ATS is much more efficient.

D Hyperparameters for Experiments
We train each experiment with IWSLT14 dataset on a single GTX Titan X GPU and use a Tesla V100 GPU for training WMT17 experiments. For the implementation of our experiments we extend the implementation of transformer in FairSeq (Ott et al., 2019) and use its CLI (fairseq-train) for training. The hyperparameters based on the dataset are reported in Table 4. For training the sub-network alone we additionally set the parameter "max level" to 1. For training with alternating scheme we set the parameter "alternate" to True. Training the normal Transformer (with or without ATS) for one epochs take approximately 7 minutes on IWSLT14 dataset and 100 minutes on WMT17 dataset.
For CIFAR10, we train using SGD with momentum 0.9 and weight decay 5×10 −4 . Separate batch normalization layers were used for the core and the super network. For measuring alignment with and without dropout (Figure 2), batch normalization was disabled.