Efficient stagewise pretraining via progressive subnetworks

## Abstract

Abstract Recent developments in large language models have sparked interest in efficient pretraining methods. Stagewise training approaches to improve efficiency, like gradual stacking and layer dropping (Reddi et al., 2023 ; Zhang & He, 2020 ) , have recently garnered attention.
The prevailing view suggests that stagewise dropping strategies, such as layer dropping, are ineffective, especially when compared to stacking-based approaches. This paper challenges this notion by demonstrating that, with proper design, dropping strategies can be competitive, if not better, than stacking methods.
Specifically, we develop a principled stagewise training framework, progressive subnetwork training , which only trains subnetworks within the model and progressively increases the size of subnetworks during training, until it trains the full network. We propose an instantiation of this framework — Ra ndom P art Tr aining ( RaPTr ) — that selects and trains only a random subnetwork (e.g. depth-wise, width-wise) of the network at each step, progressively increasing the size in stages. We show that this approach not only generalizes prior works like layer dropping but also fixes their key issues. Furthermore, we establish a theoretical basis for such approaches and provide justification for (a) increasing complexity of subnetworks in stages, conceptually diverging from prior works on layer dropping, and (b) stability in loss across stage transitions in presence of key modern architecture components like residual connections and layer norms. Through comprehensive experiments, we demonstrate that RaPTr can significantly speed up training of standard benchmarks like BERT and UL2, up to 33% compared to standard training and, surprisingly, also shows better downstream performance on UL2, improving QA tasks and SuperGLUE by 1.5%; thereby, providing evidence of better inductive bias.

## 1 Introduction

Large network based language models (e.g. Transformers) have revolutionized the field of NLP. Intriguingly, these language models have demonstrated remarkable *emergent abilities* that only begin to manifest at large scales (Wei et al., ; Schaeffer et al., ). However, training such large models is usually very slow and resource intensive (Brown et al., ; Touvron et al., ; Chowdhery et al., ).
This has sparked interest in efficient training of large models, necessitating the development of new algorithms and paradigms for efficient pretraining. Traditionally, this was accomplished by designing better optimization algorithms (e.g., (Chen et al., ; Gupta et al., ; Shazeer & Stern, ; Liu et al., )) that require fewer training steps to reduce the loss.
Recently, other paradigms based on *stagewise training*, especially on depth, have garnered interest. Two such contrasting paradigms are: (a) layer stacking and (b) layer dropping.

Stacking based approaches have been studied extensively since Chen et al. () applied it for BERT. Progressive (Gong et al., ) and gradual stacking (Reddi et al., ) are layer stacking methods that train large models in stages, starting with a small network and gradually growing the network size by stacking a subset of layers onto itself from previous stages.
Although effective in reducing FLOPs and training time, their performance is sensitive to stacking schedules and require careful tuning.
Furthermore, since the model grows gradually, it is not possible to assess the full model performance during earlier stages (i.e., it is not an anytime algorithm).
Additionally, using small model with way fewer parameters for part of the training can possibly hamper model quality (e.g. long term memory (Geva et al., )), especially for single epoch training where each data sample is seen once during training. In our experiments(§4.2), we observe that the pretraining loss and downstream performance may even be worse than baseline (full-model) training.

Layer dropping, on the other hand, maintains the model’s identity but drops layers at random during training. This area of study remains largely unexplored. The closest work for training efficiency is progressive layer dropping (PLD) (Zhang & He, ), a *heuristic approach* where FLOPs are saved by increasingly dropping more layers as training proceeds, thus, decreasing its overall capacity over time. Such a strategy to improve training efficiency typically comes at the expense of quality, and is generally worse than stacking approaches (Kaddour et al., ).
Through theoretical analysis and experiments, we first show that there is a fundamental problem with existing dropping strategies like PLD since dropping more layers later during training can be detrimental to *learning complex features*.
Other instantiations (Fan et al., ; Zhang et al., ; Liu et al., ) do not achieve training efficiency, as they were proposed as a regularization strategy or for improving inference efficiency.
This naturally prompts the central question of the paper:

> *Is it possible to design principled and robust stagewise dropping based techniques that are competitive or better than stacking techniques?*

In this paper, we propose a novel generalization of stagewise dropping approaches called progressive subnetwork training that fundamentally addresses the above concerns, and provides an affirmative answer to this question. The key components of this framework are:

- (P1)
maintain a common base model of interest and train subnetworks of varying complexities within the model.
- (P2)
progressively increase the complexity of subnetworks in each stage to explicitly impose this simple-to-complex behavior.

For (P1), one can use very general subnetworks in this framework (e.g. subset of layers or layers with smaller width). This strictly generalizes layer dropping techniques where just layers are dropped to derive efficiency. Furthermore, (P2) is motivated by the theoretically and empirically studied phenomenon that gradient-based training learns functions of increasing complexity over time (Kalimeris et al., ; Abbe et al., ) and starkly diverges from earlier layer dropping ideas where more layers are dropped as training proceeds. As we shall see soon, even a simple instantiation of this idea can already be competitive or better than stacking approaches that have been extensively studied.

Given the above framework, a natural question arises: how do we select the subnetworks? As a concrete instantiation, we choose subnetworks to be *random* parts of the network, and in each stage we perform forward and backward passes over them. The size of the subnetworks is gradually increased over time with a fixed schedule.
This approach, which we call Random Part Training (RaPTr), reduces the total number of FLOPs and wall-clock time in the initial stages, but unlike stacking, every parameter of the full model contributes to the training loss at all stages, and it allows us to track the full model throughout training.
In this paper, we demonstrate that this simple, yet powerful, strategy not only has a solid theoretical foundation, but also shows strong experimental results for BERT and UL2 pretraining, both in terms of training efficiency and improving model quality. We summarize the main contributions of the paper below:

- •
We introduce a novel stagewise training called progressive subnetworks that generalizes prior dropping strategies in §2.
Specifically we explore Random Part training (RaPTr) that trains a part comprised of a random subnetwork, with the size of the subnetwork progressively increasing in stages. We specifically study variants of RaPTr where the random subnetwork selection is restricted to single model axis e.g. depth (section 2.1) or intermediate MLP width (section 4.3). We leave the combination of multiple axes for future investigation.
- •
Through analysis on polynomial data in §3, we demonstrate a fundamental problem with prior dropping techniques like progressive layer dropping – dropping more layers towards the end can hurt the models’ ability to capture complex correlations in the data. Furthermore in this polynomial setting, we show, both theoretically and empirically, that RaPTr can effectively learn higher order components of the underlying ground-truth function much better than progressive layer dropping. This provides a strong justification for progressively increasing complexity of subnetworks in stages. The polynomial setting can potentially aid future research in efficient training.
- •
We conduct extensive experiments on BERT (Devlin et al., ) and UL2 language models (Tay et al., ) to compare a depth instantiation of RaPTr with dropping techniques (PLD), and gradual stacking and its improved variants.
On BERT-Base (§4.1), RaPTr demonstrates competitive performance to state-of-the-art stacking strategies at similar FLOPs, while being better than baseline(^3^33We refer to full-model training as baseline training in our paper) training with $1.33\times$ fewer FLOPs.
For UL2-$1.6B$ language model (§4.2), RaPTr matches the pretraining perplexity of baseline training by requiring $1.2\times$ fewer FLOPs.
Furthermore, despite having the same perplexity, RaPTr has much better performance on a suite of $12$ downstream benchmarks, evaluated in $1$-shot and $5$-shot in-context settings. This suggests a desirable inductive bias of RaPTr that improves its generalization abilities beyond perplexity.
- •
We discuss a novel implementation strategy for subnetwork training translates FLOPs improvements to wall-clock speedups. This is particularly valuable for distributed training where naive conditional dropping implementations either fail or do not speedup training (appendix G).
- •
We establish the *first* theoretical basis for stagewise training based on dropping of layers that studies the behavior at stage transitions. In particular, we characterize stability conditions under which RaPTr yields smooth transition in loss across stage transitions (§5). We connect this to the idea of loss preservation (Chen et al., ) and show that RaPTr has an even stronger property of loss improvement in each stage. Through an illustrative setting with linear networks, we theoretically demonstrate the importance of modern architecture components, like layernorms and residual connections, for such stability.

## 2 Progressive subnetwork Training

Notation. We use $[n]$ denotes the set $\{1,2,\dots,n\}$. $a_{1:k}$ is used to denote a sequence of $k$ scalars $a_{1},\dots,a_{k}\in\mathbb{R}$, and ${\bm{x}}_{1:k}$ to denote a sequence of $k$ vectors ${\bm{x}}_{1},\dots,{\bm{x}}_{k}\in\mathbb{R}^{d}$. We alternately also use ${\bm{X}}\in\mathbb{R}^{n\times d}$ to denote a matrix containing a sequence ${\bm{x}}_{1:n}$ as rows.

We consider the setting where the goal is to
learn an $L$-layer sequence-to-sequence neural network. (e.g. standard Transformer network).

###### Definition 2.1 ( $L$ -layer sequence-to-sequence model) .

Let $f_{1},\cdots,f_{L}:\mathbb{R}^{N\times d}\to\mathbb{R}^{N\times d}$ denote a set of $L$ sequence-to-sequence functions
Then, $F:\mathbb{R}^{N\times d}\times\mathbb{R}^{L}\to\mathbb{R}^{N\times d}$ with a sequence input ${\bm{X}}\in\mathbb{R}^{N\times d}$ and $L$ scalars $\alpha_{1:L}$, outputs a sequence ${\bm{Y}}$ after a recursive computation with intermediate sequences ${\bm{Y}}^{(1)},\cdots,{\bm{Y}}^{(L-1)},{\bm{Y}}^{(L)}$, given by

$$ $\displaystyle{\bm{Y}}^{(\ell)}={\bm{Y}}^{(\ell-1)}+\alpha_{j}f_{j}({\bm{Y}}^{( \ell-1)})\text{ for all }1\leq\ell\leq L.$ $$

Here ${\bm{Y}}^{(0)}$ denotes ${\bm{X}}$ for simplicity and output ${\bm{Y}}$ is equal to ${\bm{Y}}^{(L)}$.

Standard model training is represented by the backbone function $F$, where $\alpha_{i}=1$ for $i\in[L]$. For simplicity, given an input sequence ${\bm{X}}$, we will use $F({\bm{X}})$ as the output and ${\bm{Y}}^{(1)},{\bm{Y}}^{(2)},\cdots,{\bm{Y}}^{(L)}$ as the intermediate layer outputs of $F$ under standard model training, unless specified otherwise. The output of the model is passed through a function $H:\mathbb{R}^{d}\to\mathbb{R}^{V}$ that projects the model output into $V$-dimensional logits, where $V$ is the vocabulary size.
For an example ${\bm{X}}$, cross-entropy loss based on true labels is denoted as $\mathcal{L}(H\circ F({\bm{X}}))$ (or $\mathcal{L}(F({\bm{X}}))$ when $H$ is clear from context). Note that this notation hides the true labels for the ease of exposition. The final loss is then defined as $\mathcal{L}(F)=\mathbb{E}_{{\bm{X}}\sim\mathcal{D}}[\mathcal{L}(F({\bm{X}}))]$ for the input distribution $\mathcal{D}$.

Given such a setting, *progressive subnetwork training*, a stagewise training framework, consists of two crucial components:

- 1.
Subnetwork selection & rescaling: At each iteration, we select a (possibly random) subnetwork of the $L$-layer neural network. The forward and backward passes are computed based on this subnetwork network along with appropriate scaling (e.g. Section 2.1)).
- 2.
Progressive subnetworks: In stages, we progressively increase the size of the subnetworks starting from small subnetworks and end with the complete network in the final stage.

We note that this framework is quite general. To make it more concrete, in the following section, we provide a simple but powerful instantiation of the framework based on *random paths*.

###### Definition 2.1 ( L 𝐿 L italic_L -layer sequence-to-sequence model) .

### 2.1 Random Path Training: RaPTr

One simple approach to select a subnetwork is by skipping a few layers and choosing a *path*. More concretely, given a network $F$ to be trained, we pick a random subset of layers for the forward pass and bypassing the rest of the layers using the residual connections.
Let $p$ denotes the probability of randomly selecting a layer subnetwork and $\mathcal{I}$ denotes a subset of layers that are always included, i.e. they are never bypassed. We define the following before describing RaPTr in more detail.

###### Definition 2.2 ( $(p,\mathcal{I})$ -subnetwork) .

Let $\zeta_{1:L}$ be Bernoulli samples, with $\zeta_{i}=1$ for all $i\in\mathcal{I}$, while $\zeta_{i}\sim B(p)$ for all $i\not\in\mathcal{I}$.
The set of all layers for which $\zeta_{i}=1$ represents a random subnetwork while layers with $\zeta_{i}=0$ are bypassed. The output of the selected subnetwork on a sequence input ${\bm{X}}$ is equivalent to the output of the model given by $F({\bm{X}},\zeta_{1:L})$.

Figure: Figure 1: Pictorial description of stagewise RaPTr where the number of layers being skipped progressively decreases over stages.

Figure: Algorithm 1 $k$-stage RaPTr

The pseudo-code for RaPTr is provided in Algorithm 1.
On a high level, the total training is split into $k$ stages. Each stage $s$ uses $(p_{s},\mathcal{I}_{s})$-subnetwork between steps $T_{s}$ and $T_{s+1}$. We denote this schedule by $T_{1:k}\times(p_{1:k},\mathcal{I}_{1:k})$. Importantly, we progressively increase the random subnetwork selection pattern across stages i.e., the expected length of the selected random subnetworks is increased progressively towards full model training. This can be achieved by either increasing the probability of including each layer in random subnetwork or fixing more layers in $\mathcal{I}_{\cdot}$ or both. More formally, we use schedules $T_{1:k}\times(p_{1:k},\mathcal{I}_{1:k})$ that satisfies: (a) $p_{s}\leq p_{\tilde{s}}$, and (b) $\mathcal{I}_{s}\subseteq\mathcal{I}_{\tilde{s}}$ for all $1\leq s\leq\tilde{s}\leq k$.

Note that each training step in RaPTr involves computing forward and backward passes only on random subnetwork. In expectation, training a $(p,\mathcal{I})$ random subnetwork will require $\frac{\left|\mathcal{I}\right|+(L-\left|\mathcal{I}\right|)p}{L}$ FLOPs relative to standard training that uses all $L$ layers. By using $p_{s}\ll 1$ for most part of training, RaPTr can significantly increase the training efficiency.

###### Definition 2.2 ( ( p , ℐ ) 𝑝 ℐ (p,\mathcal{I}) ( italic_p , caligraphic_I ) -subnetwork) .

## 3 Illustration: Problems with earlier subnetwork training instantiations

Figure: Figure 2: Evaluation loss (left) and component error (3 on the right) on basis polynomials of different degrees for a $20$ layer residual network trained with different methods. Labels are generated from a composition of polynomials of degrees $1$ to $10$ (Eq.1). The schedules for RaPTr and PLD are selected to have 20% fewer FLOPs compared to baseline (phase transitions for RaPTr have been marked with dark vertical lines). (more details in §D.3). Observations: (a) RaPTr reaches same evaluation loss of baseline, while PLD performs much worse. (b) RaPTr learns lower order terms faster and picks up higher order terms in the later stages. PLD is worse at capturing higher degree terms owing to its reduced expressivity towards the end.
Refer to caption: x1.png

In this section, we discuss problems with existing subnetwork training instantiations like progressive layer dropping (PLD).
Recall that PLD drops more layers as training proceeds to enable FLOPs efficiency (see §D.1 for details). This is in contrast to the depth variant of RaPTr, that drops fewer layers as training proceeds. While this difference may seem superficial at first, it has deep implications from both conceptual and performance standpoints. Here, we argue through theoretical and empirical analysis on polynomial data, that this can have very significant impact on learning complex correlations in data. In the BERT and UL2 experiments in §4, we similarly observe that progressive layer dropping performs significantly worse than RaPTr.

We demonstrate the importance of progressively increasing the complexity of subnetworks in RaPTr (as opposed to progressively decreasing it in PLD) through a simple, yet instructive, setting: learning neural networks on polynomial data. For simplicity, we restrict the discussion to sequences of length $N=1$.

Polynomial learning setting. Suppose ${\bm{x}}$ are sampled from a uniform distribution over $\{\pm 1\}^{d}$. The ground-truth label is a polynomial $f^{\star}$ of degree $k$ defined as

$$ $\displaystyle F^{\star}({\bm{x}})=\sum_{l=1}^{k}\sum_{j=1}^{m}c_{l,j}\prod_{i \in S_{l,j}}x_{i},$ (1) $$

where $c_{l,j}\sim\mathcal{N}(0,1)$ and $S_{l,j}$ are random subsets of $[d]$ of cardinality $\ell$. Such polynomials have been studied in great detail (Abbe et al., , ) where the higher degree terms capture more complex correlations and are harder to learn. We consider training of $20$-layer residual network He et al. () $F$ on such data using square loss: $\mathbb{E}(F({\bm{x}})-F^{\star}({\bm{x}}))^{2}$. Here, each residual block consists of a single $4d$-hidden dimension MLP layer with ReLU activation.

Empirical Observations.
We are interested in measuring how well each method captures the higher degree terms. To this end, we estimate the component of a learned function $F$ onto each basis polynomials. This can be done simply using
$\hat{c}_{l,j}=\mathbb{E}_{{\bm{x}}\sim\{\pm 1\}^{d}}\left[F({\bm{x}})\prod_{i
\in S_{l,j}}x_{i}\right],$
since basis polynomials are orthogonal under the uniform distribution of the boolean data (O’Donnell, ).
For each degree $l\leq k$, we define the error as
$\tfrac{\sum_{j=1}^{m}(c_{l,j}-\hat{c}_{l,j})^{2}}{\sum_{j=1}^{m}c_{l,j}^{2}}$.
In Figure 2, we observe the following:

- •
PLD, that drops more layers as training proceeds, fails to effectively learn higher order complex correlations and, ultimately, hurts performance.
- •
RaPTr is competitive to baseline in terms of evaluation loss; in fact, RaPTr learns *every component* effectively.
Furthermore, RaPTr quickly learns lower order terms and then picks up higher order terms during later stages.

The learning pattern of RaPTr is reminiscent of the implicit bias of standard SGD training to learn functions of increasing complexity (Kalimeris et al., ; Xu et al., ; Rahaman et al., ; Cao et al., ; Abbe et al., ).
RaPTr naturally imposes this simple-to-complex behavior through size of subnetworks and also provides training efficiency in the process.

Theoretical Analysis. To further illustrate our point, we characterize the behavior of RaPTr for a simple 2-layer residual network, where each block consists of single neuron with a non-linear sine activation. We consider simple label function $F^{\star}({\bm{x}})=\frac{\sqrt{3}}{2}+\frac{\sqrt{3}}{2}x_{1}-x_{1}x_{2}$ for this analysis.

###### Lemma 3.1 (Informal, cf theorem I.1 ) .

For a small enough learning rate, 2-phase RaPTr first learns lower degree component and then the higher degree component.

In contrast, one layer is not expressive enough to represent the true label function (I.2). Thus, progressively dropping more layers (e.g., PLD) will reduce its expressivity. Remark: Stacking (Reddi et al., ) approaches, that grow the model size, can be shown to have similar simple-to-complex inductive bias in the above setting. We leave a detailed study of this connection to future work.

###### Lemma 3.1 (Informal, cf theorem I.1 ) .

## 4 Experiments

**Table 1: Loss and fine-tuning results for BERT-Base after $675$K steps and using equal peak learning rate ($10^{-4}$). Key observations: (a) RaPTr achieves similar loss as baseline at $1.33\times$ reduced FLOPs. (b) RaPTr achieves $0.02$ better evaluation loss than gradual stacking for same schedules. (c) RaPTr has a slight edge on downstream fine-tuning task.**
|  |  | Rel. | Eval |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Method | Schedule | FLOPs | Loss | MNLI | QNLI | SST-2 | Avg. |
| Baseline | - | 1.33 | 1.76 | 81.5 | 90.5 | 91.4 | 87.8 |
| PLD | - | 1. | 1.8 | 81.7 | 89.0 | 90.8 | 87.2 |
| Stacking | 6-8-10-12 | 1 | 1.78 | - | - | - | - |
| 6-9-12 | 1 | 1.77 | 80.9 | 89.8 | 91.1 | 87.3 |  |
| RaPTr | 6-8-10-12 | 1 | 1.75 | 82.1 | 89.8 | 92.4 | 88.1 |
| 6-9-12 | 1 | 1.75 | 82.3 | 89.2 | 91.0 | 87.5 |  |

We present comprehensive experiments that compare RaPTr with baseline (full-model) training, gradual stacking and progressive layer dropping (PLD) for BERT and UL2. Since our primary goal was to make subnetwork based strategies competitive to stacking, we primarily focus on comparisons to gradual stacking. However, we also show comparisons on BERT with improved versions of gradual stacking, used in MSG (Yao et al., ), LEMON (Wang et al., ), and bert2BERT (Chen et al., ). The details of relation between gradual stacking and these methods are in §D.2.

RaPTr setup: We describe the experimental setting of RaPTr from §2.1. We keep $\mathcal{I}$ equal to the first and last layer ($\mathcal{I}=\{1,L\}$) across all stages(^4^44Please see Appendix Table 9 and the discussion later for the relevant ablation study). Additionally, scaling layer outputs during initial stages helps track validation loss better, though its final effect is minimal (details in §J). Finally, we use a constant learning rate in all phases, except in the final phase where we decay the learning rate, following gradual stacking (Reddi et al., ).

Notations for RaPTr and stacking schedules: We succinctly denote the stage schedules by a set of subnetwork lengths separated by hyphens. For stacking (RaPTr) training for a $24$-layer model, 3-6-9-12 refers to $4$ stages with $3,6,9,$ and $12$ layer (average subnetwork) training respectively.
The length of each stage is chosen based on the reduction in FLOPs
to achieve during training (see §E). Unless specified otherwise, we split the training steps equally across the stages.

Wall clock speedups: In
In §F, we report wall-clock times for UL2 and BERT experiments. For UL2, a $1.2\times$ FLOPs reduction leads to a $1.19\times$ speedup, closely matching FLOPs improvements. For BERT, a $1.33\times$ FLOPs reduction gives a $1.26\times$ speedup. We also introduce a new implementation strategy for RaPTr in §G, essential for achieving speedups in distributed training where naive conditional dropping fails or doesn’t give any speedup. As runtime depends on architecture and hardware, we focus on FLOPs reductions in the following discussion.

**Table 2: We compare the performance of RaPTr against depth-wise stacking operations used in bert2BERT, LEMON, and MSG, which implement slight variations of gradual stacking (see section D.2) after $300K$ steps of training. RaPTr demonstrates competitive or superior performance across all variants, achieving comparable loss to the best-performing version of gradual stacking.**
|  | Schedule | Eval Loss | SST-2 | QNLI | MNLI | Average |
| --- | --- | --- | --- | --- | --- | --- |
| bert2BERT | 3-6-12 | 1.85 | 89.3 (0.1) | 84.5 (0.1) | 76.9 (0.0) | 83.6 |
| MSG | 3-6-12 | 1.87 | 88.2 (0.2) | 85.1 (0.1) | 76.7 (0.1) | 83.3 |
| MSG | 6-9-12 | 1.84 | 89.7 (0.3) | 85.6 (0.2) | 77.7 (0.0) | 84.3 |
| LEMON | 6-9-12 | 1.83 | 89.8 (1.1) | 87.2 (0.0) | 77.3 (0.1) | 84.7 |
| MSG + Layer Interpolation | 6-9-12 | 1.84 | 89.0 (0.7) | 85.1 (0.0) | 77.5 (0.3) | 83.9 |
| Stacking | 6-9-12 | 1.84 | 90.0 (0.4) | 85.3 (0.1) | 77.0 (0.1) | 84.1 |
| RaPTr | 6-9-12 | 1.83 | 89.3 (0.6) | 85.8 (0.3) | 78.6 (0.2) | 84.6 |

### 4.1 Experiments with BERT

**Table 3: Validation loss and 1-shot downstream evals on UL2-1.6B. Key observations: (a) RaPTr with 30k initial training improves performance by atleast $2-4\%$ on Trivia QA and SquADv2. RaPTr is atleast $5\%$ better than gradual stacking on various downstream tasks, (b) Compared to baseline, RaPTr is $1-2\%$ better on all downstream tasks on average. (c) Stagewise training achieves ($1-2\%$) lower variance on Tydi QA and SquADv2, implying implicit benefits of stagewise training. On an extensive suite of $12$ tasks and multi-shot settings, we observe a $1.5\%$ improvement in performance on average. See table 4 for extensive evaluations.**
| Method | Rel. FLOPs | Eval Loss | Trivia QA | Tydi QA | SQuADv2 | SuperGLUE | Avg. |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Baseline | 1.2 | 2.06 (0.01) | 25.0 (0.2) | 34.4 (3.1) | 42.1 (2.9) | 60.0 (0.4) | 40.4 |
| PLD | 1 | 2.09 (0.00) | 21.3 (0.3) | 32.4 (2.1) | 40.2 (0.9) | 59.9 (0.2) | 38.5 |
| 12-16-20-24 Stacking | 1 | 2.08 (0.00) | 20.1 (1.3) | 28.6 (2.4) | 36.0 (1.9) | 60.4 (0.9) | 36.3 |
| 12-16-20-24 RaPTr | 1 | 2.06 (0.00) | 25.8 (0.2) | 36.7 (1.0) | 44.1 (0.5) | 60.9 (0.2) | 41.9 |

**Table 4: We extensively compare all trained models from table 3 on multiple downstream tasks and few-shot in-context settings. We follow prompt design from Chowdhery et al. () in each setting. For tasks marked with ^† and ^⋆, we report Exact match and F1 scores respectively. For the rest, we use accuracy. The tasks have been sub-divided into 4 major groups, memorization QA, QA with context, completion, and SuperGLUE. On average, RaPTr is 1-2% better than baseline and stacking.**
|  | 1-shot | 5-shot |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- |
|  | Baseline | Stacking | RaPTr | Baseline | Stacking | RaPTr |
| Trivia QA^† | 25.0 (0.2) | 20.1 (1.3) | 25.8 (0.2) | 26.5 (1.1) | 21.1 (1.3) | 25.1 (0.5) |
| Web QA^† | 6.4 (0.4) | 5.8 (0.6) | 7.6 (0.5) | 10.6 (0.4) | 9.2 (0.5) | 11.2 (0.2) |
| Natural QA^† | 4.2 (0.5) | 3.4 (0.4) | 4.4 (0.1) | 5.7 (0.1) | 4.6 (0.3) | 6.0 (0.3) |
| Tydi QA^† | 34.4 (3.1) | 28.6 (2.7) | 36.7 (1.0) | - | - | - |
| SQuaDv2^† | 42.1 (2.0) | 36.0 (0.9) | 44.1 (0.5) | 43.2 (3.0) | 36.2 (2.6) | 44.5 (1.3) |
| DROP^† | 21.4 (0.8) | 19.5 (0.6) | 23.0 (0.4) | - | - | - |
| CoQA^⋆ | 49.2 (0.7) | 43.9 (0.8) | 52.4 (0.7) | - | - | - |
| QuAC^⋆ | 18.1 (0.5) | 16.8 (0.6) | 18.1 (0.4) | - | - | - |
| LAMBADA | 13.7 (2.9) | 12.0 (1.1) | 18.7 (3.1) | 30.5 (3.4) | 29.5 (2.1) | 38.7 (2.2) |
| Storycloze | 72.9 (0.4) | 71.0 (0.4) | 73.3 (0.4) | 75.1 (0.1) | 72.6 (0.8) | 75.3 (0.6) |
| Hellaswag | 58.3 (0.2) | 56.1 (0.1) | 58.5 (0.3) | 58.3 (0.2) | 56.1 (0.1) | 58.4 (0.3) |
| SuperGLUE | 60.0 (0.4) | 60.4 (0.9) | 60.9 (0.2) | 60.7 (0.3) | 58.8 (0.5) | 62.1 (0.2) |
| Average | 33.8 | 31.1 | 35.3 | 38.8 | 36.0 | 40.2 |

Experiment setup. We pretrain BERT models (Devlin et al., ) on Wikipedia + Books dataset with AdamW optimizer (Loshchilov & Hutter, ). We report the evaluation loss and fine-tuning performance of the trained models on $3$ GLUE tasks (Wang et al., ) (refer to §D for details).

Comparisons to gradual stacking and baseline: We observe that RaPTr achieves similar or better evaluation loss to baseline training, despite baseline training using $1.33\times$ more FLOPs than RaPTr for BERT-Base. Compared to gradual stacking at similar FLOPs, RaPTr again has better validation loss. Additionally, all three methods exhibit similar performance in downstream fine-tuning tasks
(see Table 1). However, PLD performs significantly worse compared to others.

Comparisons with variants of stacking:
We further compare RaPTr to variants of gradual stacking used in MSG (Yao et al., ), LEMON (Wang et al., ), and bert2BERT (Chen et al., ) (details are in section D.2). We focus on depth-only stacking operations in these frameworks in table 2. We show that RaPTr performs competitive or even better than all variants of stacking, achieving same evaluation loss as the best tuned variant of stacking.

Loss behavior during phase transitions: Perhaps surprisingly, we observe that the training loss decreases quite smoothly when transitioning between two stages in RaPTr (see Fig. 3 (a) for BERT training under RaPTr). This is in contrast to stacking, where new variants have been developed to explicitly impose loss preservation across stage transitions (Shen et al., ; Wang et al., ). We delve deeper into this favorable behavior of RaPTr in §5.

Ablations with RaPTr parameters:
We observe robustness of the final trained model to different RaPTr schedules (Appendix Table 8). Furthermore, we observe that fixing the first and last layers at all steps during training helps RaPTr (Appendix Table 9). Since RaPTr is robust to schedule selections (Table 8), we recommend the schedule in the box below for all practical purposes.

### 4.2 Experiments with UL2-1.6B

Experiments on BERT (§4.1) show that RaPTr can be competitive or better than gradual stacking and can outperform baseline training. We ask whether the same observations hold when training billion-parameter language models on large text corpora. We pretrain a 1.6B decoder-only UL2 model (Tay et al., ) with 24 layers for $400k$ steps with batch size $512$.

Table 3 reports the validation loss and downstream 1-shot performance without fine-tuning. Please see §D.5 for experimental details and table 4 for more extensive evaluations.

Schedules for RaPTr and gradual stacking. In table 3, we report for a schedule with $4$ stages, denoted by 12-16-20-24. The length of each stage has been adjusted appropriately to use an average subnetwork length of $20$ out of $24$, giving $1.2\times$ FLOP reductions compared to the baseline training (see §E). RaPTr uses an initial full-model training phase for $30$K steps before transitioning to its schedule. For parity in FLOPs, we reduce $30$K steps from the final phase. This is useful for RaPTr–we attribute this to the fast drop in loss that large models can achieve initially. The ability to include full model training is another benefit of RaPTr over stacking due to its flexibility.

We summarize the key findings from table 3 below.

- •
Perplexity results. At $1.2\times$ FLOP reduction, RaPTr achieves similar evaluation perplexities to baseline training and also performs better than stacking (table 3).
- •
Downstream inductive bias. Intriguingly, we find that despite having similar perplexity, RaPTr has much better downstream metrics compared to both baseline and stacking.
The improvements are particularly large for TydiQA (3.8%) and SQuADv2 ($2.0\%$). This perhaps suggests RaPTr has a desirable inductive bias of RaPTr, a phenomenon that has been recently studied for other pretraining settings (Saunshi et al., ; Liu et al., ).
- •
Lower variance. Another notable observation is that RaPTr has lower variance on all metrics and is thus more stable to training runs. We believe these inductive bias benefits of RaPTr deserve further exploration.

### 4.3 Subnetwork training beyond depth

Stacking based approaches have been studied for other dimensions beyond depth (e.g. width) by (Gu et al., ; Shen et al., ; Wang et al., ; Gesmundo & Maile, ).
In this section we demonstrate the flexibility of the subnetwork training framework to handle other growth operators.

We extend RaPTr to intermediate MLP dimensions and attention heads. For attention heads, we apply stagewise training by randomly selecting a subset of heads in each layer, increasing the number of heads across stages. For MLP dimensions, we divide each MLP into $4$ sub-MLPs, pick random subset of sub-MLPs in each layer to define a random subnetwork, and gradually increase the number selected at each stage. We compare these variants, named Attention-RaPTr and MLP-RaPTr, to their MSG counterparts.
Attention-RaPTr and MLP-RaPTr perform better than their corresponding operators in MSG, providing further evidence of better performance than stacking-based approaches (table 5). A more comprehensive study of RaPTr to other axes is left as future work.

**Table 5: Comparisons at $300K$ steps of training on BERT-Base. (Top): Comparison between Attention-RaPTr and MSG’s attention head growth operator (Yao et al., ). Both use schedules that use an average of 9 heads per layer, reducing FLOPs in self-attention by $1.33\times$. (Bottom): Comparison between MLP-RaPTr and MSG’s MLP growth operator. Both use schedules that use an average intermediate MLP dimension of 2048, reducing MLP FLOPs by $1.7\times$.**
|  |  | Eval Loss | SST-2 | QNLI | MNLI | Avg. |
| --- | --- | --- | --- | --- | --- | --- |
| Head | MSG | 2.07 | 87.5 (0.1) | 83.4 (0.1) | 73.3 (0.3) | 81.4 |
| Operators (6-9-12) | Attention-RaPTr | 1.84 | 89.8 (0.6) | 86.5 (0.3) | 77.5 (0.1) | 84.6 |
| Intermediate MLP size | MSG | 1.88 | 88.1 (0.4) | 85.6 (0.4) | 77.4 (0.1) | 83.7 |
| Operators (768-1536-3072) | MLP-RaPTr | 1.84 | 88.7 (0.3) | 85.3 (0.1) | 77.3 (0.3) | 83.8 |

## 5 Loss Preserving Behavior of RaPTr

RaPTr provides a general framework, as we can adjust the average size of random subnetworks in discrete steps between stages (§2.1). Training time instabilities are a possibility, as one might expect an arbitrarily large spike in the loss at stage transitions, due to the discrete shift in the training of the model. Remarkably, we observe that the training loss decreases quite smoothly when transitioning between two stages (see Fig. 3 (a) for BERT training under RaPTr).
Hence, we ask the following:

> *What are the general conditions under which training loss under RaPTr stays stable at stage transitions?*

This question has been been extensively studied for stacking based approaches (Wang et al., ; Chen et al., , ; Shen et al., ).
Here, we introduce, to our knowledge, the *first* framework to analyze models under discrete dropping based training strategies, and understand the necessity of different architecture components for robustness to discrete transitions. Related works look into the generalization theory for dropout (Srivastava et al., ) as regularization (Gal & Ghahramani, ; Arora et al., ; Wager et al., ; Hu et al., ; Helmbold & Long, ). Building on these frameworks, our analysis relies on a crucial notion of stability (Arora et al., ). The stability analysis, when instantiated for linear networks highlights the importance of two popular architectural choices in Transformer models – residual connections and layer normalization.

### 5.1 Layer stability

We focus on sequences of length $N=1$; generalization to $N>1$ is fairly easy. Let $\mathcal{L}:\mathbb{R}^{d}\to\mathbb{R}$ represent the training loss of the backbone $F$. For transformers, $F$’s output passes through a Layer normalization layer before projecting to logits. This makes $\mathcal{L}$ scale-invariant (Ioffe & Szegedy, ; Ba et al., ), which gives a favourable stability condition as any perturbation in $F$’s output results in a proportional loss perturbation relative to the norm of $F$’s output. Thus, we make the following assumption.

###### Assumption 5.1 (Relative-Lipschitzness) .

There exists a constant $\mu_{\mathcal{L}}>0$ such that for any input ${\bm{x}}\in\mathbb{R}^{d}$, label ${\bm{y}}$ and perturbation $\eta\in\mathbb{R}^{d}$, $\mathcal{L}$ satisfies
$\mathcal{L}({\bm{x}}+\eta,{\bm{y}})-\mathcal{L}({\bm{x}},{\bm{y}})\leq\mu_{
\mathcal{L}}\left(\left\|\eta\right\|_{2}/\left\|{\bm{x}}\right\|_{2}\right).$

To understand loss changes across stage boundaries of RaPTr, we consider two stage RaPTr: the first stage trains with subnetwork of length $L-1$ by dropping a single layer at random, and the second stage trains the entire model. Suppose $\mathcal{L}_{1}$ and $\mathcal{L}_{2}$ denote the effective loss functions being minimized in the two stages.
The aim is to show that $F$ learned in the first stage by minimizing $\mathcal{L}_{1}$ should also result in small value for $\mathcal{L}_{2}$.

###### Definition 5.2 .

Let $F_{-\ell}$ denote the subnetwork after skipping layer $\ell$.
The stability of network output with respect to dropping layer $\ell$ is defined as $\Psi_{\ell}({\bm{x}})=\|F_{-\ell}({\bm{x}})-F({\bm{x}})\|_{2}$.

Next theorem shows that $\mathcal{L}_{2}(F)-\mathcal{L}_{1}(F)$ is small if stability scales slower relative to output norm.

###### Theorem 5.3 (Informal, cf theorem H.1 ) .

Under assumption 5.1 of loss $\mathcal{L}$,
$|\mathcal{L}_{2}(F)-\mathcal{L}_{1}(F)|$ is upper bounded by $(\mu_{\mathcal{L}}/L)\mathbb{E}_{{\bm{x}}\in D}(\sum_{\ell=1}^{L}\Psi_{\ell}({
\bm{x}}))/\left\|F({\bm{x}})\right\|_{2}$.

The proof follows by observing that $\mathcal{L}_{1}(F)=\frac{1}{L}\sum_{\ell\in[L]}\mathcal{L}(F_{-\ell})$ and $\mathcal{L}_{2}(F)=\mathcal{L}(F)$. Thus, the losses are close if $F_{-\ell}$ is close enough to $F$ for a random $\ell$.
So, the relative stability of the network determines the success of the approach.

Empirical verification with BERT: In fig. 3 (b, c, d), we report the stability of BERT-Large during training. We observe that the norm of the layers grow linearly with depth, while the stability $\Psi_{\ell}$ grows sub-linearly with depth. This implies that our upper bound on the loss gap $\mathcal{L}_{2}(F)-\mathcal{L}_{1}(F)$ will show a rough linear decrease with the depth of the model.

Instead, we focus on the following question, ”when is a network stable (by def. 5.2) across the stages of RaPTr?” For simplicity, we consider the special case of linear residual networks. We show that layer normalization layers and the residual connection helps maintain the stability of RaPTr.

Illustrative example: linear networks
We present a more concrete instantiation of Theorem 5.3 for residual network where the layers $f_{1:L}$ are linear with parameters ${\bm{W}}_{1:L}$. The layer output is ${\bm{y}}^{\ell}={\bm{y}}^{(\ell-1)}+{\bm{W}}_{\ell}{\bm{y}}^{(\ell-1)}$ or ${\bm{y}}^{\ell}={\bm{y}}^{(\ell-1)}+{\bm{W}}_{\ell}{\bm{y}}^{(\ell-1)}/\left\|
{\bm{y}}^{(\ell-1)}\right\|_{2}$ depending on whether layernorm is enabled or not respectively .
We also study another setting with layernorm but no residual connection; so ${\bm{y}}^{\ell}={\bm{W}}_{\ell}{\bm{y}}^{(\ell-1)}/\left\|{\bm{y}}^{(\ell-1)}
\right\|_{2}$.

###### Lemma 5.4 .

For $\delta>0$, a finite input set $S$ and dimension $d\geq\Omega(|S|L\log(1/\delta))$, w.p. atleast $1-\delta$ w.r.t. random initialization ${\bm{W}}_{\ell}\sim\mathcal{N}(0,d^{-1/2}{\bm{I}})$, the following holds true for all input ${\bm{x}}\in S$.

- (a)
With residual connection & layernorm, $\Psi_{\ell}({\bm{x}})=\mathcal{O}(\sqrt{L/\ell})$ & $\left\|F({\bm{x}})\right\|_{2}=\Omega(\sqrt{L})$. Then the gap in losses between stages scales as $\mathcal{O}(1/\sqrt{L})$.
- (b)
Without residual connection, $\Psi_{\ell}({\bm{x}})=\Omega(1)$ & $\left\|F({\bm{x}})\right\|_{2}=\mathcal{O}(1)$.
Thus the gap in losses between stages can be $\Omega(1)$.
- (c)
Without layernorm, we have $\Psi_{\ell}({\bm{x}})=\Omega(2^{(L-1)/2})$ and $\left\|F({\bm{x}})\right\|_{2}=\mathcal{O}(2^{L/2})$ .
Thus the gap in losses between stages can be $\Omega(1)$.

In the Appendix, we show similar results for perfectly aligned layers (Lemma H.5). We can consider even more general scenarios, where the layers parameters are expressed as $\tau$-combinations of a Gaussian and a shared matrix (Appendix Fig. 4).
We run simulations and observe that for each $\tau$, the loss gap between a $L-1$ random subnetwork and the full model scales as $\mathcal{O}(L^{-0.4})$.

Figure: Figure 3: (a): Training trajectory of BERT under $4$-stage 6-8-10-12 RaPTr, with the stage transitions (denoted by arrows); (b), (c), (d): Stability study on BERT-Large trained for $50k$ steps by RaPTr with subnetworks of length $L-1$. Behavior of (b) norms of intermediate activations ${\bm{y}}^{(\ell)}$, (c) $\Psi_{\ell}/\Psi_{1}$ (definition 5.2), and (d) Loss gap between different random subnetwork $F_{-\ell}$ and model $F$, given by $\mathcal{L}(F)-\frac{1}{L}\sum_{\ell=1}^{L}\mathcal{L}(F_{-\ell})$. Key observations: (b) Norms of the intermediate activations grow linearly with $\ell$, (c) $\Psi_{\ell}$ changes slowly with $\ell$ as $(\frac{L}{\ell})^{0.12}$, suggesting a worse-case bound of $\mathcal{O}(L^{-0.88})$ on $\mathcal{L}(F)-\frac{1}{L}\sum_{\ell=1}^{L}\mathcal{L}(F_{-\ell})$ based on Theorem 5.3 (d) Interestingly, $\mathcal{L}(F)\leq\frac{1}{L}\sum_{\ell=1}^{L}\mathcal{L}(F_{-\ell})$, even when model is trained with $L-1$ random subnetworks.
Refer to caption: extracted/5923514/Plots/Raptr_train.png

###### Assumption 5.1 (Relative-Lipschitzness) .

###### Definition 5.2 .

###### Theorem 5.3 (Informal, cf theorem H.1 ) .

###### Lemma 5.4 .

## 6 Related works

Here, we focus on the most relevant works. Refer to appendix C for more related works.

Stochastic depth.
RaPTr is similar to stochastic depth, which drops layers with a fixed probability during training to reduce the cost of training deep networks (Huang et al., ). A key distinction is that the probability of dropping layers is fixed during training and can thus be viewed as a regularization (Pham et al., ; Steiner et al., ; Tolstikhin et al., ; Liu et al., ). Fixed stochastic depth has also been used for inference efficiency (Fan et al., ). (Devvrit et al., ; Valipour et al., ) explore nested training for dynamic inference with multiple subnetworks.

Subnetwork training. Training random paths and subnetworks has been used in other contexts, such as parameter-efficient fine-tuning (Houlsby et al., ; Pfeiffer et al., ; Hu et al., ; Liu et al., ) to reduce memory footprint, distributed and federated training (Dun et al., ), and incremental learning (Jathushan et al., ) to avoid forgetting in continual learning. However, these approaches are not aimed at reducing FLOPs during pretraining.

## 7 Limitations, Conclusion and Future Work

We propose a stagewise training framework of *progressive subnetworks* for efficient pretraining, and evaluate a natural instantiation of this framework (RaPTr) based on training random paths/subsets of layers.
Overall RaPTr yields better quality language models than baseline training, while showing a reduction of $1.2-1.33\times$ the total FLOPs.
At the same speedup, it is also better than prior layer dropping and competitive to stacking based approaches.

The current analysis provides insights into loss stability at stage boundaries but does not explain the observed decrease in loss during transitions. Furthermore, schedule selection is not well understood due to expensive compute necessity and deserves more exploration. Our analysis does not explain the role of initial full-model warmup for UL2 and the desirable inductive biases of RaPTr style training, such as better downstream performance and smaller variance. A deeper understanding of these phenomena could lead to the development of more efficient training algorithms.

## Appendix A Broader Impact

Training LLMs demands extensive computational resources and infrastructure. Our paper proposes an algorithm that aims to accelerate their pre-training. Accelerating the training of large language models (LLMs) can significantly reduce their environmental impact by lowering energy consumption and minimizing carbon footprints. Optimizations in algorithms and infrastructure will lead to more efficient use of computational resources and will promote sustainability of the field of AI.

Furthermore, we observe benefits of structured pre-training (simple-to-complex) of these models on downstream tasks. Hopefully, these ideas can lead to better pre-training strategies for LLMs.

Figure: Figure 4: Behavior on a linear residual network with normalization layers with $100$ random samples from $\mathbb{S}^{d-1}$, and dimension $d=100$. The parameters of each layer $\ell$ is represented as $\sqrt{\tau}{\bm{A}}+\sqrt{1-\tau}{\bm{G}}^{(\ell)}$ for a shared matrix ${\bm{A}}\in\mathbb{R}^{d\times d}$ with $\left\|{\bm{A}}\right\|_{2}\leq 1$ and ${\bm{G}}^{(\ell)}\sim\mathcal{N}\left(0,d^{-1/2}{\bm{I}}\right)$. Left to right: Behavior of (a) the norms of intermediate activation ${\bm{y}}^{(\ell)}$ with index $\ell$, (b) $\Psi_{\ell}$ (definition 5.2) for each stack of layers $F_{\ell:L}$, and (c) $\frac{1}{L}\sum_{\ell=1}^{L}\Psi_{\ell}({\bm{x}})/\left\|F({\bm{x}})\right\|_{2}$ that appears in our bounds in theorem 5.3.
Refer to caption: x6.png

## Appendix B More extensive downstream tests on UL2 models

We conduct extensive downstream evaluation of the trained models from table 3 on additional downstream tasks and under higher shot in-context setting. Additional tasks include QA tasks like natural QA (Kwiatkowski et al., ), web QA (Berant et al., ), DROP (Dua et al., ), CoQA (Reddy et al., ), and QuAC (Choi et al., ); and completion tasks like Storyclose (Mostafazadeh et al., ), Hellaswag (Zellers et al., ), and LAMBADA (Paperno et al., ).

## Appendix C Additional related works

Residual networks as ensembles.
Training with random paths can be weakly viewed as ensembles over paths, and the connection between ResNets (He et al., ) and ensembles of shallow networks was first point out in (Veit et al., ) for vision models. (Dong et al., ) showed the same phenomenon for self-attention models, where longer paths lead to rank-collapse in the self-attention module. Chang et al. () study vision transformers (Dosovitskiy et al., ) as a cascade of multiple paths and propose pruning and self-distillation to remove long paths and improve performance. All these works mainly provide a novel perspective or inference efficiency but do not focus on training efficiency.

Learnable scaling of residual blocks. Bachlechner et al. (), Zhang et al. (), Touvron et al. () consider learnable scales on the output of the residual blocks. These works aim to understand favorable initialization of the learnable scales under various constraints for faster training, which is very different from the role of scaling in our algorithm.

##### Early exit for efficient inference

A lot of recent works have focused on improving inference efficiency for large language models.  (Lei et al., ; Tay et al., ; Del Corro et al., ; Xin et al., ; Zhou et al., ; Hou et al., ). However, none of these works focus on efficient fine-tuning. Lei et al. () modified pre-training by substituting resource-intensive MLP computations with straightforward classifiers for a predetermined fraction of tokens within the sequence. It’s worth noting that their primary focus was on accelerating inference time rather than enhancing the efficiency of the pre-training process.

**Table 6: Additional rows from table 3: we compare baseline runs at two learning rate schedules, and run compare RaPTr and Gradual stacking with a new 6-12-18-24 schedule. Key Observations: (a) Cosine decay learning works best for the baseline, compared to Square-root schedule proposed by Tay et al. (), (b) The performance of gradual stacking improves with the new schedule, implying a performance dependence with appropriate scheduling, and (c) RaPTr’s performance doesn’t change much with the new schedule.**
|  | Rel. FLOPs | Eval Loss | Trivia QA | Tydi QA | SQuADv2 | SGLUE | Avg. |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Baseline (Square-root LR decay) | 1.2 | 2.07 | 23.4 | 31.9 | 44.3 | 60.0 | 39.9 |
| Baseline (Cosine LR decay) | 1.2 | 2.06 | 25.0 | 34.4 | 42.1 | 60.0 | 40.4 |
| 6-12-18-24 Stacking | 1 | 2.06 | 22.1 | 34.6 | 38.0 | 60.5 | 38.8 |
| 12-16-20-24 Stacking | 1 | 2.08 | 20.1 | 28.6 | 36.0 | 60.4 | 36.3 |
| 12-16-20-24 RaPTr | 1 | 2.08 | 22.2 | 38.2 | 40.6 | 60.1 | 40.3 |
| (+30k initial full-model train) | 1 | 2.06 | 25.8 | 36.7 | 44.1 | 60.9 | 41.9 |
| 6-12-18-24 RaPTr |  |  |  |  |  |  |  |
| (+30k initial full-model train) | 1 | 2.06 | 24.2 | 37.3 | 42.3 | 61.1 | 41.2 |

Figure: Figure 5: Train and Evaluation Loss behavior for a BERT-Base model trained with RaPTr for 100k steps. We have $4$ stages with 6-8-10-12 schedule (see section 4 for details). The boundaries are at 25k, 50k, and 75k. Key observation: the model’s train and evaluation loss change smoothly across stage transitions, indicating stability of the model to subnetwork training.
Refer to caption: x9.png

## Appendix D Additional Experiment details

### D.1 Details on PLD

The progressive layer dropping algorithm Zhang & He () is given in algorithm 2.
PLD employs a time and depth schedule that determines the probability of dropping each block. The time schedule begins with a zero probability of dropping each block. Then it increases this probability throughout the training process until it reaches a maximum of $(1-\bar{\alpha})$, where the hyperparameter $\bar{\alpha}=0.5$. We vary $\bar{\alpha}$ depending on the average FLOP perplexity we want to achieve in the end. With $\bar{\alpha}=p$, the FLOPs reduce by $1-(p/2)$.

The depth schedule ensures that blocks located earlier in the model are dropped with a lower probability than those located later/deeper. An important hyperparameter of the depth schedule in PLD is $\gamma_{f}$, which controls the rate at which the probability of dropping layers increases. A higher value of $\gamma_{f}$ leads to a quicker increase in the probability. (Zhang & He, ) set $\gamma_{f}$ to 100 in their experiments.

### D.2 Details on variants of gradual stacking

Here, we give the details of the variants of gradual stacking, which we use to compare RaPTr against in table 2. We simply initiate the depth-wise growth operator of each method to compare to RaPTr.

##### bert2BERT

(Chen et al., ) bert2BERT is a stacking based strategy that aims to progressively grow BERT models along width and depth at different stages of training. bert2BERT used progressive stacking (Gong et al., ) to grow the depth of bert models during the course of training. Here, the model’s depth is doubled at each transition phase (e.g. 3 layer BERT $\to$ 6 layer BERT $\to$ 12 layer BERT).

##### MSG

(Yao et al., ) MSG is a stacking based strategy that aims to progressively grow BERT models along $4$ dimensions: width, depth, number of attention heads, and MLP intermediate dimension at different stages of training. The main recipe is a small warm-up during phase transitions, where the model is slowly allowed to grow from its previous configuration to its new one. This is done to preserve the loss during phase transitions. MSG uses gradual stacking to increase the depth of the model, where top few layers are repeated to initialize new models at phase transitions.

##### LEMON

(Wang et al., ) LEMON modified gradual stacking to instead use consecutive stacking. Here, the new layers are put consecutive to the source layers, whose parameters are copied to initialize the new ones. For example, for a schedule that grows a model from $6$ layers to $9$ layers, we choose the top $3$ layers as source layers and insert new layers between layers $(4,5)$, $(5,6)$, $(6,)$ repeating the parameters of layers $4,5,6$ respectively.

##### MSG with layer interpolation

We modify MSG’s depth growth operator to LEMON’s growth opertor. Here, instead of using the top few layers to stack on top of the existing model, we use consecutive stacking to put the newly initialized layers close to their source layers.

Remark: In order to keep the comparisons uniform across the methods, we use the same learning rate schedule as RaPTr across all methods.

### D.3 Details for polynomial training

We present in fig. 2 the results from a 20-layer residual network trained on 100-dimensional data. Our $f^{\star}$ has max degree $k=10$ restricted to the first $t=20$ variables (${\bm{x}}_{1:20}$) in the input. We pick $m=20$ random basis polynomials for each degree $\ell\leq 10$.
We set the average drop rate of PLD to $\bar{\alpha}=0.6$, such that the average FLOPs is $80\%$ lower to a baseline run. For RaPTr, we use $4$-stage training, with the stages represented by its $(p,\mathcal{I})$ as $(8/20,\{\}),(12/20,\{\}),(16/20,\{\}),$ and$(20/20,\{\})$ respectively.
The lengths of each stage have been set such that the average FLOPs is $80\%$ lower to a baseline run (please see appendix E).

### D.4 Details for BERT

##### Equal step Pretraining

The batch-size is set to $256$ and $512$ for BERT-Base and BERT-Large respectively. Following (Reddi et al., ), we use a learning rate warmup of 10k steps and keep learning rate constant in all phases, followed by a linear learning rate decay to 0 0 in the final full model training phase. We set the peak learning rate as $10^{-4}$ in all our experiments.

##### Equivalent flop Pretraining

To make a fair comparison across all methods, we tune the peak the learning rate in the grid $\{1,1.6,2.5,4\}\times 10^{-4}$ for BERT-Base and grid $\{1,1.6\}\times 10^{-4}$ for BERT-Large.

##### Finetuning

We fine-tune BERT models for $3$ epochs with batch-size $32$, using a learning rate grid search over $\{1,2,3,5\}\times 10^{-5}.$ We use a linear warmup schedule over initial $6\%$ training steps, followed by constant learning rate schedule for the rest of the training.

Figure: Algorithm 2 Progressive layer dropping (PLD) Zhang & He ()

#### D.4.1 Additional pretraining experiments

Results at equal FLOPs. Inspired by (Kaddour et al., ), we further compare RaPTr and gradual stacking to baseline training by adjusting the number of training steps of baseline training to match its FLOPs to RaPTr (Table 7).
For BERT-Base, we observe that at shorter FLOP experiments, RaPTr achieves better validation loss compared to baseline training and gradual stacking. This difference gets smaller as we move to larger horizon settings.
Similar findings for BERT-Large.

**Table 7: Equal FLOPs comparisons for BERT-Base and BERT-Large with extensive peak LR tuning. For BERT-Base we use the best performing schedules from table 1. For BERT-Large, we use 6-12-18-24 for both RaPTr and stacking. FLOPs denotes the number of steps involved in baseline training. Key observations: for BERT-Base (a) RaPTr achieves better loss compared to baseline at all FLOP measures, with larger differences for fewer FLOPs. (b) RaPTr has $0.02$ better loss than gradual stacking at all FLOPs. (c) For BERT-Large, stacking and RaPTr are competitive to each other at all FLOPs. Both methods have better loss than baseline at lower FLOPs.**
| Model | FLOPs | Baseline | Stacking | RaPTr |
| --- | --- | --- | --- | --- |
| BERT-Base | $75k$ | 2.09 | 2.02 | 2.01 |
| $170k$ | 1.90 | 1.88 | 1.86 |  |
| $510k$ | 1.74 | 1.75 | 1.73 |  |
| BERT-Large | $62.5k$ | 1.84 | 1.78 | 1.80 |
| $140k$ | 1.63 | 1.60 | 1.61 |  |
| $625k$ | 1.40 | 1.41 | 1.41 |  |

### D.5 Details for UL2

##### Pretraining

Similar to our experiments on BERT, we use a linear warmup of $10$K steps, followed by constant learning rate in all stages, and a cosine decay to $0.1\times$ the peak learning rate in the final full model training stage. The peak learning rate was searched over $\{10^{-2},5\times 10^{-3},2\times 10^{-2},3\times 10^{-2}\}$ and was fixed to $10^{-2}$.

We use Adafactor (Shazeer & Stern, ) optimizer and train with a batch size $512$ for $400k$ steps on a mixture of Arxiv, C4 (Raffel et al., ), Github, and Wikipedia () datasets, with mixing ratios $9\%,57\%,17\%,17\%$ respectively (for a total of 100B tokens). This roughly corresponds to 0.8 epochs of C4.

Reported datasets in table 3 include Trivia QA (Joshi et al., ), Tydi QA (Clark et al., ), SQuADV2 (Rajpurkar et al., ), and SuperGLUE (Wang et al., ). For QA tasks, we report Exact match scores, and report average accuracy for SupreGLUE tasks. To reduce variance, we report average performance across $3$ runs for the most representative setting for each method.

Boundaries for 12-16-20-24 RaPTr and Gradual Stacking are 40k, 120k, and 240k (decided using appendix E). The average subnetwork length used during training turns out to be $20$ with this schedule. When we introduce an initial 30k full-model training for RaPTr, we shift the boundaries by 30k so that the average subnetwork length stays $20$.

#### D.5.1 Additional Pretraining experiments

In table 6, we have the following additional runs compared to table 3 in the main paper.

We first compare Baseline model with cosine decay learning rate to a Baseline model with Square-root learning rate decay that was used in the original paper (Tay et al., ). We observe that the model with square-root learning rate performs significantly worse compared to the model with cosine decay learning rate. Hence, we use model with cosine decay learning rate as our baseline.

Secondly, we try another schedule for Gradual Stacking, which contains 4 stages and is represented by 6-12-18-24. The stage lengths have been adjusted such that the average number of layers used over training is $20$. We set the stage boundaries as 17k, 74k, and 172k respectively. We observe that 6-12-18-24 Gradual Stacking performs much better than 12-16-20-24 Gradual Stacking on various downstream tasks. This signals towards the dependency of Gradual Stacking on proper schedule selection.

On the other hand RaPTr doesn’t show a big difference with 6-12-18-24 schedule, when compared to 12-16-20-24 schedule. A proper analysis of both the methods on schedule dependencies is kept for future work.

## Appendix E Schedule selection

We follow two schedules from Reddi et al. (), Equal and Proportional, to build the lengths of each stage in RaPTr and Stacking. For Equal scheduling, used in Tables 1 and 7, we split training into $k$ equal stages.
For Proportional scheduling in Table 3, we increase the length of a stage in proportion to index of the stage. For example, for 12-16-20-24 RaPTr and Stacking with proportional scheduling for $400k$ training steps, the stage lengths are set as $40k$, $80k$, and $120k$ respectively.

The flop counts are decided on the basis of average subnetwork length during training. For example, if the average subnetwork length is $18$ for a model with $24$ layers, we consider relative flops of RaPTr compared to baseline as $0.75$.

For 12-16-20-24 RaPTr with Equal schedule, the average subnetwork length during training is given by $18$, while for Proportional schedule, the average subnetwork length during training is given by $20$. However, when either Equal and Proportional schedules don’t return the target average subnetwork length, we re-consider the stage lengths by taking the closest candidate among Equal and Proportional schedules and remove equal steps from each of the first $k-1$ stages and add to the final full model training stage. For example, in table 6, with 6-12-18-24 RaPTr and target average subnetwork length $20$, Proportional schedule returns an average subnetwork length of $18$ and stage lengths $40k$, $80k$, $120k$ and $160k$ respectively. We then aim to find $x$ such that stage lengths of $40k-x$, $80k-x$, $120k-x$ and $160k+3x$ returns the desired average subnetwork length. On solving for $x$, we get $x=22k$.

### E.1 Ablation on different schedules for BERT-Base

We conduct experiments on RaPTr with different stage schedules that have same relative flop counts in table 1. We observe on BERT-Base that different schedules differ by atmost $0.01$ in pre-training loss and $0.1-0.5$% in downstream performance on average. Thus, we conclude that RaPTr is robust to the stage schedule selection.

For UL2, we use the following stage schedules to minimize computational overhead. We restrict the number of phases in RaPTr to $4$. The first stage selects a sub-network with half of the layers at random at each step. We increase the sub-network size by an equal quantity in each stage transition, such that we train the full model in the final phase.

**Table 8: Performance of RaPTr on BERT-Base with different schedules. The average subnetwork size for each schedule is $9$, which makes each schedule $1.33$x faster than the baseline model (provided for reference). We use the same hyperparameters as used in table 1. We observe minor differences between different schedules, indicating robustness of RaPTr.**
| RaPTr schedule | Rel. flops | Eval loss | MNLI | QNLI | SST-2 | Avg. |
| --- | --- | --- | --- | --- | --- | --- |
| 3-6-9-12 | 1 | 1.76 | 82.0 | 89.6 | 92.0 | 87.9 |
| 4-8-12 | 1 | 1.76 | 81.9 | 89.3 | 91.5 | 87.6 |
| 6-9-12 | 1 | 1.75 | 82.3 | 89.2 | 91.0 | 88.0 |
| 6-8-10-12 | 1 | 1.75 | 82.1 | 89.8 | 92.4 | 88.1 |
| Baseline | 1.33 | 1.76 | 81.5 | 90.5 | 91.4 | 87.8 |

### E.2 Ablation on fixed layer set ℐ ℐ \mathcal{I} caligraphic_I for BERT-Base

We conduct experiments on 6-8-10-12 RaPTr on BERT-Base with different fixed layer set $\mathcal{I}$ (table 9). We observe that fixed set selection of $\{1,12\}$ performs the best among other candidates. This selection however can be expensive to verify for other settings like UL2. Hence, in all subsequent experiments, we continue with the first and last layer fixed in all stages of RaPTr.

**Table 9: Performance of RaPTr on BERT-Base with different $\mathcal{I}$ set for 6-8-10-12 RaPTr run for $100k$ steps. We use the same hyperparameters as used in table 1, except the training steps reduced to $100k$ steps. We observe that fixing the first and the last layer at all times lead to slightly better performance, compared to other candidates.**
| $\mathcal{I}$ set | Eval loss | MNLI | QNLI | SST-2 | Avg. |
| --- | --- | --- | --- | --- | --- |
| $\{\}$ | 2.12 | - | - | - | - |
| $\{1\}$ | 2.13 | - | - | - | - |
| $\{1,12\}$ | 2.11 | 78.6 | 86.77 | 88.69 | 84.7 |
| $\{1,2,12\}$ | 2.13 | - | - | - | - |
| $\{1,11,12\}$ | 2.12 | 77.4 | 87.0 | 89.4 | 84.6 |
| $\{1,2,11,12\}$ | 2.14 | 78.0 | 86.1 | 88.8 | 84.3 |
| $\{1,2,3,11,12\}$ | 2.18 | 77.4 | 86.5 | 88.4 | 84.1 |
| $\{1,2,10,11,12\}$ | 2.16 | - | - | - | - |

## Appendix F System speed of different subnetworks

We report the speed of training in steps/sec for UL2 models with different subnetwork sizes on a TPU 16x16 chips with percore batch size of $2$ in table 10.
Suppose $t$ is the total time for $400k$ steps with a 24-layer model in UL2 training. In table 3, we use 12-16-20-24 RaPTr that has $20\%$ ”theoretical” flop count reduction, with the stage lengths given by $40k$, $80k$, $120k$, and $240k$ respectively (appendix E). Theoretically, the necessary time required be $0.83t$.
Using the training speed numbers of table 10, it takes approximately $0.84t$ to complete $400k$ steps with RaPTr on our machine, close to the theoretical training time.

**Table 10: Training Steps/sec at different stages on 24-layer UL2**
| subnetwork size | steps/sec |
| --- | --- |
| 12 | 2.0 |
| 16 | 1.6 |
| 20 | 1.4 |
| 24 | 1.1 |

We trained our BERT-base models on $4\times 4$ TPU cores with percore batch size of $8$. We report the speed of training in steps/sec with different subnetwork sizes.

**Table 11: Training Steps/sec at different stages on BERT-base**
| subnetwork size | steps/sec |
| --- | --- |
| 6 | 17.9 |
| 8 | 14.3 |
| 10 | 11.8 |
| 12 | 10.2 |

So, looking at table 7, let $t$ be the total time for completing $675k$ steps in BERT-base training. In the case of a 6-8-10-12 RaPTr with Equal stage lengths, it takes approximately $0.79t$ to complete $675k$ steps on our machine. For an ideal machine that perfectly realizes the theoretical speedups based on the desired flop count reduction, the total time required will be $0.75t$.

## Appendix G Efficient implementation of RaPTr in distributed training

Figure: (a) A representative 3-layer network
Refer to caption: x11.png

##### Issues with distributed training:

RaPTr can be naively implemented with if-else statements that bypass a layer if a layer isn’t part of a random sub-network at a specific time step. This will work with pytorch if we are training with a single GPU. However, if we train a model on multiple GPUs with pytorch, we get the following error.

RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicates that your module has parameters that were not used in producing loss. You can enable unused parameter detection by passing the keyword argument ‘find unused parameters=True’ to ‘torch.nn.parallel.DistributedDataParallel’, and by making sure all ‘forward‘ function outputs participate in calculating loss. Parameter indices which did not receive grad for rank 1: 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 …

We get this error, because the optimizer expects gradients from each trainable model parameter from each GPU at each step of training. We get similar error, when we use jax framework to implement RaPTr.

##### Solution – Layer Selection as Linear Algebraic formulation on Parameters:

Instead of viewing RaPTr as selecting a random sub-network composed of a random selection of layers, we should instead view sub-networks as a set of selected parameters in the Transformer model. All Transformer layers are identical in structure but with different parameters.

Let $f^{(1)},f^{(2)},f^{(3)},\cdots,f^{(L)}$ represent the $L$ Transformer layers with corresponding parameters $\theta^{(1)},\theta^{(2)},\cdots,\theta^{(L)}$. Each of these layers can be expressed as a common Transformer layer $f$, where the parameters $\theta^{(1)},\theta^{(2)},\cdots,\theta^{(L)}$ are used to represent $f^{(1)},f^{(2)},f^{(3)},\cdots,f^{(L)}$, respectively. Furthermore, each layer $f^{i}$ can be represented with parameters $\sum_{j=1}^{L}c_{ij}\theta^{(j)}$, where $c_{ii}=1$ and $c_{ij}=0$ for all $j\neq i$.

We can extend this idea to a sub-network that selects $k$ layers at random from the $L$ Transformer layers. We can maintain a $k$-layer shared sub-network, where shared layer $1\leq\ell\leq k$ uses parameter $\theta^{(\ell)}_{\textrm{sh}}=\sum_{j=1}^{L}c_{\ell,j}\theta^{(j)}$. $c_{\ell,j}$ are fixed depending on the random sub-network of layers that we pick at each step of training. For example, for a sub-network that picks layers $1,2,3,\cdots,k$, $c_{\ell,i}$ is set as $1$ for $i=\ell$ for all $1\leq\ell\leq k$ and 0 0 otherwise. In doing so, all the parameters get gradients in the loss computation at each step of training.

##### Additional FLOPs involved in sub-network selection:

Because we have additional parameter additions to represent sub-networks at each step of training, one might wonder whether the additional FLOPs incurred will lead to drastic slowdown in model training. To do so, we will compare the number of FLOPs necessary for backpropagation for a $k$-random sub-network to the number of FLOPs necessary to compute gradients for a $k$-layer static sub-network used in stacking. The backpropagation step includes a forward pass, a backward pass, and a gradient descent step.

To further simplify our explanation, we will focus on an $L$-layer network that uses linear layers as its Transformer layers with parameters ${\bm{W}}^{(1)},\cdots,{\bm{W}}^{(L)}\in\mathbb{R}^{d\times d}.$ We will focus on Gradient Descent algorithm for simplicity. Batch size is given by $B$.

##### Back-propagation FLOP Computation for a k 𝑘 k italic_k -layer static sub-network:

For simplicity, we will use the first $k$ layer parameters to define the static sub-network. We will refer to the output of each layer $\ell$ as ${\bm{Y}}^{(\ell)}\in\mathbb{R}^{d\times d}.$

- •
Forward pass: For an input ${\bm{Y}}^{(\ell)}\in\mathbb{R}^{B\times d}$, the forward pass involves computing ${\bm{W}}^{(\ell)}{\bm{y}}^{(\ell)}_{i}$ for each ${\bm{y}}^{(\ell)}_{i}\in{\bm{Y}}^{(\ell)}$, for each layer $\ell\in[k]$. Thus, the number of FLOPs involved is $kBd^{2}$.
- •
Backward pass: On gradient ${\bm{G}}^{(\ell)}\in\mathbb{R}^{B\times d}$ back-propagating to a layer $\ell$, the backward pass computes the gradient w.r.t. the parameter ${\bm{W}}^{(\ell)}$ and the gradient that flows to the next layer.
The gradient w.r.t. the weight is given as $\frac{1}{B}\sum_{i=1}^{B}{\bm{g}}_{i}^{(\ell)}({\bm{x}}_{i}^{(\ell)})^{\top}$. This involves $Bd^{2}$ computation, and overall a $kBd^{2}$ computation for all weights.
Furthermore, the gradient to be back-propagated beyond layer $\ell$ is given as
$\left[{\bm{g}}_{1}^{(\ell)}({\bm{W}}^{(\ell)})^{\top},\cdots{\bm{g}}_{i}^{(
\ell)}({\bm{W}}^{(\ell)})^{\top},\cdots,{\bm{g}}_{B}^{(\ell)}({\bm{W}}^{(\ell)
})^{\top}\right]$, which incurs an additional $Bd^{2}$ computation. Overall, a $kBd^{2}$ computation across all layers.
- •
Gradient Descent step: Finally, the descent step is a simple addition of negative gradients to each weight, which requires $kd^{2}$ for all weights.

##### Back-propagation FLOP Computation for a k 𝑘 k italic_k -layer random sub-network:

For a randomly picked sub-network, we will use ${\bm{W}}^{(\ell)}_{\textrm{sh}}=\sum_{j=1}^{L}c_{\ell,j}{\bm{W}}^{(j)}$ to denote the parameters of the $k-$layer shared sub-network that we use to perform back-propagation at particular step.

- •
Forward pass: Our proposed method requires an additional sum of weights in each layer, with the coefficients $c_{\ell,j}$ for $1\leq\ell\leq k,1\leq j\leq L$ in the forward pass. Hence, the total FLOP computation involved is $kBd^{2}+kLd^{2}$.
- •
Backward pass: Here, there are no changes for backpropagation through the $k$-layer shared network, as the gradients are computed and backpropagated w.r.t. ${\bm{W}}^{(\ell)}_{\textrm{sh}}$.
- •
Gradient Descent step: Here, the gradients need to be distributed to the weight parameters ${\bm{W}}^{(\ell)}$ before taking the descent step.
$\displaystyle\nabla{\bm{W}}^{(\ell)}=\sum_{i=1}^{k}c_{i,\ell}\nabla{\bm{W}}^{(
\ell)}_{\textrm{sh}}.$
This requires $kLd^{2}$ computation, in addition to the necessary gradient descent steps.

Thus, the relative FLOPs of backpropagating through a $k$-layer random sub-network to a $k$-layer static sub-network (used in stacking) is

$$ $\displaystyle\frac{2kBd^{2}+kd^{2}+2kLd^{2}}{2kBd^{2}+kd^{2}}=1+\frac{2L}{2B+1}.$ $$

With $B$ set high, this relative FLOPs gap is close to $1$.

##### Discussion for language models:

For language models, the batch size represents the number of tokens that pass through the layer during backpropagation. In our UL2 experiments, sequences were of length $512$ and the number of sequences in each minibatch was set as $2$. Hence, the effective batch size is $B=512\times 2=1024$. The number of layers $L$ in our UL2 setting is $24$. Hence, the relative FLOPs of backpropagating through a $k$-layer random network compared to a $k$-layer static network (used in stacking) would be $\approx(48/(2048+1)+1)=1.02$ if we had used the same minibatch for our linear network setting.

Remark: When training large models, we can structure the selection of random sub-networks to minimize the performance overhead associated with random sampling. For instance, if we are training a $100$-layer network and wish to train a random sub-network of $50$ layers at a given step, rather than selecting $50$ layers arbitrarily from the entire model, we can organize the layers into $10$ groups, each containing $10$ layers. Then, we create a $50$-layer shared sub-network, where each shared layer is a linear combination of $10$ layer parameters from a specific group. This approach reduces the computational overhead associated with combining parameters from $50\times 10\times d^{2}$ to $5\times 10\times d^{2}$.

## Appendix H Noise stability for transformers

###### Theorem H.1 .

Suppose $\mathcal{L}$ satisfies the following condition $\mathcal{L}$ satisfies the following condition for any input $\tilde{{\bm{x}}},\eta\in\mathbb{R}^{d}$ and label ${\bm{v}}\in\{0,1\}^{V}$ for some constant $\mu_{loss}$ :

$$ $\displaystyle\mathcal{L}(\tilde{{\bm{x}}}+\eta\left\|\tilde{{\bm{x}}}\right\|, {\bm{v}})-\mathcal{L}(\tilde{{\bm{x}}},{\bm{v}})\leq\mu_{\mathcal{L}}\left\| \eta\right\|_{2}.$ (2) $$

The difference between expected loss of $(L-1)$-RaPTr and $L$-RaPTr, i.e. $|\mathcal{L}_{2}(F)-\mathcal{L}_{1}(F)|$, is upper bounded by $\frac{C}{L}\mathbb{E}_{{\bm{x}}\in D}(\sum_{\ell=1}^{L}\Psi_{\ell}({\bm{x}}))/
\left\|F({\bm{x}})\right\|_{2}$
for some constant $C$ that depends on regularity properties of the head $H$ on top of the backbone $F$.

###### Proof of theorem 5.3 .

Denote by $F_{-\ell}$ the $L$ candidates that we can randomly choose from during $L-1$ RaPTr training. The output of $F_{-\ell}$ on any input ${\bm{x}}$ is equivalent to the output of the model $F$ on ${\bm{x}}$ and $\alpha_{1:L}$, with $\alpha_{\ell}=0$ and the rest set to $1$.

Then, the average loss of $L-1$ random training is given by

$$ $\displaystyle\mathcal{L}_{2}(F)=\frac{1}{L}\sum_{i=1}^{L}\mathbb{E}_{{\bm{x}}, {\bm{y}}\sim D}\mathcal{L}\left(F_{-\ell}({\bm{x}}),{\bm{v}}\right).$ $$

On the other hand, the loss of the full model is given by

$$ $\displaystyle\mathcal{L}_{1}(F)=\mathbb{E}_{{\bm{x}},{\bm{v}}\sim D}\mathcal{L }\left(F({\bm{x}}),{\bm{v}}\right).$ $$

Hence, the expected difference between loss of $L-1$ random training and full model is given by

$$ $\displaystyle\mathcal{L}_{2}(F)-\mathcal{L}_{1}(F)$ $\displaystyle=\frac{1}{L}\sum_{i=1}^{L}\mathbb{E}_{{\bm{x}},{\bm{v}}\sim D} \left(\mathcal{L}\left(F_{-\ell}({\bm{x}}),{\bm{v}}\right)-\mathcal{L}\left(F( {\bm{x}}),{\bm{v}}\right)\right)$ $\displaystyle\leq\frac{1}{L}\sum_{i=1}^{L}\mathbb{E}_{{\bm{x}},{\bm{v}}\sim D} \quad\mu_{\mathcal{L}}\frac{\left\|F_{-\ell}({\bm{x}})-F({\bm{x}})\right\|_{2} }{\left\|F({\bm{x}})\right\|_{2}}$ $\displaystyle\leq\frac{1}{L}\sum_{i=1}^{L}\mathbb{E}_{{\bm{x}},{\bm{v}}\sim D} \quad\mu_{\mathcal{L}}\frac{\psi_{\ell}}{\left\|F({\bm{x}})\right\|_{2}}.$ $$

Here the pre-final step uses the definition of $\mu_{\mathcal{L}}$ from eq. 2, and the final step uses the definition of $\Psi_{\ell}$ from definition 5.2.
∎

###### Theorem H.1 .

###### Proof of theorem 5.3 .

##### Discussion

An example of a loss function with bounded $\mu_{\mathcal{L}}$ is a transformer model, that uses a layer normalization layer before using an embedding matrix $\Phi$ to compute the logits. The logits are then compared with the true label with a cross-entropy loss with a softmax function on logits. $\psi(\mathcal{L})$ hence depends on the $\ell_{2}$ norm of $\Phi$ and the weight parameters of the layer normalization layer.

### H.1 Noise stability of linear residual networks

#### H.1.1 Useful lemmas

To prove, we will require the following theorem (and its variaions). For random initialization, we use ${\bm{W}}_{1},\cdots,{\bm{W}}_{L}\sim\mathcal{N}(0,d^{-1}).$

###### Lemma H.2 (Norm of the output of linear layers at initialization) .

Consider the case of a linear network with no residual connections and layernorm, i.e.

$$ $\displaystyle{\bm{y}}^{(\ell)}={\bm{W}}_{\ell}{\bm{y}}^{(\ell-1)},\text{ for all }\ell\geq 1,$ $$

with ${\bm{y}}^{(0)}={\bm{x}}$.

For an input ${\bm{x}}$, any $\varepsilon\geq 0$, with probability at least $1-Le^{-\Omega\left(d\varepsilon^{2}/L^{2}\right)}$ over the randomness of ${\bm{W}}_{1},\cdots,{\bm{W}}_{L}$, we have

$$ $\left\|{\bm{y}}^{(\ell)}\right\|_{2}\in[1-\varepsilon,1+\varepsilon]\quad\text {for all}\ell\geq 1.$ $$

###### Proof.

Because ${\bm{W}}_{\ell}$ is gaussian, ${\bm{y}}^{(\ell)}={\bm{W}}_{\ell}{\bm{y}}^{(\ell-1)}$ follows $\mathcal{N}(0,\left\|{\bm{y}}^{(\ell-1)}\right\|_{2}^{2}/d)$. Thus, $\{({\bm{y}}^{(\ell)}_{i})^{2}\}_{i=1}^{d}$ follow a Chi-squared distribution, with $\mathbb{E}\left\|{\bm{y}}^{(\ell)}\right\|_{2}^{2}=\mathbb{E}\sum_{i=1}^{d}({
\bm{y}}^{(\ell)}_{i})^{2}$ given by $\left\|{\bm{y}}^{(\ell-1)}\right\|_{2}^{2}$. The proof then follows from applying concentration bounds on the norm of gaussian vectors (Formula 3.7, Vershynin ()), i.e. for any $\varepsilon\geq 0$,

$$ $\displaystyle\Pr\left(\left|\left\|{\bm{y}}^{(\ell)}\right\|_{2}-\left\|{\bm{y }}^{(\ell-1)}\right\|_{2}\right|\geq\varepsilon\left\|{\bm{y}}^{(\ell-1)} \right\|_{2}\right)\leq e^{-\Omega(d\varepsilon^{2})}.$ $$

We apply a union bound over all layers, to get the final bound.
∎

###### Corollary H.3 (Norm of the output of linear layers with residual connections at initialization) .

Consider the case of a linear network with residual connections but no layernorm, i.e.

$$ $\displaystyle{\bm{y}}^{(\ell)}={\bm{y}}^{(\ell-1)}+{\bm{W}}_{\ell}{\bm{y}}^{( \ell-1)},\text{ for all }\ell\geq 1,$ $$

with ${\bm{y}}^{(0)}={\bm{x}}$.

For an input ${\bm{x}}$, any $\varepsilon\geq 0$, with probability at least $1-Le^{-\Omega\left(d\varepsilon^{2}/L^{2}\right)}$ over the randomness of ${\bm{W}}_{1},\cdots,{\bm{W}}_{L}$, we have

$$ $\left\|{\bm{y}}^{(\ell)}\right\|_{2}\in[2^{\ell/2}(1-\varepsilon),2^{\ell/2}(1 +\varepsilon)]\quad\text{for all }\ell\geq 1.$ $$

###### Proof.

The proof follows similar to H.2. W.h.p., we can show that
for any $\varepsilon\geq 0$,

$$ $\displaystyle\Pr\left(\left\|{\bm{W}}_{\ell}{\bm{y}}^{(\ell-1)}\right\|_{2}- \left\|{\bm{y}}^{(\ell-1)}\right\|_{2}\geq\varepsilon\right)\leq e^{-\Omega(d \varepsilon^{2}/L^{2})}.$ $$

The only remaining piece is to show that ${\bm{y}}^{(\ell-1)}$ and ${\bm{W}}_{\ell}{\bm{y}}^{(\ell-1)}$ are roughly orthogonal. First of all, $\mathbb{E}({\bm{y}}^{(\ell-1)})^{\top}{\bm{W}}_{\ell}{\bm{y}}^{(\ell-1)}=0$ because ${\bm{W}}_{\ell}$ is concentrated around 0 0. Furthermore, $\mathbb{E}(({\bm{y}}^{(\ell-1)})^{\top}{\bm{W}}_{\ell}{\bm{y}}^{(\ell-1)})^{2}
=\sum_{i,j}w_{\ell,i,j}^{2}({\bm{y}}^{(\ell-1)}_{i})^{2}({\bm{y}}^{(\ell-1)}_{
j})^{2}=\frac{1}{d}\left\|{\bm{y}}^{(\ell-1)}\right\|^{4}$. Thus, using Hanson wright inequality (theorem 6.2.1, Vershynin ()), we have w.p. atleast

$$ $\displaystyle\Pr[\left|({\bm{y}}^{(\ell-1)})^{\top}{\bm{W}}_{\ell}{\bm{y}}^{( \ell-1)}\right|\geq\varepsilon\left\|{\bm{y}}^{(\ell-1)}\right\|^{2}]\leq e^{- \Omega(d\varepsilon^{2})}.$ $$

We apply a union bound over all layers, to get the final bound.

∎

###### Corollary H.4 (Norm of the output of linear layers with residual connections at initialization) .

Consider the case of a linear network with residual connections and layer-normalization, i.e.

$$ $\displaystyle{\bm{y}}^{(\ell)}={\bm{y}}^{(\ell-1)}+{\bm{W}}_{\ell}{\bm{y}}^{( \ell-1)}/\left\|{\bm{y}}^{(\ell-1)}\right\|_{2},\text{ for all}\ell\geq 1,$ $$

with ${\bm{y}}^{(0)}={\bm{x}}$.

For an input ${\bm{x}}$, any $\varepsilon\geq 0$, with probability at least $1-Le^{-\Omega\left(d\varepsilon^{2}/L^{2}\right)}$ over the randomness of ${\bm{W}}_{1},\cdots,{\bm{W}}_{L}$, we have

$$ $\left\|{\bm{y}}^{(\ell)}\right\|_{2}\in[\sqrt{\ell+1}(1-\epsilon),\sqrt{\ell+1 }(1+\epsilon)]\quad\text{for all }\ell\geq 1.$ $$

###### Proof.

The proof stays extremely similar to H.3. For simplicity, we simply refer to H.3 for any such variations.
∎

###### Lemma H.2 (Norm of the output of linear layers at initialization) .

###### Proof.

###### Corollary H.3 (Norm of the output of linear layers with residual connections at initialization) .

###### Proof.

###### Corollary H.4 (Norm of the output of linear layers with residual connections at initialization) .

###### Proof.

#### H.1.2 Proofs of lemma 5.4

###### Proof of lemma 5.4 .

We outline the proof for each case.

- 1.
With residual connection and layer normalization, the function $F$ computes the intermediate activations ${\bm{y}}^{(1)},\cdots,{\bm{y}}^{(L)}$ on an input ${\bm{x}}$ as follows.
$\displaystyle{\bm{y}}^{(\ell)}=\left({\bm{I}}+\frac{{\bm{W}}_{\ell}}{\left\|{
\bm{y}}^{(\ell-1)}\right\|}\right){\bm{y}}^{(\ell-1)}.$
By corollary H.4, we can show w.h.p. with respect to the randomness of ${\bm{W}}_{1},\cdots,{\bm{W}}_{L}$, for all $\ell\leq L$, $\sqrt{\ell}(1-\mathcal{O}(1))\leq\left\|{\bm{y}}^{(\ell)}\right\|_{2}\leq\sqrt
{\ell}(1+\mathcal{O}(1)).$
Ignoring the error terms, we can simply write
$\displaystyle{\bm{y}}^{(\ell)}=\left({\bm{I}}+\frac{{\bm{W}}_{\ell}}{\sqrt{
\ell}}\right){\bm{y}}^{(\ell-1)}.$
Pick a general layer $\ell$ to be dropped. Then,
$\displaystyle F_{-\ell}({\bm{x}})-F({\bm{x}})=\prod_{\ell^{\prime}=\ell+1}^{L}
\left(1+\frac{{\bm{W}}_{\ell^{\prime}}}{\sqrt{\ell^{\prime}}}\right)\frac{{\bm
{W}}_{\ell}}{\sqrt{\ell}}{\bm{y}}^{(\ell-1)}+err,$
where the $err$ term appears because of the change in scales of activations ${\bm{y}}^{(\ell+1)},\cdots,{\bm{y}}^{(L)}$ with the dropping of layer $\ell$. This error can be bounded as $\mathcal{O}(\sqrt{L}/\ell)$ using the same procedure followed below to bound the first term on R.H.S..
Similar to bounding the norms of ${\bm{y}}^{(\ell)}$, w.h.p. we can show that
$\displaystyle\left\|\prod_{\ell^{\prime}=\ell+1}^{L}\left(1+\frac{{\bm{W}}_{
\ell^{\prime}}}{\sqrt{\ell^{\prime}}}\right)\frac{{\bm{W}}_{\ell}}{\sqrt{\ell}
}{\bm{y}}^{(\ell-1)}\right\|_{2}\leq\sqrt{\frac{L}{\ell}}.$
Hence,
$\displaystyle\psi_{\ell}:=\left\|F_{-\ell}({\bm{x}})-F_{\ell}({\bm{x}})\right
\|_{2}\leq\mathcal{O}(\sqrt{L/\ell}).$
This implies
$\displaystyle\frac{1}{L}\sum_{\ell}\psi_{\ell}({\bm{x}})=\frac{1}{L}\sum_{\ell
}\mathcal{O}(\sqrt{L/\ell})=\mathcal{O}(1).$
We then apply a union over all ${\bm{x}}\in S$ such that the above condition holds true for all inputs in set $S$.
Since the gap in $\mathcal{L}_{2}$ and $\mathcal{L}_{1}$ is bounded by $\mathcal{O}(\mathbb{E}_{{\bm{x}}}\frac{1}{L}\sum_{\ell}\psi_{\ell}({\bm{x}})/|
|F({\bm{x}})||)$ from theorem 5.3, we have the gap as $\mathbf{O}\left(\frac{1}{\sqrt{L}}\right)$.
- 2.
With no normalization, the function $F$ looks as follows.
$\displaystyle{\bm{y}}^{(\ell)}=\left({\bm{I}}+{\bm{W}}_{\ell}\right){\bm{y}}^{
(\ell-1)}.$
By corollary H.3,
we can show w.h.p. with respect to the randomness of ${\bm{W}}_{1},\cdots,{\bm{W}}_{L}$, for all $\ell\leq L$, $2^{\ell/2}(1-\mathcal{O}(1))\leq\left\|{\bm{y}}^{(\ell)}\right\|_{2}\leq 2^{
\ell/2}(1+\mathcal{O}(1)).$
With a drop in layer, we get
$\displaystyle F_{-\ell}({\bm{x}})-F({\bm{x}})=\prod_{\ell^{\prime}=\ell+1}^{L}
\left({\bm{I}}+{\bm{W}}^{\ell^{\prime}}\right){\bm{W}}_{\ell}\prod_{\ell^{
\prime}=1}^{\ell-1}\left({\bm{I}}+{\bm{W}}^{\ell^{\prime}}\right){\bm{x}}.$
Similar to corollary H.3,
we can show w.h.p. with respect to the randomness of ${\bm{W}}_{1},\cdots,{\bm{W}}_{L}$,
$\left\|\prod_{\ell^{\prime}=\ell+1}^{L}\left({\bm{I}}+{\bm{W}}^{\ell^{\prime}}
\right){\bm{W}}_{\ell}\prod_{\ell^{\prime}=1}^{\ell-1}\left({\bm{I}}+{\bm{W}}^
{\ell^{\prime}}\right){\bm{x}}\right\|_{2}\geq\mathcal{O}(2^{(\ell-1)/2}).$
This implies $\left\|F_{-\ell}({\bm{x}})-F({\bm{x}})\right\|_{2}=\Omega(2^{(\ell-1)/2}).$
- 3.
Without residual connection, the function $F$ looks as follows.
$\displaystyle{\bm{y}}^{(\ell)}={\bm{W}}_{\ell}\frac{{\bm{y}}^{(\ell-1)}}{\left
\|{\bm{y}}^{(\ell-1)}\right\|_{2}}.$
Similar to corollary H.4,
we can show w.h.p. with respect to the randomness of ${\bm{W}}_{1},\cdots,{\bm{W}}_{L}$, for all $\ell\leq L$, $(1-\mathcal{O}(1))\leq\left\|{\bm{y}}^{(\ell)}\right\|_{2}\leq(1+\mathcal{O}(1
)).$ Thus, ignoring error terms, the
network $F$ roughly looks like
$\displaystyle{\bm{y}}^{(\ell)}={\bm{W}}_{\ell}{\bm{y}}^{(\ell-1)}.$
With a drop in layer, we get
$\displaystyle F_{-\ell}({\bm{x}})-F({\bm{x}})=\prod_{\ell^{\prime}=\ell+1}^{L}
{\bm{W}}_{\ell^{\prime}}({\bm{W}}^{(\ell)}-{\bm{I}})\prod_{\ell^{\prime}=1}^{
\ell-1}{\bm{W}}_{\ell^{\prime}}{\bm{x}}.$
Using randomness of ${\bm{W}}^{(\ell)}$ this can be shown to be of norm $\Omega(1)$.

∎

###### Lemma H.5 .

When the layers are perfectly aligned, i.e. all weights ${\bm{W}}_{i}={\bm{A}}$ for some matrix ${\bm{A}}$ with $\left\|{\bm{A}}\right\|_{2}=1$ and for simplicity, assume second eigenvalue $\lambda_{2}({\bm{A}})=1-\delta$ for some $\delta>0$, we have

- (a)
With residual connection & layernorm, we have $\Psi_{\ell}({\bm{x}})=\mathcal{O}(1)$ and $\left\|F({\bm{x}})\right\|=\Omega(L)$. Thus, the gap in losses between stages is $\mathcal{O}(1/L)$.
- (b)
Without residual connection, we have both $\Psi_{\ell}({\bm{x}})=\mathcal{O}(\delta^{-1}e^{-\ell})$ and $\left\|F({\bm{x}})\right\|=\mathcal{O}(1)$. Thus the gap in losses between stages is $\mathcal{O}(\frac{1}{L})$.
- (c)
Without layernorm, we have $\Psi_{\ell}({\bm{x}})=\Omega(2^{L-1})$ and $\left\|F({\bm{x}})\right\|=\mathcal{O}(2^{L})$ . Thus the gap in losses between stages can be $\Omega(1)$.

###### Proof of lemma H.5 .

We outline the proof for each case.

- 1.
With residual connection & layernorm, the function $F$ computes the intermediate activations ${\bm{y}}^{(1)},\cdots,{\bm{y}}^{(L)}$ on an input ${\bm{x}}$ as follows.
$\displaystyle{\bm{y}}^{(\ell)}=\left({\bm{I}}+\frac{{\bm{A}}}{\left\|{\bm{y}}^
{(\ell-1)}\right\|}\right){\bm{y}}^{(\ell-1)}.$
We show that the above method will behave like power method, i.e. ${\bm{y}}^{(\ell)}$ will be of magnitude $\Omega(\ell)$ and will be $\varepsilon$-close in angle to the top eigenvector of ${\bm{A}}$, denoted as ${\bm{v}}_{1}({\bm{A}})$, provided $\ell\geq\Omega((1/\delta)\log(1/\varepsilon)).$
We give an inductive argument as follows. Consider any layer $\ell$. Say $\theta_{\ell}$ denotes the angle between ${\bm{y}}^{(\ell)}$ and ${\bm{v}}_{1}({\bm{A}})$. Also, say $\Pi^{\perp}_{{\bm{v}}1}$ denotes an orthogonal projection to subspace spanned by the rest of the eigenvectors of ${\bm{A}}$. Then,
$\displaystyle\left|\tan\theta_{\ell+1}\right|$
$\displaystyle=\frac{\left|\langle{\bm{v}}_{1}({\bm{A}}),{\bm{y}}^{(\ell+1)}
\rangle\right|}{\left\|\Pi^{\perp}_{{\bm{v}}1}({\bm{y}}^{(\ell+1)})\right\|_{2}}$
$\displaystyle=\frac{\left|\langle{\bm{v}}_{1}({\bm{A}}),{\bm{y}}^{(\ell)}
\rangle+\langle{\bm{v}}_{1}({\bm{A}}),{\bm{A}}{\bm{y}}^{(\ell)}\rangle\right|}
{\left\|\Pi^{\perp}_{{\bm{v}}1}({\bm{y}}^{(\ell)})+\Pi^{\perp}_{{\bm{v}}1}{\bm
{A}}{\bm{y}}^{(\ell)}\right\|_{2}}$
$\displaystyle=\frac{2\left|\langle{\bm{v}}_{1}({\bm{A}}),{\bm{y}}^{(\ell)}
\rangle\right|}{\left\|\Pi^{\perp}_{{\bm{v}}1}({\bm{y}}^{(\ell)})+\Pi^{\perp}_
{{\bm{v}}1}{\bm{A}}{\bm{y}}^{(\ell)}\right\|_{2}}$
$\displaystyle\leq\frac{2\langle{\bm{v}}_{1}({\bm{A}}),{\bm{y}}^{(\ell)}\rangle
}{\left\|\Pi^{\perp}_{{\bm{v}}1}({\bm{y}}^{(\ell)})+\lambda_{2}({\bm{A}})\Pi^{
\perp}_{{\bm{v}}1}{\bm{y}}^{(\ell)}\right\|_{2}}$
$\displaystyle=\frac{2}{1+\lambda_{2}({\bm{A}})}\left|\tan\theta_{\ell}\right|.$
This implies, under $\lambda_{2}({\bm{A}})<1$, $\left|\tan\theta_{\ell}\right|$ decreases with $\ell$. Under the assumption that ${\bm{x}}$ isn’t orthogonal to ${\bm{v}}_{1}({\bm{A}})$, the above condition simply shows that if $\ell\geq\mathcal{O}((1/\delta)\log(1/\varepsilon))$, than $\left|\tan\theta_{\ell}\right|<\varepsilon$.
Furthermore, once aligned (or closely aligned) to ${\bm{v}}_{1}({\bm{A}})$, the norm of ${\bm{y}}^{(\ell)}$ grows linearly. Hence, $\left\|{\bm{y}}^{(\ell)}\right\|=\Omega(L)$. Furthermore, for any $\ell$, the gap between $F_{-\ell}$ and $F_{\ell}$ simply becomes equal to the gap between $L$ and $L-1$ steps of the modified power method, which can be bounded as $\mathcal{O}(1).$
- 2.
With no residual connection, the function $F$ computes the intermediate activations ${\bm{y}}^{(1)},\cdots,{\bm{y}}^{(L)}$ on an input ${\bm{x}}$ as follows.
$\displaystyle{\bm{y}}^{(\ell)}=\frac{{\bm{A}}}{\left\|{\bm{y}}^{(\ell-1)}
\right\|}{\bm{y}}^{(\ell-1)}.$
From the update, it’s trivial to come to the conclusion that ${\bm{y}}^{(\ell)}$ will stay unit norm for any layer $\ell$.
This update is exactly power-method, where ${\bm{y}}^{(\ell)}$ gets $\varepsilon$-close to the top eigenvector direction of ${\bm{A}}$ in $\mathcal{O}((1/\delta)\log(1/\varepsilon))$ steps. The result then follows from bounding the gap between $L$ and $L-1$ steps of power-method.
- 3.
The proof is very similar to the proof of lemma 5.4 (3), where the major difference comes from the blowup in the norms of the intermediate activations.

∎

###### Proof of lemma 5.4 .

###### Lemma H.5 .

###### Proof of lemma H.5 .

## Appendix I RaPTr motivation with boolean data: Theory

##### Data and labels:

We use uniformly sampled boolean data ${\bm{x}}\sim\mathcal{U}(\{\pm 1\}^{d})$. The true label function $f^{*}:\mathbb{R}^{d}\to\mathbb{R}$ for each data is given as

$$ $\displaystyle f^{*}({\bm{x}})=\frac{\sqrt{3}}{2}+\frac{\sqrt{3}}{2}x_{1}-x_{1} x_{2}.$ $$

##### Network to train:

We train a 2-layer residual network $f_{p_{0},{\bm{w}}_{1},{\bm{w}}_{2},b_{1},b_{2}}:\mathbb{R}^{d}\to\mathbb{R}$ comprised of two single neuron residual blocks, where $p_{0}$ behaves as a position bias that we add to the output of the first block. On an input ${\bm{x}}$, the network computes output $y\in\mathbb{R}$ with intermediate output $y^{(1)},y^{(2)}\in\mathbb{R}$ as follows.

$$ $\displaystyle y^{(1)}$ $\displaystyle=p_{0}+\sin(\langle{\bm{w}}_{1},{\bm{x}}\rangle+b_{1}),$ $\displaystyle y^{(2)}$ $\displaystyle=y^{(1)}+\sin(\langle{\bm{w}}_{2},{\bm{x}}\rangle+y^{(1)}+b_{2}).$ (3) $$

Here $y:=y^{(2)}$ is returned as the final output. The network is trained with mean squared error, given by

$$ $\displaystyle\mathcal{L}=\mathbb{E}_{{\bm{x}}\sim\mathcal{U}(\{\pm 1\}^{d})}(y -f^{*}({\bm{x}}))^{2}.$ (4) $$

We consider population gradients for the sake of clean exposition of the important ideas. Interested readers can modify the proof to work for finite sample regimes.

##### Initialization of weights and biases:

The elements of the weights and biases ${\bm{w}}_{1},{\bm{w}}_{2},$ $p_{0},b_{1},b_{2}$ have been initialized from all 0 0s.

##### RaPTr Initial position bias training:

In the initial bias phase training, we simply train the bias $p_{0}$, i.e. at each step, we train with the following mean squared loss,

$$ $\displaystyle\mathcal{L}=\mathbb{E}_{{\bm{x}}\sim\mathcal{U}(\{\pm 1\}^{d})}(p _{0}-f^{*}({\bm{x}}))^{2}.$ (5) $$

##### RaPTr First phase training:

In the first phase, both the layers are trained independently. That is, at each step, we pick a random layer $\ell\in\{1,2\}$ and train with the mean squared loss, given by

$$ $\displaystyle\mathcal{L}=\mathbb{E}_{{\bm{x}}\sim\mathcal{U}(\{\pm 1\}^{d})}(p _{0}+\sin(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b_{\ell})-f^{*}({\bm{x}}))^{2}.$ (6) $$

##### RaPTr Second phase training:

In the second phase of training, we train the full model (eq. 3) with the mean squared loss (eq. 4). For simplicity, we fix the parameters of the first layer and simply train the parameters ${\bm{w}}_{2},b_{2}$.

We first recall the theorem corresponding to the stage-wise training of RaPTr.

###### Theorem I.1 .

For a small enough learning rate $\eta<\frac{1}{poly(d)},$ under parameter initialization from all 0 0s, an initial position bias only training, followed by a $2$-stage RaPTr on the network $f_{p_{0},{\bm{w}}_{1},{\bm{w}}_{2},b_{1},b_{2}}$ (eq. 3) with mean squared error shows the following behavior.

- •
After $\Theta(1/\eta)$ steps of position bias only training and $\Theta(1/\eta)$ steps of first phase, for both layers $\ell\in\{1,2\}$,
$\displaystyle\left|p_{0}+\sin(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b_{\ell})
-\frac{\sqrt{3}}{2}-\frac{\sqrt{3}}{2}x_{1}\right|\leq\mathcal{O}(\eta).$
- •
After $\Theta(1/\eta)$ steps of second phase, the ouput of the second layer is given as
$\displaystyle\left|y^{(2)}-y^{(1)}-(-x_{1}x_{2})\right|:=\left|\sin(\langle{
\bm{w}}_{2},{\bm{x}}\rangle+y^{(1)}+p_{0}+b_{2})-(-x_{1}x_{2})\right|\leq
\mathcal{O}(\eta).$

Hence, after $\Theta(1/\eta)$ steps of initial position bias and 2-phase RaPTr training, loss $\mathcal{L}<\mathcal{O}(\eta)$ (4) .

###### Proof.

The proof proceeds by analyzing the behavior of the weights and the biases in the different phases.

- •
In the initial position bias only training, we show that in $\Theta(1/\eta)$ steps,
$\displaystyle\left|p_{0}-\sqrt{3}/2\right|\leq\mathcal{O}(\eta).$
- •
In the first phase, after $\Theta(\eta\log(d/\eta))$ steps, we show in lemma I.4 that for any layer $\ell\in\{1,2\}$, the weights and the biases satisfy the following conditions.
$\displaystyle\left|w_{\ell,1}-\frac{\pi}{3}\right|\leq\mathcal{O}(\eta),$
$\displaystyle\left|w_{\ell,j}\right|\leq\mathcal{O}(\eta),\text{ for all }2
\leq j\leq d,$
$\displaystyle\left|b_{\ell}\right|\leq\mathcal{O}(\eta).$
Hence, after first phase of training, the network’s intermediate outputs $y^{(1)}$ and $y^{(2)}$ (from eq. 3) are given as
$\displaystyle y^{(1)}$
$\displaystyle=p_{0}+\sin(\langle{\bm{w}}_{1},{\bm{x}}\rangle+b_{1})=\frac{
\sqrt{3}}{2}+\frac{\sqrt{3}}{2}x_{1}+\mathcal{O}(\eta),$
$\displaystyle y^{(2)}$
$\displaystyle=y^{(1)}+\sin(\langle{\bm{w}}_{2},{\bm{x}}\rangle+y^{(1)}+p_{0}+b
_{2})$
$\displaystyle=\frac{\sqrt{3}}{2}+\frac{\sqrt{3}}{2}x_{1}+\sin(\langle{\bm{w}}_
{2},{\bm{x}}\rangle+\sqrt{3}/2x_{1}+\sqrt{3}/2+b_{2})+\mathcal{O}(\eta).$
- •
In the second phase, after $\Theta(1/\eta)$ steps, we show in lemma I.5 that the weights and the biases ${\bm{w}}_{2},b_{2}$ satisfy the following conditions.
$\displaystyle\left|w_{2,1}+\sqrt{3}/2-\frac{\pi}{2}\right|\leq\mathcal{O}(\eta),$
$\displaystyle\left|w_{2,2}-\frac{\pi}{2}\right|\leq\mathcal{O}(\eta),$
$\displaystyle\left|b_{2}+p_{0}-\frac{\pi}{2}\right|\leq\mathcal{O}(\eta),$
$\displaystyle\left|w_{2,j}\right|\leq\mathcal{O}(\eta),\text{ for }3\leq j\leq
d.$
Thus, at the end of the second phase, the network’s output $y:=y^{(2)}$ (from eq. 3) is given as
$\displaystyle y^{(2)}$
$\displaystyle=y^{(1)}+\sin(\langle{\bm{w}}_{2},{\bm{x}}\rangle+y^{(1)}+p_{0}+b
_{2})$
$\displaystyle=\frac{\sqrt{3}}{2}+\frac{\sqrt{3}}{2}x_{1}+\sin(\langle{\bm{w}}_
{2},{\bm{x}}\rangle+\sqrt{3}/2x_{1}+\sqrt{3}/2+b_{2})+\mathcal{O}(\eta)$
$\displaystyle=\frac{\sqrt{3}}{2}+\frac{\sqrt{3}}{2}x_{1}+\sin(\frac{\pi}{2}x_{
1}+\frac{\pi}{2}x_{2}+\frac{\pi}{2})+\mathcal{O}(\eta)=\frac{\sqrt{3}}{2}+
\frac{\sqrt{3}}{2}x_{1}-x_{1}x_{2}+\mathcal{O}(\eta).$

∎

Furthermore, we can show that each layer in itself isn’t expressive enough to represent the true label function.

###### Theorem I.2 .

For each layer when trained independently, the best ${\bm{w}}_{\ell},{\bm{b}}_{\ell}$ parameters will have an $\Omega(1)$ error.

###### Proof.

The proof of the theorem is simple. We argue for the first layer (same argument holds for the second layer). We simply calculate the projection of the function learned by ${\bm{w}}_{1},{\bm{b}}_{1}$ into the components of the true label function. Suppose the function define dby them is given by $\alpha x_{1}+\beta x_{1}x_{2}$

Then, using orthogonality of the basis polynomials $x_{1}$ and $x_{1}x_{2}$, we have

$$ $\displaystyle\alpha=$ $\displaystyle\mathbb{E}_{{\bm{x}}\in\{\pm 1\}^{d}}\sin(\langle{\bm{w}}_{1},{ \bm{x}}\rangle+b)x_{1}$ $\displaystyle=\mathbb{E}_{{\bm{x}}\in\{\pm 1\}^{d}}\sin(\pi/2-\langle{\bm{w}}_ {1},{\bm{x}}\rangle-b)x_{1}$ $\displaystyle=\sin(b)(\prod_{i\neq 1}\cos w_{i})\sin(w_{1}).$ Using corollary I.9 $$

$$ $\displaystyle\beta=$ $\displaystyle\mathbb{E}_{{\bm{x}}\in\{\pm 1\}^{d}}\sin(\langle{\bm{w}}_{1},{ \bm{x}}\rangle+b)x_{1}x_{2}$ $\displaystyle=\mathbb{E}_{{\bm{x}}\in\{\pm 1\}^{d}}\sin(\pi/2-\langle{\bm{w}}_ {1},{\bm{x}}\rangle-b)x_{1}x_{2}$ $\displaystyle=-\cos(b)(\prod_{i\neq 1,2}\cos w_{i})\sin(w_{1})\sin(w_{2}).$ Using corollary I.9 $$

Adding/Subtracting these terms, we get

$$ $\displaystyle\alpha-\beta$ $\displaystyle=\sin(b+w_{2})(\prod_{i\neq 1,2}\cos w_{i}),$ $\displaystyle\alpha+\beta$ $\displaystyle=\sin(b-w_{2})(\prod_{i\neq 1,2}\cos w_{i}),$ $\displaystyle-\alpha+\beta$ $\displaystyle=\sin(-b+w_{2})(\prod_{i\neq 1,2}\cos w_{i}),$ $\displaystyle-\alpha-\beta$ $\displaystyle=\sin(-b-w_{2})(\prod_{i\neq 1,2}\cos w_{i})$ $$

Thus, we must be restricted by the set $|\alpha|,|\beta|<1,|\alpha|+|\beta|<1$. As the coefficients of the true label function don’t lie in this set, the proof follows.
∎

###### Theorem I.1 .

###### Proof.

###### Theorem I.2 .

###### Proof.

### I.1 Analysis of the different phases

Initial position bias only training linearly increases $p_{0}$ to $\sqrt{3}/2$.

###### Lemma I.3 .

[Position bias only training]
For any learning rate $\eta>0$, after $\Theta(1/\eta)$ steps, $p_{0}$ satisfies

$$ $\displaystyle\left|p_{0}-\sqrt{3}/2\right|\leq\mathcal{O}(\eta).$ $$

The first lemma analyses the behavior of the weights during phase 1.

###### Lemma I.4 .

[Phase 1 of RaPTr]
For a small enough learning rate $\eta<\frac{1}{poly(d)},$ with position bias $p_{0}$ at $\sqrt{3}/2+\mathcal{O}(\eta)$, and under parameter from all 0 0s, after $\Theta(1/\eta)$ steps, for any layer $\ell\in\{1,2\}$, the weights and the biases satisfy the following conditions.

$$ $\displaystyle\left|w_{\ell,1}-\frac{\pi}{3}\right|\leq\mathcal{O}(\eta),$ $\displaystyle\left|w_{\ell,j}\right|\leq\mathcal{O}(\eta),\text{ for all }2 \leq j\leq d,$ $\displaystyle\left|b_{\ell}\right|\leq\mathcal{O}(\eta).$ $$

The second lemma analyses the behavior of the second layer weights in phase 2.

###### Lemma I.5 .

[Phase 2 of RaPTr]
For a small enough learning rate $\eta<\frac{1}{poly(d)},$ starting from the weights and biases reached by $\Theta(1/\eta)$ steps of position bias only and first phase of RaPTr training (lemmas I.4 and I.3), after $\Theta(1/\eta)$ steps of second phase of RaPTr training, the weights and biases ${\bm{w}}_{2}$ and $b_{2}$ satisfy the following conditions.

$$ $\displaystyle\left|w_{2,1}+\sqrt{3}/2-\frac{\pi}{2}\right|\leq\mathcal{O}(\eta),$ $\displaystyle\left|w_{2,2}-\frac{\pi}{2}\right|\leq\mathcal{O}(\eta),$ $\displaystyle\left|b_{2}+\sqrt{3}/2-\frac{\pi}{2}\right|\leq\mathcal{O}(\eta),$ $\displaystyle\left|w_{2,j}\right|\leq\mathcal{O}(\eta),\text{ for }3\leq j\leq d.$ $$

###### Lemma I.3 .

###### Lemma I.4 .

###### Lemma I.5 .

#### I.1.1 Proof of lemma I.3

See I.3

###### Proof.

Under all 0 0s initialization, the output of both of the layers is 0 0. Thus, the gradient of $p_{0}$ is given by

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\left(p_{0}-\frac{ \sqrt{3}}{2}-\frac{\sqrt{3}}{2}x_{1}+x_{1}x_{2}\right)=p_{0}-\frac{\sqrt{3}}{2}.$ $$

Hence, $p_{0}$ increases up until it reaches $\sqrt{3}/2+\mathcal{O}(\eta)$.
∎

###### Proof.

#### I.1.2 Proof of lemma I.4

See I.4

###### Proof.

Similar to the proof of lemma I.3, we can show that the position bias $p_{0}$ stays $\mathcal{O}(\eta)$ close to $\sqrt{3}/2$. Thus, for simplicity of exposition, we simply assume it without formally proving so.

With the first stage of RaPTr, we only keep one of the two layers during training. Hence, both the layer parameters train similarly during training. Without loss of generality, we discuss for a single layer weights $\ell\in\{1,2\}$.

###### Proof.

##### General formulation for gradient w.r.t weights:

The population gradients of ${\bm{w}}_{\ell}$ is given by

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\left(p_{0}+\sin( \langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b_{\ell})-\frac{\sqrt{3}}{2}-\frac{ \sqrt{3}}{2}x_{1}+x_{1}x_{2}\right)\cdot\cos(\langle{\bm{w}}_{\ell},{\bm{x}} \rangle+b_{\ell})\cdot{\bm{x}}$ $\displaystyle=\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\sin(\langle{\bm{w }}_{\ell},{\bm{x}}\rangle+b_{\ell})\cdot\cos(\langle{\bm{w}}_{\ell},{\bm{x}} \rangle+b_{\ell})\cdot{\bm{x}}-\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ } \left(\frac{\sqrt{3}}{2}x_{1}-x_{1}x_{2}\right)\cdot\cos(\langle{\bm{w}}_{\ell },{\bm{x}}\rangle+b_{\ell})\cdot{\bm{x}}$ $\displaystyle+\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\left(p_{0}-\frac{\sqrt{3} }{2}\right)\cdot\cos(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b_{\ell})\cdot{\bm {x}}.$ $$

We will argue about the contributions of the three terms separately.

###### Lemma I.6 (Contribution of Term 1) .

For any coordinate $j\in[d]$,

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\sin(\langle{\bm{w} }_{\ell},{\bm{x}}\rangle+b_{\ell})\cdot\cos(\langle{\bm{w}}_{\ell},{\bm{x}} \rangle+b_{\ell})x_{j}$ $\displaystyle=\frac{1}{2}\cos(2b_{\ell})\left(\prod_{i=1\to d,i\neq j}\cos(2w_ {\ell,i})\right)\sin(2w_{\ell,j}).$ $$

###### Proof.

Term 1 in the gradients is given as

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\sin(\langle{\bm{w} }_{\ell},{\bm{x}}\rangle+b_{\ell})\cdot\cos(\langle{\bm{w}}_{\ell},{\bm{x}} \rangle+b_{\ell})\cdot{\bm{x}}$ $\displaystyle=\frac{1}{2}\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\sin(2 \langle{\bm{w}}_{\ell},{\bm{x}}\rangle+2b_{\ell})\cdot{\bm{x}}.$ $$

Consider a coordinate $j\in[d]$. The gradient concerning the coordinate is given as

$$ $\displaystyle\frac{1}{2}\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\sin(2 \langle{\bm{w}}_{\ell},{\bm{x}}\rangle+2b_{\ell})x_{j}$ $\displaystyle=\frac{1}{2}\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\sin \left(2\sum_{i=1\to d,i\neq j}w_{\ell,i}x_{i}+2w_{\ell,j}x_{j}+2b_{\ell}\right )x_{j}$ $\displaystyle=\frac{1}{2}\cos(2b_{\ell})\left(\prod_{i=1\to d,i\neq j}\cos(2w_ {\ell,i})\right)\sin(2w_{\ell,j}),$ $$

using lemma I.7.
∎

###### Lemma I.6 (Contribution of Term 1) .

###### Proof.

##### Contribution of Term 2:

Term 2 in the gradients is given as

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\left(\frac{\sqrt{3 }}{2}x_{1}-x_{1}x_{2}\right)\cdot\cos(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b _{\ell})\cdot{\bm{x}}.$ $$

Consider the coordinate $i=1$. The gradient concerning the coordinate is given as

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\left(\frac{\sqrt{3 }}{2}x_{1}-x_{1}x_{2}\right)\cdot\cos(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b _{\ell})x_{1}$ $\displaystyle=\frac{\sqrt{3}}{2}\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\cos( \langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b_{\ell})-\mathbb{E}_{{\bm{x}}\sim\{-1, +1\}^{d}}x_{2}\cos(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b_{\ell})$ Replace $x_{1}^{2}$ by $1$ $\displaystyle=\frac{\sqrt{3}}{2}\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\cos( \langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b_{\ell})+\sin(b_{\ell})\left(\prod_{i= 1\to d,i\neq 2}\cos(w_{\ell,i})\right)\sin(w_{\ell,2})$ Simplified second term with lemma I.8 $\displaystyle=\frac{\sqrt{3}}{2}\cos(b_{\ell})\left(\prod_{i=1\to d}\cos(w_{ \ell,i})\right)+\sin(b_{\ell})\left(\prod_{i=1\to d,i\neq 2}\cos(w_{\ell,i}) \right)\sin(w_{\ell,2}).$ Simplified first term with corollary I.9 $$

Consider the coordinate $i=2$. The gradient concerning the coordinate is given as

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\left(\frac{\sqrt{3 }}{2}x_{1}-x_{1}x_{2}\right)\cdot\cos(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b _{\ell})x_{2}$ $\displaystyle=\frac{\sqrt{3}}{2}\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\cos( \langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b_{\ell})x_{1}x_{2}-\mathbb{E}_{{\bm{x} }\sim\{-1,+1\}^{d}}x_{1}\cos(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b_{\ell})$ Replace $x_{2}^{2}$ by $1$ $\displaystyle=-\frac{\sqrt{3}}{2}\cos(b_{\ell})\left(\prod_{i=1\to d,i\notin\{ 1,2\}}\cos(w_{\ell,i})\right)\left(\prod_{j\in\{1,2\}}\sin(w_{\ell,j})\right)+ \sin(b_{\ell})\left(\prod_{i=1\to d,i\neq 1}\cos(w_{\ell,i})\right)\sin(w_{ \ell,1}).$ Using corollary I.9 $$

For any other coordinate $t\notin\{1,2\}$, we have

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\left(\frac{\sqrt{3 }}{2}x_{1}-x_{1}x_{2}\right)\cdot\cos(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b _{\ell})x_{t}$ $\displaystyle=\frac{\sqrt{3}}{2}\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\cos( \langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b_{\ell})x_{1}x_{t}-\mathbb{E}_{{\bm{x} }\sim\{-1,+1\}^{d}}x_{1}x_{2}x_{t}\cos(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle+ b_{\ell})$ $\displaystyle=-\frac{\sqrt{3}}{2}\cos(b_{\ell})\left(\prod_{i=1\to d,i\notin\{ 1,t\}}\cos(w_{\ell,i})\right)\left(\prod_{j\in\{1,t\}}\sin(w_{\ell,j})\right)$ $\displaystyle-\sin(b_{\ell})\left(\prod_{i=1\to d,i\notin\{1,2,t\}}\cos(w_{ \ell,i})\right)\left(\prod_{j\in\{1,2,t\}}\sin(w_{\ell,j})\right).$ Using corollary I.9 $$

##### Contribution of Term 3:

For any coordinate $j\in[d]$,

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\left(p_{0}-\frac{ \sqrt{3}}{2}\right)\cdot\cos(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b_{\ell})x _{j}$ $\displaystyle=-\left(p_{0}-\frac{\sqrt{3}}{2}\right)\sin(b_{\ell})\left(\prod_ {i=1\to d,i\neq j}\cos(w_{\ell,i})\right)\sin(w_{\ell,j})$ $\displaystyle=\mathcal{O}(\eta),$ $$

where the pre-final step follows from using corollary I.9 and the final step follows since $\left|p_{0}-\frac{\sqrt{3}}{2}\right|=\mathcal{O}(\eta)$ from the initial bias training phase.

Thus, the combination of the 3 terms gives

$$ $\displaystyle\nabla w_{\ell,1}$ $\displaystyle=-\frac{\sqrt{3}}{2}\cos(b_{\ell})\left(\prod_{i=1\to d}\cos(w_{ \ell,i})\right)-\sin(b_{\ell})\left(\prod_{i=1\to d,i\neq 2}\cos(w_{\ell,i}) \right)\sin(w_{\ell,2})$ $\displaystyle+\frac{1}{2}\cos(2b_{\ell})\left(\prod_{i=1\to d,i\neq 1}\cos(2w_ {\ell,i})\right)\sin(2w_{\ell,1})+\mathcal{O}(\eta)$ (7) $$

$$ $\displaystyle\nabla w_{\ell,2}$ $\displaystyle=\frac{\sqrt{3}}{2}\cos(b_{\ell})\left(\prod_{i=1\to d,i\notin\{1 ,2\}}\cos(w_{\ell,i})\right)\left(\prod_{j\in\{1,2\}}\sin(w_{\ell,j})\right)- \sin(b_{\ell})\left(\prod_{i=1\to d,i\neq 1}\cos(w_{\ell,i})\right)\sin(w_{ \ell,1})$ $\displaystyle+\frac{1}{2}\cos(2b_{\ell})\left(\prod_{i=1\to d,i\neq 2}\cos(2w_ {\ell,i})\right)\sin(2w_{\ell,2})+\mathcal{O}(\eta)$ (8) $$

For $t\notin\{1,2\}$,

$$ $\displaystyle\nabla w_{\ell,t}$ $\displaystyle=\frac{\sqrt{3}}{2}\cos(b_{\ell})\left(\prod_{i=1\to d,i\notin\{1 ,t\}}\cos(w_{\ell,i})\right)\left(\prod_{j\in\{1,t\}}\sin(w_{\ell,j})\right)$ $\displaystyle+\sin(b_{\ell})\left(\prod_{i=1\to d,i\notin\{1,2,t\}}\cos(w_{ \ell,i})\right)\left(\prod_{j\in\{1,2,t\}}\sin(w_{\ell,j})\right)$ $\displaystyle+\frac{1}{2}\cos(2b_{\ell})\left(\prod_{i=1\to d,i\neq t}\cos(2w_ {\ell,i})\right)\sin(2w_{\ell,t})+\mathcal{O}(\eta)$ (9) $$

##### General formulation for gradient w.r.t bias:

Following a similar approach as the weights, the population gradients of $b_{\ell}$ is given by

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\left(\sin(\langle{ \bm{w}}_{\ell},{\bm{x}}\rangle+b_{\ell})-\frac{\sqrt{3}}{2}-\frac{\sqrt{3}}{2} x_{1}+x_{1}x_{2}\right)\cdot\cos(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b_{ \ell})$ $\displaystyle=\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\sin(\langle{\bm{w }}_{\ell},{\bm{x}}\rangle+b_{\ell})\cos(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle +b_{\ell})$ $\displaystyle-\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\left(\frac{\sqrt{3}}{2}x_ {1}-x_{1}x_{2}\right)\cos(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b_{\ell})$ $\displaystyle+\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\left(p_{0}-\frac{\sqrt{3} }{2}\right)\cos(\langle{\bm{w}}_{\ell},{\bm{x}}\rangle+b_{\ell})$ $$

Following similar approach as above, the terms can be simplified as

$$ $\displaystyle\frac{1}{2}\sin(2b_{\ell})\left(\prod_{i=1\to d}\cos(2w_{\ell,i})\right)$ (10) $\displaystyle+\frac{\sqrt{3}}{2}\sin(b_{\ell})\left(\prod_{i=1\to d,i\neq 1} \cos(w_{\ell,i})\right)\sin(w_{\ell,1})$ $\displaystyle-\cos(b_{\ell})\left(\prod_{i=1\to d,i\notin\{1,2\}}\cos(w_{\ell, i})\right)\left(\prod_{j\in\{1,2\}}\sin(w_{\ell,j})\right)+\mathcal{O}(\eta).$ (11) $$

##### Behavior of gradients at initialization:

Since the coordinates of ${\bm{w}}_{\ell}$ and biases ${\bm{b}}_{\ell}$ are initialized from 0 0s, we have for all $j$,

$$ $\displaystyle\sin(b_{\ell})=0,\quad\sin(w_{\ell,j})=0,\quad\cos(w_{\ell,j})=1, \quad\cos(b_{\ell})=1.$ (12) $$

Furthermore, recall that $p_{0}=\sqrt{3}/2+\mathcal{O}(\eta)$ after the initial bias training phase.

Using the above, we can simplify the gradients from eqs. 7, 8, 9 and 11

$$ $\displaystyle\nabla w_{\ell,1}$ $\displaystyle=-\frac{\sqrt{3}}{2}+\mathcal{O}(\eta),$ (13) $\displaystyle\nabla w_{\ell,t}$ $\displaystyle=\mathcal{O}(\eta),\quad t\neq 1$ (14) $\displaystyle\nabla b_{\ell}$ $\displaystyle=\mathcal{O}(\eta),$ (15) $$

Hence, we observe three kinds of behavior at initialization.

- 1.
First coordinate of the weight grows by atleast
$\displaystyle w_{\ell,1}\leftarrow w_{\ell,1}+\frac{\eta\sqrt{3}}{2}+\mathcal{
O}(\eta^{2}).$
- 2.
Other coordinates of the weight get only $\mathcal{O}(\eta^{2})$ updates.
$\displaystyle w_{\ell,j}\leftarrow w_{\ell,j}+\mathcal{O}(\eta^{2}).$
- 3.
The magnitude of the bias drops as well.
$\displaystyle b_{\ell}\leftarrow b_{\ell}+\mathcal{O}(\eta^{2}).$

##### Beyond Initialization:

Due to increasing magnitude of $w_{\ell,1}$, the behavior of the gradients changes slightly from Equations 15, 13, 14 and 15. However, assuming that the weight coordinates $[2,d]$ and the biases are smaller than $\mathcal{O}(\eta)$, we can still give similar formulations as before using eq. 12 using the following inequalities for all $j\neq 1$.

$$ $\displaystyle\sin(b_{\ell})=\mathcal{O}(\eta),\quad\sin(w_{\ell,j})=1-\mathcal {O}(\eta).$ $$

We state them directly.

$$ $\displaystyle\nabla w_{\ell,1}$ $\displaystyle=-\frac{\sqrt{3}}{2}\cos(b_{\ell})\left(\prod_{i=1\to d}\cos(w_{ \ell,i})\right)-\sin(b_{\ell})\left(\prod_{i=1\to d,i\neq 2}\cos(w_{\ell,i}) \right)\sin(w_{\ell,2})$ $\displaystyle+\frac{1}{2}\cos(2b_{\ell})\left(\prod_{i=1\to d,i\neq 1}\cos(2w_ {\ell,i})\right)\sin(2w_{\ell,1})+\mathcal{O}(\eta)$ $\displaystyle=\left(1-\mathcal{O}(\eta)\right)^{d}\left(\sin(w_{\ell,1})-\frac {\sqrt{3}}{2}\right)+\mathcal{O}(\eta)\leq\frac{1}{2}\left(\sin(w_{\ell,1})- \frac{\sqrt{3}}{2}\right)+\mathcal{O}(\eta),$ (16) $$

for $\eta\leq 1/poly(d).$

$$ $\displaystyle\nabla w_{\ell,2}$ $\displaystyle=\frac{\sqrt{3}}{2}\cos(b_{\ell})\left(\prod_{i=1\to d,i\notin\{1 ,2\}}\cos(w_{\ell,i})\right)\left(\prod_{j\in\{1,2\}}\sin(w_{\ell,j})\right)- \sin(b_{\ell})\left(\prod_{i=1\to d,i\neq 1}\cos(w_{\ell,i})\right)\sin(w_{ \ell,1})$ $\displaystyle+\frac{1}{2}\cos(2b_{\ell})\left(\prod_{i=1\to d,i\neq 2}\cos(2w_ {\ell,i})\right)\sin(2w_{\ell,2})+\mathcal{O}(\eta)$ $\displaystyle=\mathcal{O}(\eta).$ (17) $$

For any $t\notin\{1,2\}$,

$$ $\displaystyle\nabla w_{\ell,j}$ $\displaystyle=\frac{\sqrt{3}}{2}\cos(b_{\ell})\left(\prod_{i=1\to d,i\notin\{1 ,t\}}\cos(w_{\ell,i})\right)\left(\prod_{j\in\{1,t\}}\sin(w_{\ell,j})\right)$ $\displaystyle+\sin(b_{\ell})\left(\prod_{i=1\to d,i\notin\{1,2,t\}}\cos(w_{ \ell,i})\right)\left(\prod_{j\in\{1,2,t\}}\sin(w_{\ell,j})\right)$ $\displaystyle+\frac{1}{2}\cos(2b_{\ell})\left(\prod_{i=1\to d,i\neq t}\cos(2w_ {\ell,i})\right)\sin(2w_{\ell,t})+\mathcal{O}(\eta),$ $\displaystyle=\mathcal{O}(\eta).$ (18) $$

And finally for the bias,

$$ $\displaystyle\nabla b_{\ell}$ $\displaystyle=\frac{1}{2}\sin(2b_{\ell})\left(\prod_{i=1\to d}\cos(2w_{\ell,i} )\right)+\frac{\sqrt{3}}{2}\sin(b_{\ell})\left(\prod_{i=1\to d,i\neq 1}\cos(w_ {\ell,i})\right)\sin(w_{\ell,1})$ $\displaystyle-\cos(b_{\ell})\left(\prod_{i=1\to d,i\notin\{1,2\}}\cos(w_{\ell, i})\right)\left(\prod_{j\in\{1,2\}}\sin(w_{\ell,j})\right)+\mathcal{O}(\eta)$ (19) $\displaystyle=\mathcal{O}(\eta).$ (20) $$

Thus, we observe three properties.

- •
First coordinate of the weight grows until $\sin(w_{\ell,1})=\frac{\sqrt{3}}{2}$ or $w_{\ell,1}$ reaches $\pi/3$,
$\displaystyle w_{\ell,1}\leftarrow w_{\ell,1}+\frac{\eta}{2}\left(\frac{\sqrt{
3}}{2}-\sin(w_{\ell,1})\right)+\mathcal{O}(\eta^{2}).$
Thus, in $\Theta(1/\eta)$ steps, $w_{\ell,1}$ can reach arbitrarily close to $\pi/3$.
- •
Any other coordinate $t\neq 1$ still receives $\mathcal{O}(\eta^{2})$ updates as
$\displaystyle w_{\ell,t}\leftarrow w_{\ell,t}+\mathcal{O}(\eta^{2}).$
Hence, in $\Theta(1/\eta)$ steps, $w_{\ell,t}$ can only reach $\mathcal{O}(\eta)$ magnitude.
- •
$b_{\ell}$ also receives $\mathcal{O}(\eta^{2})$ updates as
$\displaystyle b_{\ell}\leftarrow b_{\ell}+\mathcal{O}(\eta^{2}).$
Hence, in $\Theta(1/\eta)$ steps, $b_{\ell}$ can only reach $\mathcal{O}(\eta)$ magnitude.

∎

#### I.1.3 Proof of lemma I.5

See I.5

###### Proof.

The proof follows along similar lines as lemma I.4.

###### Proof.

##### First layer output:

At the end of the first phase training, the weights ${\bm{w}}_{1},{\bm{w}}_{2}$ and the biases look as follows. For $\ell\in\{1,2\}$,

$$ $\displaystyle\left|w_{\ell,1}-\frac{\pi}{3}\right|\leq\mathcal{O}(\eta),\left| w_{\ell,j}\right|\leq\mathcal{O}(\eta),\text{ for all }j\geq 2,\left|b_{\ell} \right|\leq\mathcal{O}(\eta),$ $$

and $\left|p_{0}-\frac{\sqrt{3}}{2}\right|\leq\mathcal{O}(\eta).$

Hence, using a Taylor expansion, the output of the first layer is given as (for simplicity, we denote it as $o^{(1)}$)

$$ $\displaystyle o^{(1)}:=\sin(\langle{\bm{w}}_{1},{\bm{x}}\rangle+b_{1})=\frac{ \sqrt{3}}{2}x_{1}+\mathcal{O}(\eta).$ (21) $$

##### Second layer output:

The output of the second layer is now given by (for simplicity, we denote it as $o^{(2)}$)

$$ $\displaystyle o^{(2)}:=\sin\left(\langle{\bm{w}}_{2},{\bm{x}}\rangle+o^{(1)}+p _{0}+b_{2}\right)$ $\displaystyle=\sin\left(\langle{\bm{w}}_{2},{\bm{x}}\rangle+\sin(\langle{\bm{w }}_{1},{\bm{x}}\rangle+b_{1})+p_{0}+b_{2}\right)$ $\displaystyle=\sin\left(\langle{\bm{w}}_{2},{\bm{x}}\rangle+\left(\frac{\sqrt{ 3}}{2}x_{1}+\mathcal{O}(\eta)\right)+(\sqrt{3}/2+\mathcal{O}(\eta))+b_{2}\right)$ $\displaystyle=\sin\left(\langle{\bm{w}}_{2},{\bm{x}}\rangle+\frac{\sqrt{3}}{2} x_{1}+\sqrt{3}/2+b_{2}\right)+\mathcal{O}(\eta)$ With Taylor expansion $\displaystyle=\sin\left((w_{2,1}+\sqrt{3}/2)x_{1}+\sum_{j=2}^{d}w_{2,j}x_{j}+ \sqrt{3}/2+b_{2}\right)+\mathcal{O}(\eta).$ $$

For brevity, we will use new notations to represent the coefficients of $x_{1},\cdots,x_{d}$ in the above formulation.

$$ $\displaystyle\tilde{w}_{1}$ $\displaystyle=w_{2,1}+\sqrt{3}/2,$ $\displaystyle\tilde{w}_{j}$ $\displaystyle=w_{2,j},\text{ for }j\geq 2,$ $\displaystyle\tilde{b}$ $\displaystyle=\sqrt{3}/2+b_{2}.$ $$

At initialization, their corresponding values are

$$ $\displaystyle\tilde{w}_{1}$ $\displaystyle=\frac{\pi}{3}+\sqrt{3}/2+\mathcal{O}(\eta),$ $\displaystyle\tilde{w}_{j}$ $\displaystyle=\mathcal{O}(\eta),\text{ for all }j\geq 2$ $\displaystyle\tilde{b}$ $\displaystyle=\frac{\sqrt{3}}{2}+\mathcal{O}(\eta).$ (22) $$

Then, the above formulation is given as

$$ $\displaystyle o^{(2)}=\sin\left(\langle\tilde{{\bm{w}}},{\bm{x}}\rangle+\tilde {b}\right)+\mathcal{O}(\eta).$ (23) $$

##### General formulation for population gradients:

The gradients w.r.t. the weight ${\bm{w}}_{2}$ and $b_{2}$ are given as

$$ $\displaystyle\nabla{\bm{w}}_{2}$ $\displaystyle=\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\left(o^{(1)}+o^{(2)}- \frac{\sqrt{3}}{2}x_{1}+x_{1}x_{2}\right)\cos\left(\langle\tilde{{\bm{w}}},{ \bm{x}}\rangle+\tilde{b}\right){\bm{x}}+\mathcal{O}(\eta).$ $\displaystyle\nabla b_{2}$ $\displaystyle=\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\left(o^{(1)}+o^{(2)}- \frac{\sqrt{3}}{2}x_{1}+x_{1}x_{2}\right)\cos\left(\langle\tilde{{\bm{w}}},{ \bm{x}}\rangle+\tilde{b}\right)+\mathcal{O}(\eta).$ $$

We will consider the first two terms in the above gradient formulations and add the error term later.

First of all, we observe that

$$ $\displaystyle o^{(1)}+o^{(2)}-\frac{\sqrt{3}}{2}x_{1}+x_{1}x_{2}$ $\displaystyle=\sin\left(\langle\tilde{{\bm{w}}},{\bm{x}}\rangle+\tilde{b} \right)+x_{1}x_{2}+\mathcal{O}(\eta).$ $$

We have the gradients w.r.t. ${\bm{w}}_{2}$ as

$$ $\displaystyle\nabla{\bm{w}}_{2}$ $\displaystyle=\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\sin\left(\langle\tilde{{ \bm{w}}},{\bm{x}}\rangle+\tilde{b}\right)\cos\left(\langle\tilde{{\bm{w}}},{ \bm{x}}\rangle+\tilde{b}\right){\bm{x}}$ $\displaystyle+\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}x_{1}x_{2}\cos\left( \langle\tilde{{\bm{w}}},{\bm{x}}\rangle+\tilde{b}\right){\bm{x}}$ $\displaystyle+\mathcal{O}(\eta).$ $$

We treat the two terms separately.

###### Contribution of Term 1

: Using a similar strategy as lemma I.6, for any coordinate $t\in[d]$,

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\sin\left(\langle\tilde{{ \bm{w}}},{\bm{x}}\rangle+\tilde{b}\right)\cos\left(\langle\tilde{{\bm{w}}},{ \bm{x}}\rangle+\tilde{b}\right)x_{t}$ $\displaystyle=\frac{1}{2}\cos(2\tilde{b})\left(\prod_{i=1\to d,i\neq t}\cos(2 \tilde{w}_{i})\right)\sin(2\tilde{w}_{t}).$ $$

###### Contribution of Term 2:

For coordinate $t=2$,

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}x_{1}x_{2}\cos\left(\langle \tilde{{\bm{w}}},{\bm{x}}\rangle+\tilde{b}\right)x_{2}$ $\displaystyle=\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\cos\left(\langle\tilde{{ \bm{w}}},{\bm{x}}\rangle+\tilde{b}\right)x_{1}$ Replace $x_{2}^{2}$ by 1 $\displaystyle=-\sin(\tilde{b})\left(\prod_{i=1\to d,i\neq 1}\cos(\tilde{w}_{i} )\right)\sin(\tilde{w}_{1}).$ Using corollary I.9 $$

For coordinate $t=1$,

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}x_{1}x_{2}\cos\left(\langle \tilde{{\bm{w}}},{\bm{x}}\rangle+\tilde{b}\right)x_{1}$ $\displaystyle=\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\cos\left(\langle\tilde{{ \bm{w}}},{\bm{x}}\rangle+\tilde{b}\right)x_{2}$ Replace $x_{1}^{2}$ by 1 $\displaystyle=-\sin(\tilde{b})\left(\prod_{i=1\to d,i\neq 2}\cos(\tilde{w}_{i} )\right)\sin(\tilde{w}_{2}).$ Using corollary I.9 $$

For any other coordinate $t\notin\{1,2\}$,

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\cos\left(\langle\tilde{{ \bm{w}}},{\bm{x}}\rangle+\tilde{b}\right)x_{1}x_{2}x_{t}$ $\displaystyle=\sin(\tilde{b})\left(\prod_{i=1\to d,i\notin\{1,2,t\}}\cos( \tilde{w}_{i})\right)\left(\prod_{i\notin\{1,2,t\}}\sin(\tilde{w}_{t})\right).$ Using corollary I.9 $$

##### Combination of all terms:

For coordinate $t=1$,

$$ $\displaystyle\nabla w_{2,1}=$ $\displaystyle\frac{1}{2}\cos(2\tilde{b})\left(\prod_{i=1\to d,i\neq 1}\cos(2 \tilde{w}_{i})\right)\sin(2\tilde{w}_{1})-\sin(\tilde{b})\left(\prod_{i=1\to d ,i\neq 2}\cos(\tilde{w}_{i})\right)\sin(\tilde{w}_{2})+\mathcal{O}(\eta).$ (24) $$

For coordinate $t=2$,

$$ $\displaystyle\nabla w_{2,2}$ $\displaystyle=\frac{1}{2}\cos(2\tilde{b})\left(\prod_{i=1\to d,i\neq 2}\cos(2 \tilde{w}_{i})\right)\sin(2\tilde{w}_{2})-\sin(\tilde{b})\left(\prod_{i=1\to d ,i\neq 1}\cos(\tilde{w}_{i})\right)\sin(\tilde{w}_{1})+\mathcal{O}(\eta).$ (25) $$

For any other coordinate $t\notin\{1,2\}$,

$$ $\displaystyle\nabla w_{2,t}=\frac{1}{2}\cos(2\tilde{b})\left(\prod_{i=1\to d,i \neq t}\cos(2\tilde{w}_{i})\right)\sin(2\tilde{w}_{t})-\sin(\tilde{b})\left( \prod_{i=1\to d,i\notin\{1,2,t\}}\cos(\tilde{w}_{i})\right)\left(\prod_{i\in\{ 1,2,t\}}\sin(\tilde{w}_{i})\right)+\mathcal{O}(\eta).$ (26) $$

We have similar computation for the gradient of the bias $b_{2}$, which we report directly.

$$ $\displaystyle\nabla b_{2}$ $\displaystyle=\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\left(o^{(1)}+o^{(2)}- \frac{\sqrt{3}}{2}x_{1}+x_{1}x_{2}\right)\cos\left(\langle\tilde{{\bm{w}}},{ \bm{x}}\rangle+\tilde{b}\right)+\mathcal{O}(\eta)$ $\displaystyle=\frac{1}{2}\sin(2\tilde{b})\left(\prod_{i=1\to d}\cos(2\tilde{w} _{i})\right)-\cos(\tilde{b})\left(\prod_{i=1\to d,i\notin\{1,2\}}\cos(\tilde{w }_{i})\right)\sin(\tilde{w}_{1})\sin(\tilde{w}_{2})+\mathcal{O}(\eta).$ (27) $$

###### At initialization:

With $\tilde{b}$ being initialzied at $\frac{\sqrt{3}}{2}+\mathcal{O}(\eta)$ (from eq. 22),

$$ $\displaystyle\cos(\tilde{b})$ $\displaystyle=\cos(\sqrt{3}/2)+\mathcal{O}(\eta)>0$ $\displaystyle\cos(2\tilde{b})$ $\displaystyle=\cos(\sqrt{3})+\mathcal{O}(\eta)<0$ $\displaystyle\sin(\tilde{b})$ $\displaystyle=\sin(\sqrt{3}/2)+\mathcal{O}(\eta)>0.$ $\displaystyle\sin(2\tilde{b})$ $\displaystyle=\sin(\sqrt{3})+\mathcal{O}(\eta)>0.$ $$

The initial value of $\tilde{w}_{1}$ is $\frac{\sqrt{3}}{2}+\frac{\pi}{3}+\mathcal{O}(\eta)$ (from eq. 22) and hence the values of

$$ $\displaystyle\cos(2\tilde{w}_{1})$ $\displaystyle=\cos(\sqrt{3}+2\pi/3)+\mathcal{O}(\eta)<0$ $\displaystyle\sin(2\tilde{w}_{1})$ $\displaystyle=\sin(\sqrt{3}+2\pi/3)+\mathcal{O}(\eta)<0$ $\displaystyle\cos(\tilde{w}_{1})$ $\displaystyle=\cos(\sqrt{3}/2+\pi/3)+\mathcal{O}(\eta)<0$ $\displaystyle\sin(\tilde{w}_{1})$ $\displaystyle=\sin(\sqrt{3}/2+\pi/3)+\mathcal{O}(\eta)>0.$ $$

The other coordinates $\tilde{w}_{j}$ are of order $\mathcal{O}(\eta)$. Thus, the behavior of the weights and biases at initialization can be summarized as follows.

- •
$w_{2,1}$ gets a decreasing update as both the terms involved in eq. 24 are positive.
$\displaystyle-\eta\nabla w_{2,1}$
$\displaystyle=-\eta\left|\frac{1}{2}\cos(2\tilde{b})\left(\prod_{i=1\to d,i
\neq 1}\cos(2\tilde{w}_{i})\right)\sin(2\tilde{w}_{1})\right|-\eta\left|\sin(
\tilde{b})\left(\prod_{i=1\to d,i\neq 2}\cos(\tilde{w}_{i})\right)\sin(\tilde{
w}_{2})\right|+\mathcal{O}(\eta^{2})$
$\displaystyle=-\frac{\eta}{2}\left|\cos(\sqrt{3})\right|(1-\mathcal{O}(2\eta))
^{d-1}\left|\sin(\sqrt{3}+2\pi/3)\right|+\mathcal{O}(\eta^{2})\leq-\frac{\eta}
{4}\cos(\sqrt{3})\sin(\sqrt{3}+2\pi/3)+\mathcal{O}(\eta^{2}),$
as $\eta=\mathcal{O}(1/poly(d))$ small.
- •
$w_{2,2}$ gets an increasing update as both the terms involved in eq. 25 are negative.
$\displaystyle-\eta\nabla w_{2,2}$
$\displaystyle=\frac{\eta}{2}\left|\cos(2\tilde{b})\right|\left|\left(\prod_{i=
1\to d,i\neq 2}\cos(2\tilde{w}_{i})\right)\right|\left|\sin(2\tilde{w}_{2})
\right|+\left|\sin(\tilde{b})\right|\left|\left(\prod_{i=1\to d,i\neq 1}\cos(
\tilde{w}_{i})\right)\right|\left|\sin(\tilde{w}_{1})\right|+\mathcal{O}(\eta^
{2})$
$\displaystyle=\eta\sin(\sqrt{3})\sin(\sqrt{3}/2+\pi/3)(1-\mathcal{O}(\eta))^{d
-1}+\mathcal{O}(\eta^{2})\geq\frac{\eta}{2}\sin(\sqrt{3})\sin(\sqrt{3}/2+\pi/3
)+\mathcal{O}(\eta^{2}),$
as $\eta=\mathcal{O}(1/poly(d))$ small.
- •
Other coordinates $w_{2,t}$ for $t\notin\{1,2\}$ get small gradients as both the involved terms in eq. 26 depend on how large $\tilde{w}_{t}:=w_{2,t}=\mathcal{O}(\eta)$ is.
$\displaystyle-\eta\nabla w_{2,t}$
$\displaystyle=-\frac{\eta}{2}\cos(2\tilde{b})\left(\prod_{i=1\to d,i\neq t}
\cos(2\tilde{w}_{i})\right)\sin(2\tilde{w}_{t})$
$\displaystyle+\eta\sin(\tilde{b})\left(\prod_{i=1\to d,i\notin\{1,2,t\}}\cos(
\tilde{w}_{i})\right)\left(\prod_{i\in\{1,2,t\}}\sin(\tilde{w}_{i})\right)+
\mathcal{O}(\eta^{2})=\mathcal{O}(\eta^{2}).$
- •
Bias $b_{2}$ get an increasing update as both the involved terms in eq. 27 are negative.
$\displaystyle-\eta\nabla b_{2}$
$\displaystyle=\frac{\eta}{2}\left|\sin(2\tilde{b})\right|\left|\left(\prod_{i=
1\to d}\cos(2\tilde{w}_{i})\right)\right|+\eta\left|\cos(\tilde{b})\right|
\left|\left(\prod_{i=1\to d,i\notin\{1,2\}}\cos(\tilde{w}_{i})\right)\sin(
\tilde{w}_{1})\right|\left|\sin(\tilde{w}_{2})\right|+\mathcal{O}(\eta)$
$\displaystyle=\frac{\eta}{2}\sin(\sqrt{3})\left|\cos(\sqrt{3}+2\pi/3)\right|(1
-\mathcal{O}(\eta))^{d-1}+\mathcal{O}(\eta)\geq\frac{\eta}{4}\sin(\sqrt{3})
\left|\cos(\sqrt{3}+2\pi/3)\right|.$

###### Beyond initialization:

In fact, we can extend the above argument beyond initialization, where $w_{2,1}$ decreases and $w_{2,2}$, $b_{2}$ increase by $\Theta(\eta)$ updates, up until we reach the conditions

$$ $\displaystyle\left|\tilde{w}_{1}-\frac{\pi}{2}\right|$ $\displaystyle\leq\mathcal{O}(\eta),\quad\text{(or)}\quad\left|w_{2,1}-\frac{ \pi}{2}+\sqrt{3}/2\right|\leq\mathcal{O}(\eta),$ $\displaystyle\left|\tilde{w}_{2}-\frac{\pi}{2}\right|$ $\displaystyle\leq\mathcal{O}(\eta),\quad\text{(or)}\quad\left|w_{2,2}-\frac{ \pi}{2}\right|\leq\mathcal{O}(\eta)$ $\displaystyle\left|\tilde{b}-\frac{\pi}{2}\right|$ $\displaystyle\leq\mathcal{O}(\eta),\quad\text{(or)}\quad\left|b_{2}-\frac{\pi} {2}+\sqrt{3}/2\right|\leq\mathcal{O}(\eta).$ $$

Since, we get $\Theta(\eta)$ updates in each step, this condition can be reached in $\Theta(1/\eta)$ steps.

The argument is as follows.
For any $\tilde{w}_{1},\tilde{w}_{2},\tilde{b}$ satisfying the following ranges,

$$ $\displaystyle\tilde{w}_{1}$ $\displaystyle\in(\frac{\pi}{2},\frac{\sqrt{3}}{2}+\frac{\pi}{3}),$ $\displaystyle\tilde{w}_{2}$ $\displaystyle\in(0,\frac{\pi}{2}),$ $\displaystyle\tilde{b}$ $\displaystyle\in(\sqrt{3}/2,\frac{\pi}{2}),$ $$

the following conditions hold true.

$$ $\displaystyle\cos(\tilde{b}),\text{ }\sin(\tilde{b}),$ $\displaystyle\text{ }\sin(2\tilde{b})>0,\quad\cos(2\tilde{b})<0$ $\displaystyle\cos(2\tilde{w}_{1}),\text{ }\sin(2\tilde{w}_{1}),$ $\displaystyle\text{ }\cos(\tilde{w}_{1})<0,\quad\sin(\tilde{w}_{1})>0.$ $\displaystyle\sin(\tilde{w}_{2}),\text{ }\cos(\tilde{w}_{2}),$ $\displaystyle\text{ }\sin(2\tilde{w}_{2})>0,\quad\cos(2\tilde{w}_{2})<0.$ $$

We can then show that the terms involved in the update rule of $w_{2,1}$ (eq. 24) are positive, implying $-\eta\nabla w_{2,1}<-\Omega(\eta)$ up until $\tilde{w}_{1}$ reaches $\mathcal{O}(\eta)$ close to $\frac{\pi}{2}$. Similar argument can be given for the updates of $b_{2}$ and $w_{2,2}$ respectively.

Furthermore, the coordinates $w_{2,t}$ for $t\notin\{1,2\}$ get $\mathcal{O}(\eta^{2})$ updates per step and stay $\mathcal{O}(\eta)$ small for $\Theta(1/\eta)$ steps of training.

∎

### I.2 Useful Lemmas

###### Lemma I.7 .

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\sin\left(\langle{ \bm{w}},{\bm{x}}\rangle+b\right)x_{j}=\cos(b)\left(\prod_{i=1\to d,i\neq j} \cos(w_{i})\right)\sin(w_{j}).$ $$

###### Proof.

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\sin\left(\langle{ \bm{w}},{\bm{x}}\rangle+b\right)x_{j}$ $\displaystyle=\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\sin\left(\sum_{i= 1\to d,i\neq j}w_{i}x_{i}+w_{j}x_{j}+b\right)x_{j}$ $\displaystyle=\cos(b)\left(\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\sin\left( \sum_{i=1\to d,i\neq j}w_{i}x_{i}\right)\cdot\mathbb{E}_{x_{j}}\cos\left(w_{j} x_{j}\right)x_{j}\right)$ Equals 0 0 as an odd function $\displaystyle+\cos(b)\left(\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\cos\left( \sum_{i=1\to d,i\neq j}w_{i}x_{i}\right)\cdot\mathbb{E}_{x_{j}}\sin\left(w_{j} x_{j}\right)x_{j}\right)$ Equals 0 0 as an odd function $\displaystyle+\sin(b)\left(\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\cos\left( \sum_{i=1\to d,i\neq j}w_{i}x_{i}\right)\cdot\mathbb{E}_{x_{j}}\cos\left(w_{j} x_{j}\right)x_{j}\right)$ $\displaystyle-\sin(b)\left(\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\sin\left( \sum_{i=1\to d,i\neq j}w_{i}x_{i}\right)\cdot\mathbb{E}_{x_{j}}\sin\left(w_{j} x_{j}\right)x_{j}\right)$ Equals 0 0 as an odd function $\displaystyle=\cos(b)\left(\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\cos\left( \sum_{i=1\to d,i\neq j}w_{i}x_{i}\right)\cdot\mathbb{E}_{x_{j}}\sin\left(w_{j} x_{j}\right)x_{j}\right)$ $\displaystyle=\cos(b)\left(\prod_{i=1\to d,i\neq j}\cos(w_{i})\right)\sin(w_{j})$ $$

∎

###### Lemma I.8 .

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\cos\left(\langle{ \bm{w}},{\bm{x}}\rangle+b\right)x_{j}=-\sin(b)\left(\prod_{i=1\to d,i\neq j} \cos(w_{i})\right)\sin(w_{j}).$ $$

###### Proof.

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\cos\left(\langle{ \bm{w}},{\bm{x}}\rangle+b\right)x_{j}$ $\displaystyle=\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\cos\left(\frac{ \pi}{2}-\langle{\bm{w}},{\bm{x}}\rangle-b\right)x_{j}$ $\displaystyle=\cos(\pi/2-b)\left(\prod_{i=1\to d,i\neq j}\cos(-w_{i})\right) \sin(-w_{j})$ Using lemma I.7 $\displaystyle=-\sin(b)\left(\prod_{i=1\to d,i\neq j}\cos(w_{i})\right)\sin(w_{ j}).$ $$

∎

###### Corollary I.9 .

Consider a set $S\subseteq[d]$.

$$ $\displaystyle\mathbb{E}_{{\bm{x}}\sim\{-1,+1\}^{d}}\text{ }\cos\left(\langle{ \bm{w}},{\bm{x}}\rangle+b\right)\prod_{j\in S}x_{i}=c_{b}\left(\prod_{i=1\to d ,i\notin S}\cos(w_{i})\right)\left(\prod_{j\in S}\sin(w_{j})\right),$ $$

where

$$ $c_{b}=\begin{cases}-\sin(b),&\text{if }|S|=4t+1\text{ for some }t\in\mathbb{N} \\ -\cos(b),&\text{if }|S|=4t+2\text{ for some }t\in\mathbb{N}\\ \sin(b),&\text{if }|S|=4t+3\text{ for some }t\in\mathbb{N}\\ \cos(b),&\text{if }|S|=4t\text{ for some }t\in\mathbb{N}.\\ \end{cases}$ $$

###### Lemma I.7 .

###### Proof.

###### Lemma I.8 .

###### Proof.

###### Corollary I.9 .

## Appendix J Scaling

Figure: Figure 7: Ablation study on choices for RaPTr algorithm. We train BERT-base with RaPTr for 100k steps with a 6-8-10-12 schedule (see Section 4). Left to right: (a) Square-root scaling ($h_{sqrt}$) has better validation loss compared with linear scaling and no scaling at training, especially in the earlier stages. With *no scale*, we scale layer’s output by $1/p_{i}$ during inference (following Huang et al. ()). (b) Different candidates for the fixed set $\mathcal{I}$ are compared for RaPTr. We find that training with first and last layers fixed helps faster training.
Refer to caption: x14.png

While working on subnetworks, it is important to appropriately rescale the network. In particular, bypassing layer(s) in RaPTr can shift the input distribution for layers compared to the full model. To mitigate this shift, we scale the output of the layers to maintain the norms of the input to each layer throughout training. The idea of scaling layer outputs has also been explored in prior work Huang et al. (); Fan et al. ().We use a different square-root scaling mechanism that is motivated by analysis on a randomly initialized Transformer architecture. We show that at initialization, the norm of the intermediate outputs ${\bm{y}}^{(\ell)}$ scale as $\sqrt{\ell}$.

###### Theorem J.1 (Square-root scaling of input norms) .

At initialization, given any input sequence ${\bm{x}}_{1:N}$ and scalars $\alpha_{1:L}$, w.h.p. the intermediate sequences of $F$ (definition 2.1) satisfy

$$ $\displaystyle\left\|{\bm{y}}^{(\ell)}_{i}\right\|^{2}_{2}=\left\|{\bm{x}}_{i} \right\|^{2}_{2}+\Theta(\sum_{j=1}^{\ell}\alpha^{2}_{j}d),\quad\text{for all } 1\leq i\leq N,1\leq\ell\leq L.$ $$

Inspired by this, we define the function $h_{sqrt}$ that takes in a sequence of binary values $\zeta_{1:L}\in\{0,1\}^{L}$ and returns scalars $\overline{\zeta}_{1:L}$ where $\overline{\zeta}_{i}$ is the scaling for output of layer $i$. We find a scaling that satisfies the following two conditions hold (a) $\sum_{i=1}^{j}\overline{\zeta_{i}}^{2}=j$ for all $j\leq L$ (maintaining the norm), and (b) $\overline{\zeta_{i}}=0$ if $\zeta_{i}=0$ for all $i\leq L$ (maintaining layers in random subnetwork). Formally, for each index $j$ with $\zeta_{j}=1$, it finds the index minimum $\bar{j}>j$ with $\zeta_{\bar{j}}=1$ and sets $\overline{\zeta}_{j}=\sqrt{\bar{j}-j}.$
The RaPTr algorithm with square root scaling is presented in algorithm 1.
In Figure 7 we compare square root scaling with some other scaling methods and find it to be slightly better.

###### Theorem J.1 (Square-root scaling of input norms) .

### J.1 Proofs

For simplicity, we present the results for transformers with single head in the self-attention layer. Furthermore, for simplicity, we use $\sigma_{relu}$ activation in the MLPs.

Figure: Algorithm 3 Transformer Layer

###### Definition J.2 .

[Layer Normalization]
Define a normalization function $f:\mathbb{R}^{d}\to\mathbb{R}^{d}$ that performs $f({\bm{x}})=({\bm{x}}-\mu)/\sigma$, where $\mu$ and $\sigma$ are the mean and standard deviation of ${\bm{x}}$, respectively. Then, layer normalization $f^{LN}:\mathbb{R}^{d}\to\mathbb{R}^{d}$ with parameters $\mathbf{\gamma},{\bm{b}}\in\mathbb{R}^{d}$ takes as input ${\bm{x}}\in\mathbb{R}^{d}$ and outputs ${\bm{y}}\in\mathbb{R}^{d}$, which is computed as ${\bm{z}}=f({\bm{x}}),{\bm{y}}=\mathbf{\gamma}\odot{\bm{z}}+{\bm{b}}.$

###### Definition J.3 (Softmax self-attention) .

A self-attention layer $f^{attn}:\mathbb{R}^{N\times d}\to\mathbb{R}^{N\times d}$ with parameters $\{{\bm{W}}_{Q},{\bm{W}}_{K},{\bm{W}}_{V},{\bm{C}}^{attn}\in\mathbb{R}^{d\times
d}\}$ takes a sequence $\{{\bm{x}}_{n}\}_{n\leq N}$ and outputs a sequence $\{{\bm{y}}_{n}\}_{n\leq N}$, such that

$$ $\displaystyle{\bm{y}}_{n}={\bm{C}}^{attn}\sum_{\overline{n}=1}^{N}a_{n, \overline{n}}{\bm{v}}_{\overline{n}},$ $\displaystyle\text{with }a_{n,\overline{n}}=\mathrm{softmax}({\bm{K}}{\bm{q}}_ {n})_{\overline{n}},\quad{\bm{q}}_{n}={\bm{W}}_{Q}{\bm{x}}_{n},\quad{\bm{k}}_{ n}={\bm{W}}_{K}{\bm{x}}_{n},\quad{\bm{v}}_{n}={\bm{W}}_{V}{\bm{x}}_{n},$ $$

for all $n\leq N$, and ${\bm{K}}\in\mathbb{R}^{N\times N}$ defined with rows $\{{\bm{k}}_{n}\}_{n=1}^{N}.$

###### Definition J.4 (MLP) .

An MLP layer $f^{mlp}:\mathbb{R}^{d}\to\mathbb{R}^{d}$ with parameters $\{{\bm{W}}\in\mathbb{R}^{m\times d},{\bm{C}}^{mlp}\in\mathbb{R}^{m\times d}\}$ and activation $\sigma_{relu}$,
takes an input ${\bm{x}}\in\mathbb{R}^{d}$ and outputs ${\bm{y}}\in\mathbb{R}^{d}$, such that

$$ $\displaystyle{\bm{y}}={\bm{C}}^{mlp}\sigma_{relu}({\bm{W}}{\bm{x}}).$ $$

###### Definition J.5 (Transformer layer) .

A pre-layernorm transformer layer with three sub-layers; 2 layer normalization layers $f^{LN}_{attn}$, $f^{LN}_{mlp}$ (J.2), an MLP layer $f^{mlp}$ (J.4), and a softmax self-attention layer $f^{attn}$ (J.3); takes a sequence $\{{\bm{x}}_{n\leq N}$ and outputs a sequence $\{{\bm{y}}_{n}\}_{n\leq N}$ in four steps.

- 1.
First computes $\{{\bm{y}}^{attnln}_{n}\}_{n=1}^{N}$ using a layer normalization, i.e. ${\bm{y}}^{attnln}_{n}=f^{LN}_{attn}({\bm{x}}_{n})$ for all $n\leq N$.
- 2.
Then it runs softmax self-attention to get $\{{\bm{y}}^{attn}_{n}\}_{n=1}^{N}=f^{attn}(\{{\bm{y}}^{attnln}_{n}\}_{n=1}^{N})$.
- 3.
The net output of the self-attention block is given by $\{{\bm{y}}^{attnblock}_{n}\}_{n=1}^{N}$, with ${\bm{y}}^{attnblock}_{n}={\bm{x}}_{n}+{\bm{y}}^{attn}_{n}$ for all $n\leq N$.
- 4.
Before passing to the MLP function, it is passed through another layer normalization, i.e. ${\bm{y}}^{mlpln}_{n}=f^{LN}_{mlp}({\bm{y}}^{attnblock}_{n})$ for all $n\leq N$.
- 5.
MLP function then returns $\{{\bm{y}}^{mlp}_{n}\}_{n=1}^{N}$ with ${\bm{y}}^{mlp}_{n}=f^{mlp}({\bm{y}}^{mlpln}_{n})$ for all $n\leq N$.
- 6.
${\bm{y}}_{n}={\bm{y}}^{mlp}_{n}+{\bm{y}}^{attnblock}_{n}$ for all $n\leq N$.

###### Definition J.6 (Initialization of the weights in the transformer layer) .

The weights are initialized as follows:

$$ $\displaystyle{\bm{C}}^{mlp},{\bm{C}}^{attn},{\bm{W}}_{Q},{\bm{W}}_{K},{\bm{W}} _{V}\sim\mathcal{N}(\mathbf{0},\frac{1}{\sqrt{d}}\mathbf{I}),$ $\displaystyle{\bm{W}}\sim\mathcal{N}(\mathbf{0},\frac{\sqrt{2}}{\sqrt{m}} \mathbf{I}).$ $$

The parameters $\mathbf{\gamma},{\bm{b}}$ of the functions $f^{LN}_{attn},f^{LN}_{mlp}$ have been initialized as $\mathbf{1}$ and $\mathbf{0}$ respectively.

###### Lemma J.7 (Norm of the output of the MLP function, modification of lemma 7.1 in Allen-Zhu et al. ( 2019 ) ) .

For a given input sequence $\{{\bm{y}}^{mlpln}_{n}\}_{n\leq N}$, if $\varepsilon\in(0,1]$, with probability at least $1-O(N)\cdot e^{-\Omega\left(m\varepsilon^{2}\right)}$ over the randomness of ${\bm{C}}^{mlp},{\bm{W}}$, we have

$$ $\forall i\in[N]:\quad\left\|{\bm{y}}^{mlp}_{n}\right\|/\left\|{\bm{y}}^{mlpln} _{n}\right\|\in[1-\varepsilon,1+\varepsilon].$ $$

###### Lemma J.8 (Norm of the output of the layer normalization layers) .

Given any input sequence $\{{\bm{x}}_{n}\}_{n=1}^{N}$, under the assumption for all $n\leq N$, ${\bm{x}}_{n}-\sum_{i=1}^{d}x_{n,i}$ isn’t identically $\mathbf{0}$, we have

$$ $\displaystyle\left\|{\bm{y}}^{attnln}_{n}\right\|=\sqrt{d}$ $$

for all $n\leq N$.

Similar result holds for $\{{\bm{y}}^{mlpln}_{n}\}_{n=1}^{N}.$

###### Lemma J.9 (Norm of the output of the MLP block) .

For a given input sequence $\{{\bm{y}}^{attnblock}_{n}\}_{n\leq N}$, with probability at least $1-\mathcal{O}(1)$ over the randomness of ${\bm{C}}^{mlp},{\bm{W}}$, we have

$$ $\displaystyle\left\|{\bm{y}}_{n}\right\|^{2}$ $\displaystyle=\left\|{\bm{y}}^{mlp}_{n}+{\bm{y}}^{attnblock}_{n}\right\|^{2}= \left\|{\bm{y}}^{attnblock}_{n}\right\|^{2}+d$ $\displaystyle+\mathcal{O}\left(\left\|{\bm{y}}^{attnblock}_{n}\right\|\log N+( d+\left\|{\bm{y}}^{attnblock}_{n}\right\|)\frac{\log^{3/2}N}{\sqrt{m}}\right),$ $$

for all $n\leq N.$

###### Proof.

Combining lemmas J.8 and J.7, we have for the sequence $\{{\bm{y}}^{attnblock}_{n}\}_{n\leq N}$,

$$ $\displaystyle\left|\left\|{\bm{y}}^{mlp}_{n}\right\|/\sqrt{d}-1\right|\leq \mathcal{O}\left(\frac{\sqrt{\log N}}{\sqrt{m}}\right),$ $$

w.p. atleast $1-\mathcal{O}(1)$.

Furthermore, due to the randomness of ${\bm{C}}^{mlp}$, we can further show that w.p. at least $1-\mathcal{O}(1)$,

$$ $\displaystyle\left|\langle{\bm{y}}^{attnblock}_{n},{\bm{y}}^{mlp}_{n}\rangle \right|\leq\mathcal{O}(\left\|{\bm{y}}^{attnblock}_{n}\right\|\log N),$ $$

for all $n\leq N$. Combining the two results, we have

$$ $\displaystyle\left\|{\bm{y}}_{n}\right\|^{2}$ $\displaystyle=\left\|{\bm{y}}^{mlp}_{n}+{\bm{y}}^{attnblock}_{n}\right\|^{2}= \left\|{\bm{y}}^{attnblock}_{n}\right\|^{2}+d$ $\displaystyle+\mathcal{O}\left(\left\|{\bm{y}}^{attnblock}_{n}\right\|\log N+( d+\left\|{\bm{y}}^{attnblock}_{n}\right\|)\frac{\log^{3/2}N}{\sqrt{m}}\right).$ $$

∎

###### Lemma J.10 (Norm of the output of the attention block) .

For a given input sequence $\{{\bm{x}}_{n}\}_{n\leq N}$, if $\varepsilon\in(0,1]$, with probability at least $1-O(1)$ over the randomness of ${\bm{C}}^{attn},{\bm{W}}_{V}$, we have

$$ $\forall i\in[N]:\quad\left\|{\bm{x}}_{n}\right\|^{2}\leq\left\|{\bm{y}}^{ attnblock}_{n}\right\|^{2}\leq\left\|{\bm{x}}_{n}\right\|^{2}+\left\|{\bm{x}}_ {n}\right\|+d+\mathcal{O}(\frac{\sqrt{\log N}}{\sqrt{d}}(d+\left\|{\bm{x}}_{n} \right\|)).$ $$

###### Proof.

From the definitions of $\{{\bm{y}}^{attnln}_{n}\}$ and $\{{\bm{y}}^{attn}_{n}\}$, we have

$$ $\displaystyle{\bm{y}}^{attn}_{n}={\bm{C}}^{attn}{\bm{W}}_{V}\sum_{j\leq N}a_{n ,j}{\bm{y}}^{attnln}_{j}.$ $$

Thus, we can use a proof similar to the proof of lemma J.9 to argue that with the randomness of ${\bm{C}}^{attn}$ and ${\bm{W}}_{V}$,

$$ $\displaystyle\left|\frac{\left\|{\bm{y}}^{attn}_{n}\right\|}{\left\|\sum_{j \leq N}a_{n,j}{\bm{y}}^{attnln}_{j}\right\|}-1\right|\leq\mathcal{O}\left( \frac{\sqrt{\log N}}{\sqrt{d}}\right),$ $$

for all $n\leq N$ w.p. atleast $1-\mathcal{O}(1).$

Furthermore, due to the randomness of ${\bm{C}}^{attn}$, we can further show that w.p. atleast $1-\mathcal{O}(1)$,

$$ $\displaystyle\left|\langle{\bm{y}}^{attn}_{n},{\bm{x}}_{n}\rangle\right|\leq \mathcal{O}(\left\|{\bm{x}}_{n}\right\|\log N),$ $$

for all $n\leq N$.

Using Cauchy-Schwarz inequality, we must have

$$ $\displaystyle\left\|\sum_{j\leq N}a_{n,j}{\bm{y}}^{attnln}_{j}\right\|\leq\max _{j\leq N}\left\|{\bm{y}}^{attnln}_{j}\right\|=\sqrt{d}.$ $$

Thus, combining the results, we have

$$ $\displaystyle\left\|{\bm{y}}^{attnblock}_{n}\right\|^{2}$ $\displaystyle=\left\|{\bm{y}}^{attn}_{n}+{\bm{x}}_{n}\right\|^{2}\leq\left\|{ \bm{x}}_{n}\right\|^{2}+d$ $\displaystyle+\mathcal{O}\left(\left\|{\bm{x}}_{n}\right\|\log N+(d+\left\|{ \bm{x}}_{n}\right\|)\frac{\log^{3/2}N}{\sqrt{d}}\right).$ $$

∎

###### Lemma J.11 (Norm of the output of the transformer layer) .

For a given input sequence $\{{\bm{x}}_{n}\}_{n\leq N}$, if $\varepsilon\in(0,1]$, with probability at least $1-\mathcal{O}(1)$ over the randomness of ${\bm{C}}^{attn},{\bm{W}}_{V},{\bm{C}}^{mlp}$, we have

$$ $\forall i\in[N]:\quad\left\|{\bm{x}}_{n}\right\|^{2}+d+\mathcal{O}(err)\leq \left\|{\bm{y}}_{n}\right\|^{2}\leq\left\|{\bm{x}}_{n}\right\|^{2}+2d+\mathcal {O}(err),$ $$

where $err=\mathcal{O}\left(\left\|{\bm{x}}_{n}\right\|\log N+(d+\left\|{\bm{x}}_{n}
\right\|)\frac{\log^{3/2}N}{\sqrt{m}}\right)$.

See J.1

###### Proof.

This follows from the fact that the transformer architecture is a stack of struturally identical $L$ transformer layers, and each transformer layer’s output norm increases by $\Theta(d)$ compared to its input norm, as given by lemma J.11.
∎

###### Definition J.2 .

###### Definition J.3 (Softmax self-attention) .

###### Definition J.4 (MLP) .

###### Definition J.5 (Transformer layer) .

###### Definition J.6 (Initialization of the weights in the transformer layer) .

###### Lemma J.7 (Norm of the output of the MLP function, modification of lemma 7.1 in Allen-Zhu et al. ( 2019 ) ) .

###### Lemma J.8 (Norm of the output of the layer normalization layers) .

###### Lemma J.9 (Norm of the output of the MLP block) .

###### Proof.

###### Lemma J.10 (Norm of the output of the attention block) .

###### Proof.

###### Lemma J.11 (Norm of the output of the transformer layer) .

###### Proof.

## Peer Reviews

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: - Unclear how the authors decided to take specific mixtures of specific datasets. Was there no off-the-shelf dataset suitable for this analysis (such as FineWeb / FineWeb-edu)?
soundness: 3
strengths: - The paper is well written
- The approach is well motivated by the literature on stochastic depth
- The obtained results on a small set of benchmarks indicate either competitive or superior performance than the control (i.e., full model training) and directly translate to savings in wall-clock time
summary: This paper leverages the idea of stochastic depth for the training of language models. The paper proposed a particular training schedule (RAPTR) suitable for training with stochastic depth, where the depth of the network increases over the course of model training, ultimately training the full model. As a significant number of layers are skipped, this translates to direct gains in wall-clock time. The proposed RAPTR training scheme was evaluated on two encoder-decoder language models including BERT and UL2. Results on a small set of benchmarks indicate competitive performance w.r.t. the full model training and even outperforms it in some cases due to this acting as a regularization scheme.
weaknesses: - The paper only focused on encoder-decoder models. I would like to see similar results on simple decoder-only language models, which are much more prevalent.
- Evaluation on only a limited number of tasks. I would expect evaluations on a very large number of tasks from eval-harness as evaluation costs are relatively modest in comparison to the training cost.
- Important implementation details are scattered throughout the paper. I would expect all of the details such as sequence length, and batch sizes to be specified at a single location to make it easier to understand.
- Simple implementation details buried in the appendix such as how to provide gradients to all the layers, which I expect to be a part of the main paper. It can be significantly shorter though by just stating that we need a way to compute gradients for all the layers even if that layer didn't participate in that round. Perhaps just include another trivial implementation that works even in distribution reduction i.e., to multiply block $i$ output with $\alpha_i$. This ensures that gradient is computed for all parameters, however, without any gain in wall-clock time.

---

confidence: 4
contribution: 3
initial_rating: 6
presentation: 3
questions: Why can RaPTr achieve better performance than the baseline full-model? The baseline full-model is well-trained and is supposed to achieve the best performance.
How about the performance when more FLOPs are reduces? For example, reduce the FLOPs of the baseline model to half or 1/3?
soundness: 3
strengths: The proposed progressive subnetwork training method is straightforward and easy to understand.
The experiments show that the proposed method is simple but effective.
The paper is well-structured and written.
summary: This paper proposes a stagewise pretraining method, progressive subnetwork training. This method randomly selects subnetworks to train in each stage and gradually increases the size of the selected subnetworks in stages. They also discussed why layer dropping can hurt the models’ ability to capture complex correlations in the data. The authors verify the effectiveness of the proposed progressive subnetwork training method by pretraining BERT and UL2.
weaknesses: It is good that try to theoretically explain why layer dropping methods cannot achieve good performance. However, the illustration setting that using Polynomial learning and 2-layer residual network is too naïve, which makes the conclusion less convincing.

---

confidence: 3
contribution: 3
initial_rating: 8
presentation: 4
questions: Please see Weaknesses.
soundness: 4
strengths: The problem of efficient training is of increasing importance as we scale to larger models and data sets. The paper is well-written and comprehensive, covering theoretical justification, detailed numerical analysis, and implementation guidelines.
summary: This paper argues that stagewise dropping strategies, such as layer dropping, can be effective for efficiently training large language models. The paper proposes a stagewise training framework of progressively growing a subnetwork and shows that it generalizes layer dropping. They theoretically illustrate the effectiveness of this strategy and moreover empirically demonstrate effectiveness in speeding up training on standard benchmarks.
weaknesses: In the numerical evaluations, the selected settings of Rel. FLOPS seemed somewhat arbitrary (e.g., fixing to 1.33x for Table 1). It would be nice to get some intuition why these were chosen and the sensitivity to these experimental settings (e.g., how do the results hold as we sweep the Rel. FLOPS).

---

confidence: 3
contribution: 2
initial_rating: 3
presentation: 2
questions: 1. Is there a generalisation beyond the polynomial example for RAPTR capturing higher or lower degree components in each stage?

2. Can it be shown that the loss gap for other stacking or dropping methods are either unbounded or have a larger upper bound than RAPTR?

3. Can all GLUE tasks be reported together with results on BERT-large as a base model is quite small and easy to pre-train, while RAPTR is aimed at improving pre-training efficiency. More convincing experimental results using other models are also appreciated as the current results do not persuade me to use RAPTR. 

4. Are we able to use RAPTR for fine-tuning on downstream tasks instead of pre-training?
soundness: 2
strengths: 1. The importance of improving pre-training efficiency is well justified, and it’s clear that addressing this issue is valuable. 

2. Efforts have been made to offer theoretical justifications for the method.
summary: This paper proposes a new approach to stage-wise pre-training of large models to improve the efficiency and computational cost. The main idea is to train random subnetworks within a base network for each stage of training and increase the complexity of the subnetworks as training progresses. Experimental results show some improvement in language models. Additionally, they include theoretical work to support their method, using a simple example of learning a polynomial function and demonstrate stability in stage-wise training.
weaknesses: 1. For experiments on BERT, only a base model is used and the improvements are relatively marginal compared to other stacking or dropping methods and only 3 tasks in GLUE are reported. Some improvements for UL2 are also within the variance of the baseline. 

2. Although the polynomial example illustrates how RAPTR learns lower and higher degree components, it is overly specific and lacks sufficient theoretical support to convince me that RAPTR is better than PLD. 

3. Theorem 5.3 shows that the loss gap $|L_2(F) - L_1(F) |$ is upper bounded by the stability of the network and that is used to show that the losses between stages can be small for linear models in RAPTR. However, it is not clear if the same may hold for other stacking or dropping methods. 

4. The empirical verification with BERT in section 5 does not seem to support the theory as in Fig 3, there is no linear decrease in loss gap as depth of model increases. 

Formatting: Many typos, for example line 482: "layernorm is enabled or not respectively" should be the other way around, and figures with subplots are not labelled clearly.

Meta-review: The paper introduces a stage-wise training framework for large language models, leveraging  progressive subnetwork growth. RaPTr skips layers during early training stages and gradually increases network depth, reducing computational FLOPs and wall-clock time. The authors provide both theoretical insights and empirical evidence across two model families—BERT (encoder-decoder) and UL2 (decoder-only). Results show that RaPTr can speed up training while achieving strong performance. 

The proposed approach is straightforward, grounded in existing literature and well-motivated. It directly addresses efficiency in pretraining, an increasingly critical challenge in large-scale model. Despite its strengths, the theoretical analysis, while insightful, relies on oversimplified polynomial learning examples, limiting its generalizability to broader architectures. The experiments are limited in scope, with a focus on relatively small-scale models (BERT-Base and UL2-1B) rather than widely used larger models (e.g., GPT-series or ViT). While theoretical and experimental limitations exist, RaPTr demonstrates clear advantages in wall-clock time and computational savings without compromising performance, making it a significant step thus accept is recommended.

Decision: Accept (Poster)