S UB -T ASK D ECOMPOSITION E NABLES L EARNING IN S EQUENCE TO S EQUENCE T ASKS
Anonymous authors Paper under double-blind review A BSTRACT
The field of Natural Language Processing (NLP) has experienced a dramatic leap in capabilities with the recent introduction of huge Language Models (LMs).
Despite this success, natural language problems that involve several compounded steps are still practically unlearnable, even by the largest LMs.
This complies with experimental failures for end-to-end learning of composite problems that were demonstrated in a variety of domains.
An effective mitigation is to introduce intermediate supervision for solving sub-tasks of the compounded problem.
Recently, several works have demonstrated high gains by taking a straightforward approach for incorporating intermediate supervision in compounded natural language problems: the sequence-to-sequence LM is fed with an augmented input, in which the decomposed tasks’ labels are simply concatenated to the original input (see figure 1).
In this paper, we prove a positive learning result that motivates these recent efforts.
We show that when concatenating intermediate supervision to the input and training a sequence-to-sequence model on this modified input, unlearnable composite problems can become learnable.
We show that this is true for any family of tasks which on the one hand, are unlearnable, and on the other hand, can be decomposed into a polynomial number of simple sub-tasks, each of which depends only on O (1) previous sub-task results.
Beyond motivating contemporary empirical efforts for incorporating intermediate supervision in sequence-to-sequence language models, our positive theoretical result is the first of its kind in the landscape of results on the benefits of intermediate supervision for neural-network learning: Until now, all theoretical results on the subject are negative , i.e. , show cases where learning is impossible without intermediate supervision, while our result is positive , showing that learning is facilitated in the presence of intermediate supervision.
I NTRODUCTION
Large-scale language models such as BERT (Devlin et al., 2019), T5 (Raffel et al., 2020), and
GPT-3 (Brown et al., 2020) have recently pushed the envelope in many NLP tasks.
Nevertheless, there are some problem-families that even the largest models do not seem to be capable of solving.
One such family is that of “multi-hop" reasoning problems (see, e.g., Geva et al.
(2021); Kalyan et al.
that require compounding operations in order to produce an answer.
For example,
Gopher (Rae et al., 2021), one of the largest available language models, achieves 61% accuracy in the StrategyQA benchmark (Geva et al., 2021) that requires implicit decomposition into reasoning steps, while human level performance is around 87% accuracy.
The limitations of learning compounded tasks with neural networks in an end-to-end manner have been observed in a variety of non-linguistic domains.
A leading experimental approach for addressing these is to first explicitly break the compounded operations into more basic “single-hop” operations and then combine the results.
Gülçehre & Bengio (2016), one of the earliest works on this subject, propose that supervision for the single-hop intermediate steps is crucial for avoiding bad local minima in the optimization of neural networks.
Afterward, Glasmachers (2017) demonstrated that gradient-based end-to-end multi-hop learning is inefficient for solving complex problems that are easily solved by a divide-and-conquer strategy.
Beyond position papers, specific examples were shown, e.g. , Chang et al.
(2020) showed that SATNet (Wang et al., 2019) could not solve visual
Sudoku without using intermediate labels to identify individual Sudoku digit images.
Intermediate sub-tasks
and their labels are concatenated to the original task’s input to form a new input sequence.
At training time, the likelihood of the entire sequence following the original input is maximized conditioned on the input, and at test time only the original input is given to the model.
Similar limitations were observed in language related compounded tasks, including commonsense reasoning (Liu et al., 2021; Wei et al., 2022;
Zelikman et al., 2022), math word problems (Pi˛ekos et al., 2021;
Wei et al., 2022), and programs execution (Nye et al., 2022).
The go-to architectures in this domain are powerful language models, which are trained as sequence-to-sequence models over text.
In this setting, a particular form of introducing intermediate supervision for compounded tasks has emerged: intermediate sub-tasks and their labels are concatenated to the original task’s input to form a new input sequence, on which the sequence-to-sequence LM is trained.
This approach has recently been widely adopted, e.g. , by Rajani et al.
; Cobbe et al.
; Pi˛ekos et al.
Recchia (2021); Nye et al.
; Wei et al. (2022); Zelikman et al. (2022).
Figure 1 illustrates this approach for math problems, as done in Ling et al.
; Cobbe et al.
These works show that training sequence-to-sequence models with concatenated sub-task decomposition supervision significantly improves the results when compared to training the same model without the intermediate supervision.
For example, Nye et al.
(2022) show > 99% accuracy for 8 digits addition when concatenating intermediate calculations to the input, while the vanilla accuracy without intermediate supervision is around ∼ 35% .
While such decomposition based approaches are intuitive, we are not aware of theoretical results that motivate and formulate their benefits for learning composite problems with neural-networks.
In this paper, we provide positive theoretical results in this domain, which are in fact the first of their kind (see related work in section 2).
We show our results for sequential models, integrating the intermediate supervision in a manner that mimics the above cited successful empirical approaches in the language domain.
In this formulation, a learner learns to predict a sequence composed of the task inputs x , followed by the single-hop reasoning steps referred to as the evidence , and finally, the final answer y .
We extend provable guarantees for the convergence of overparameterized recurrent neural networks (Wang et al., 2021) and prove that with intermediate sub-task supervision, even a simple sequence-to-sequence model provably learns any task that obeys an efficient decomposition into simpler subtasks that depend only on a small fraction of the input.
Importantly, both the sample complexity and the required number of gradient updates are polynomial.
In contrast, we rely on existing works (Valiant, 1984;
Goldreich et al., 1986; Daniely & Shalev-Shwartz, 2016) to show that in the absence of intermediate supervision, there exist efficiently decomposable tasks that are unlearnable with polynomial time learning algorithms.
Our results apply to a broad family of tasks.
As a first exemplifying step, we show a positive result for learning bit subset parity, a setting that is notoriously not amenable to gradient-based algorithms in an efficient way without intermediate supervision (Kearns, 1998; Shalev-Shwartz et al., 2017;
Abbe & Sandon, 2020; Abbe et al., 2021).
In this setting, the family of target functions consists of parities over subsets of unknown input bits.
Specifically, the input is d bits and the task is to predict whether the number of 1 ’s in certain unknown subset of d / 2 bits is odd or even.
The corresponding sub-tasks we consider are the parities of subsets of the unknown input subset.
We prove a theorem guaranteeing that, when intermediate supervision is available, efficient neural network learning is made possible.
As a result, we show an exponential gap between the end-to-end and decompositionbased neural network learnability of the bit subset parity problem.
Next, we generalize the above result, and show that when sufficient intermediate supervision is available, any family of functions with a polynomial time complexity, i.e. , functions that belong to the P time complexity class, are efficiently learnable by neural networks.
Accordingly, based on either standard cryptographic assumptions (Valiant, 1984;
Goldreich et al., 1986) or computational complexity hardness assumptions (Daniely & Shalev-Shwartz, 2016)
we prove that there exist tasks that, on the one hand, cannot be learned by any polynomial time algorithm and, on the other hand, can be efficiently learned by neural networks when intermediate supervision is present.
Our main result can be stated as follows:
Theorem 1.
(Informal) There exists a binary classification problem parameterized by size d , such that the following holds:
• On one hand, when equipped with sub-task decomposition supervision, a simple sequenceto-sequence model can get arbitrarily low ϵ >
zero-one loss with number of gradient updates that is polynomial in d, ϵ − 1 .
• On the other hand, when supervision regarding sub-task is missing, then for any polynomial time learning algorithm and (constant) ϵ > 0 , the zero-one loss will be higher than 1 / 2 − ϵ .
To summarize, the main contributions of this paper are:
We show the first positive result that guarantees neural networks learnability in the presence of intermediate supervision for a problem that is unlearnable without it.
We do so in the sequence-to-sequence setting that is currently used for applying state-ofthe-art language models on complex multi-hop tasks in NLP.
We show that with sufficient intermediate supervision this sequence-to-sequence setting allows learning any function in the P time complexity class.
The remainder of this paper is organized as follows.
Section 3 presents the sequence to sequence model we analyzed.
Section 4 presents a hypothesis class and proves that it can be learned with our sequence to sequence model.
Section 5 presents a concrete example, and demonstrates that the task of learning bit-subset parity with sequence-to-sequence models can be learned with sub-task decomposition and the corresponding intermediate supervision.
Finally, in section 6 we generalize the positive results to any function in the P time complexity class, thus establishing our main result.
R ELATED W ORK
The concept of how learning can be enhanced by guiding a learner through intermediate tasks is an old one, dating back to animal training by shaping (Skinner, 1958; Peterson, 2004; Krueger &
Dayan, 2009).
Since then, a large body of work has shown its practical benefits for various machine learning tasks.
For example, there exists a rich line of work on the importance of shaping rewards and adding sub-goals in reinforcement learning tasks.
Karlsson (1994) introduced the methodology of using knowledge in the reward function, in order to decompose a holistic task into several subtasks.
Ng et al.
(1999) established necessary and sufficient conditions for reward shaping to reserved optimal policies.
Marthi (2007) investigate the problem of automatically learning a decomposition of the reward function.
All these work intuitively rely on benefits of adding intermediate supervision.
Recently, Zhai et al.
(2022) showed that adding sub-goal rewards provably reduces the complexity of the synchronous value iteration algorithm.
However, this reduction is linear in the number of the sub-goals, unlike our work that proves exponential gap in the supervised learning setting.
Moreover, several of the notions in their analysis are unique to the reinforcement leaning setup and cannot be easily translated into the supervised learning setting ( e.g. , One-Way Intermediate States).
Negative theoretical results exist, showing that end-to-end learning of multi-hop problems is unfeasible without decomposition.
Shalev-Shwartz et al.
(2017) explored the theoretical limitations of end-to-end gradients based learning, studying learnability of tasks that are composed of classification and parity tasks, proving that the end-to-end approach does not converge in a polynomial number of gradient updates.
They do show that when intermediate supervision is provided, the gradients have a much higher signal-to-noise ratio.
However, they provide no guarantees that in this case learning is possible in a polynomial number of gradient updates.
In addition, Shalev-Shwartz
& Shashua (2016) proved an exponential gap between end-to-end-based verification sample complexity and the decomposition-based verification sample complexity.
However, again, an explicit setting in which providing intermediate supervision for training actually improves the situation to a point that learning is feasible, is lacking.
We provide the first theoretical result proving that neural networks also benefit from sub-task decomposition, while earlier theoretical works in this space only prove that end-to-end learning is unfeasible in some compounded cases.
T HE ANALYZED SEQUENCE - TO - SEQUENCE LEARNING ALGORITHM
A recent successful empirical approach for solving compounded natural language problems (Ling et al., 2017; Rajani et al., 2019; Pi˛ekos et al., 2021; Recchia, 2021; Cobbe et al., 2021; Nye et al., 2022; Wei et al., 2022; Zelikman et al., 2022) is to concatenate intermediate supervision labels to the input.
This way, the language model receives a sequence composed of the input followed by the labels of the intermediate tasks, before emitting the final compounded answer.
For a compounded binary classification task which consists of a d -bit input string x , with S denoting the string of intermediate step results, we denote the combined input sequence as z =
Concat { x ; S} , and the combined output sequence as y , defined in a standard autoregressive fashion by 1 y t =
z t +1 (see figure 2 for a d = 8 example).
Training and testing follow conventional sequence-to-sequence model protocol: At training time, z t for t > d will be the ground-truth sub-task result y t − 1 (a practice sometimes referred to as “teacher forcing" (Williams & Zipser, 1989)), and at test time, z t for t > d will be the model’s prediction at time t − 1 .
We analyze the classical Elman recurrent neural networks (Elman, 1990) with ReLU activations as our sequence-to-sequence model.
Given an input sequence z of length T = d + len ( S ) as defined above, the architecture f RNN computes:
[Equation]
where e 0 , e 1 ∈ R 2 are one-hot vectors, A ∈ R m × 2 translates the input to the hidden dimension m , W ∈ R m × m is the learned hidden weights matrix,
B ∈ R m is the output weights vector and
M 0 ∈ R m is the initialization of the hidden state.
We will use the binary cross-entropy loss over output locations for t ≥ d , i.e. , our loss ignores the architecture’s prediction of x and depends on its prediction of intermediate labels and final outcome:
[Equation]
Algorithm 1 below describes the analyzed training procedure of our sequence-to-sequence model.
This algorithm describes a straightforward SGD training procedure where, for simplicity, we analyze a variant that updates only the hidden W weights while keeping A, B, M 0 frozen at initialization.
This amounts to keeping the input, output and the t = 0 hidden state untrained, and training only the core recurrence operation to perform the task while complying with these frozen components.
Algorithm
Data: Data set D , learning rate η . Initialization: The entries of W (0) , A, M 0 are i.i.d. generated from N (0 , 2 m ) . The entries of B are i.i.d.
generated from N (0 , 1 m ) .
for i = 1 , 2 , 3 ...n do
Randomly sample ( x i , y i ) from the data set D .
[Equation] end  C OMPOUNDED S EQUENCE TO S EQUENCE L EARNABILITY In this section, we present a hypothesis class and prove for it that the above described “teacher forcing" (Williams & Zipser, 1989) of intermediate supervision at training time with algorithmprovably leads to generalization in polynomial sample complexity and gradient updates.
This guarantee will allow us to prove our positive results in the following sections, as we will show that interesting function families belong to this hypothesis class.
In order to analyze the teacher forcing technique, we begin with an important observation.
Essentially, we show that when the zero-one loss of all the single-hop sub-tasks is low, then it implies that also at test time, when the model does not have the ground truth results of the previous sub-tasks and the errors might accumulate, the zero-one loss on the final answer is still low:
Lemma 1.
Denote by l 0 − 1 the zero-one loss, by z train t :=
y t − 1 the ground truth input at training time, and by z test t := f RNN ,W t −( z test ) the iteratively predicted input at test time.
Then, for any learned hidden weights matrix W the following holds:
[Equation]
Proof.
Clearly, for any x when f RNN ,W (cid:0) z train (cid:1) solves all of the sub-tasks correctly we have that z test =
z train and therefore they have the same zero zero-one loss.
So it is enough to upper bound the probability that f RNN ,W (cid:0) z train (cid:1) is erroneous in any sub-task.
Now by definition, for any t the zero-one loss at the t ’th location is equal to the probability of wrong prediction at this location.
Therefore, by the union bound, we get that the sum of the zero-one loss over all the locations is upper bounding the probability of f RNN ,W (cid:0) z train (cid:1) make an error in any sub-task.
See full details in section A at the appendix.
As expected, due to a union bound, when the model does not have the ground truth results of the previous sub-task the error can increase by a factor of T − d
but this increase is relatively modest as long as T is polynomial in d .
Lemma 1 above assures us that it is enough to find an hypothesis class for which algorithm 1 converges and generalizes when we do have the ground truth results of the previous sub-tasks, in order to prove that the teacher forcing technique works.
As a candidate for such a hypothesis class, we consider tasks for which the output at each location d ≤ t ≤ T can be written as sign of multivariate polynomials of at most N < T input locations j 1 , . . . , j N ≤ t .
Specifically, we assume that each output y t is the sign of a polynomial activation ψ t ( x ) = (cid:80) deg( ψ t ) i = a t,i x i of a linear function (represented by w ( t ) below) of the N one-hot input vectors e z j 1 , . . . , e z jN :
[Equation]
In order to prove convergence and generalization results, we will measure the complexity of functions in the above hypothesis class by a function ϕ
( T, ψ, N ) , described formally in appendix A.
Importantly, ϕ ( T, ψ, N ) is polynomial in both T and max t,i | a t,i | , while exponential in both max t deg ( ψ t ) and N .
We will denote by H ϕ
( T,ψ,N ) the hypothesis class described in eq 6.
Now, with this hypothesis class, we can combine lemma 1 with theorem 2 in Wang et al.
They study the learnability of RNNs for binary classification tasks 2 without intermediate supervision, and prove that algorithm 1 is capable of learning function where the final answer y have low complexity ϕ
( T, ψ, N ) .
Theorem 2.
Denote by z test t [Equation] test ) the iteratively predicted input at test time, and let ϵ, δ > 0 .
Assume we run Algorithm 1 for n > ˜ O
[Equation]
iterations with learning rate η = 1 m √ n , then there exists m ⋆ = poly (cid:0) n, δ − 1 , T (cid:1) such that if m > m ⋆ then for any h ∈
H ϕ ( T,ψ,N ) with probability at least 1 − δ over the randomness in Algorithm 1, the following holds:
[Equation]
where W ( i ) denotes the output of Algorithm 1 at the i ’th iteration and l 0 − 1 is the zero-one loss.
Note that sections C,D of the appendix extends theorem 2 for both SGD and GD with finite precision.
In the next sections, we will prove our positive results by showing the intermediate single-hop subtasks of the analyzed tasks belong to H ϕ
( T,ψ,N ) with low complexity ϕ
( T, ψ, N ) .
L EARNING B IT -S UBSET P ARITY W ITH S EQUENCE TO S EQUENCE M ODELS
As a concrete demonstration, in this section we show that unlike the end-to-end case, bit-subset parity can be learned with neural networks when intermediate supervision is provided.
We begin by defining the challenging task of learning parities over unknown subsets of input bits.
Specifically, for a d -bit string with a subset of d / 2 randomly predefined unique indices i 1 , . .
, i d / 2 , our goal is to train a predictor mapping x ∈ { 0 , 1 } d to y =
( − 1) (cid:80) d/ 2 j =1 x ij where x is uniformly distributed.
In words, y indicates whether the number of 1 ’s in the given subset of coordinates of x is odd or even.
We analyze this task as a “multi-hop" task by decomposing it into natural intermediate sub-tasks: parities of subsets of the predefined input subset x i 1 , ..., x i d/ 2 .
Concretely, assuming for simplicity that d / 2 is a power of 2 , and beginning with only two adjacently indexed input bits at a time, we recursively treat the parity of every two adjacently indexed subgroups as an intermediate task.
Figure 2(a) illustrates this binary tree sub-task decomposition of our parity problem.
The leaves of the tree of intermediate labels T are − 1 x i 1 + x i 2 , . .
, − 1 x id/ 2 − 1 + x id/ 2 and each node in the tree represents the sub-task of calculating the parity function over its descendants.
In order to fit into the sequence-to-sequence setting of section 3, we translate our imaginary tree of intermediate labels T into a sequence of intermediate labels S by inverse-BFS like tree traversal, and then concatenate the sequence S after the input x .
An exact formulation of the mapping from tree T to sequence of intermediate labels S is given in appendix B.
5. L EARNABILITY OF B IT -S UBSET P ARITY W ITH AND W ITHOUT I NTERMEDIATE S UPERVISION
In this section we show that the sub-tasks of learning bit-subset parity are simple enough to be covered by the result in theorem 2, i.e. , we prove that our sequence-to-sequence formulation of the bit-subset parity target function, which includes the intermediate labels sequence S defined above, can be written as a multivariate function where each of its outputs is a simple low degree polynomial of at most O (1) inputs bits.
We show that this is indeed the case, i.e. , that all the parity target functions comprising the intermediate supervision to our problem belong to H ϕ
( T,ψ,N ) (see section 4) with N , max t deg ( ψ t ) , max t,i | a t,i | that do not grow with d .
Importantly, when defining the input sequence to be only the original input, without the concatenated sub-task decomposition labels, then the function h T ( x ) clearly depends on d / 2 bits, and therefore will require N = d / 2 , that leads to exponential complexity ϕ
( T, ψ, N ) =
Ω (cid:0) e d (cid:1) .
Thus, no efficient learning is guaranteed for the original compounded task.
We begin by showing that our single-hop tasks of parities over two bits (see illustration in figure 2(a)) are simple degree- 2 polynomials:
Lemma 2.
There exists degree two polynomial ψ ( x )
=
a 2 x 2 + a 1 x + a 0 with bounded coefficients ∀ i | a i | < 10 as well as w ∈ R 4 such that:
[Equation]
Proof.
We will use w to sum the first coordinates of e z 1 , e z 2 , and use polynomial interpolation to find a degree two polynomial ψ that interpolates the z 1 =
z 2 = 0 , z 1 ̸ =
z 2 , z 1 = z 2 = 1 points, see full details in appendix B.
The above lemma implies that all of the target functions in our defined intermediate supervision belong to H ϕ
( T,ψ,N ) for ϕ
( T, ψ, N ) =
O ( d ) .
Therefore, together with theorem 2, it assures us that when intermediate supervision is available, Algorithm 1 can learn bit-subset parities with polynomial network size, sample complexity and number of gradient updates.
Now, after we showed that when incorporating intermediate supervision bit-subset parities can be learned by a neural network, we will use the results of Shalev-Shwartz et al.
(2017) to establish an exponential gap between the end-to-end and decomposition-based neural network learnability 3 :
Corollary 1.
When learning bit-subset parities using neural networks, the following holds:
• On one hand, when equipped with sub-task decomposition supervision, a simple sequenceto-sequence model can get arbitrarily low ϵ >
zero-one loss with number of gradient updates that is polynomial in d, ϵ − 1 .
• On the other hand, when supervision regarding sub-task is missing, then for any (constant) ϵ > 0 with high probability over the target parity, the zero-one loss will be higher than/ 2 − ϵ unless the number of gradient updates is exponential in d .
Proof.
Follows directly by combining theorem 2 and lemma 2 with the the negative results in
Shalev-Shwartz et al.
See full details in section F at the appendix.
5. B IT -S UBSET P ARITY E XPERIMENTS
In section 5.1 we proved an exponential gap when using Elman RNNs (Elman, 1990) to learn bitsubset parity with and without sub-task decomposition.
This section empirically demonstrates that the same gap exists with the commonly used Transformer (Vaswani et al., 2017) architecture.
We trained a series of models while varying the input sizes from 8 bits to 128 bits.
For each input size, we trained a BERT-base sized Transformer model for 100 k iterations 4 with and without intermediate supervision.
The intermediate supervision was introduced exactly as described in the previous subsection, see Figure 2 for an illustration.
See full technical details of the training apparatus in appendix G.
[Table]
Figure 3 clearly shows that in a practical setting, using common Transformer networks, a very large gap quickly opens between the settings with and without intermediate supervision.
The employed
BERT base sized Transformer architecture is a strong network that pushed the envelope on very challenging NLP tasks, and is much stronger than the theoretically analyzed RNN.
Still, learning even the 32 bit subset parity task without supervision proved to be too challenging even for this network (no learning after over 2 M steps), while it easily learned the task in the presence of intermediate supervision.
Overall this experiment, performed on the same task on which we prove our theoretical results, reinforces their relevance to common Transformer architectures.
U NIVERSALITY OF D ECOMPOSITION B ASED S EQUENCE -T O -S EQUENCE L EARNING
In this section, we prove our main result (outlined in the introductory theorem 1).
On the one hand, we generalize the positive results of section 5.1 by showing that when sufficient intermediate supervision is available, a neural network can efficiently learn any function in the P time complexity class.
On the other hand, we rely on existing works (Valiant, 1984;
Goldreich et al., 1986; Daniely & Shalev-Shwartz, 2016) to show that under either standard cryptographic assumptions or computational complexity hardness assumptions, there exist functions in the P time complexity class that cannot be learned by any polynomial time learning algorithm without intermediate supervision.
We begin by defining the decomposition of any function f in the P time complexity class into sub tasks.
For that, we will use the fact that any such f has polynomial circuit complexity (see for example theorem 9.30 in Sipser (2013)), and therefore can be computed by a boolean circuit with polynomial size.
We will denote by G =
( V, E ) the directed acyclic graph associated with such a circuit, and by l v the logic gates of each vertex v .
Furthermore, since both the“AND" and “OR" logical gates can be decomposed into a boolean circuit with binary-tree like structure, we may assume that the input degree of each vertex is O (1) .
[Figure]
While this definition is somehow arbitrary, in practice we observed a grokking phenomenon (Power et al., 2021) where very soon after the accuracy became higher than random level it also became almost perfect (accuracy > 95% ).
Now, in order to fit into the sequence-tosequence setting of section 3, we define the intermediate labels sequence S for any f .
Basically, each non-leaf vertex v ∈ V will represent an intermediate task with its ground-truth label determined by l v , and we will use a topological sorting of G in order to translate G into a sequence of intermediate labels S with length T :=
| V | (see figure 2 for a concrete exam- ple of this abstract construction strategy).
Importantly, as in the bit-subsets parity task, T is polynomial in d .
In order to show our generalized positive result, theorem 2 motivates us to prove that our sequence-to-sequence formulation of any function f in the P time complexity class, which includes the intermediate labels sequence S defined above, can be written as a multivariate function where each of its outputs is a simple low degree polynomial of at most O (1) input bits.
Lemma 3 below shows that this is indeed the case, i.e. , that all the target functions comprising the intermediate supervision to our problem belong to H ϕ
( T,ψ,N ) (see section 3) with N , max t deg ( ψ t ) , max t,i | a t,i | that do not grow with d .
Lemma 3.
For any logical gate l v : { 0 , 1 } N → { 0 , 1 } with N = O (1) , there exists O (1) degree polynomial ψ ( x )
= (cid:80) deg ( ψ ) i =
a i x i with bounded coefficients max i | a i | =
O (1) as well as w ∈ R 2 N such that:
[Equation]
Proof.
We will use w to uniquely represent each possible combination of z 0 , . . .
, z N as an N bit real value number, and use polynomial interpolation to find a 2 N -degree polynomial ψ that interpolates the z 1 = · · · = z N = 0 , . . .
, z 1 = · · · = z N = 1 points.
Finally the O (1) coefficients boundedness follow from taking maximum 5 over all possible l v logical gates.
see full details in appendix B.
The above lemma implies that all of the target functions in our defined intermediate supervision belong to H ϕ
( T,ψ,N ) for ϕ
( T, ψ, N ) =
O ( d ) .
Therefore, together with theorem 2, it assures us that when intermediate supervision is available, Algorithm 1 can learn any function in the P time complexity class with polynomial network size, sample complexity and number of gradient updates.
Now, after we showed that when incorporating intermediate supervision any function in the P time complexity class can be learned by a neural network, our main results is a simple corollary of the above results:
Corollary 2.
Under either standard cryptographic assumptions or computational complexity hardness assumptions, there exists a binary classification problem parameterized by size d , such that the following holds
: • On one hand, when equipped with sub-task decomposition supervision, a simple sequenceto-sequence model can get arbitrarily low ϵ > 0 zero-one loss with number of gradient updates that is polynomial in d, ϵ − 1 .
• On the other hand, when supervision regarding sub-task is missing, then for any polynomial time learning algorithm and (constant) ϵ > 0 , the zero-one loss will be higher than 1 / 2 − ϵ .
Proof.
Follows directly by combining theorem 2 and lemma 3 with either the negative results in
Valiant (1984);
Goldreich et al.
(1986) or in Daniely & Shalev-Shwartz (2016).
D ISCUSSION
In this paper, we show for a broad family of functions an exponential gap between learning algorithms that rely on intermediate supervision and algorithms that do not rely on intermediate supervision.
Across domains and architectures, there has been a wide range of proposed methods for introducing intermediate supervision.
Some design specialized architectures, some add relevant loss terms, etc.
The method that is taking over in the NLP domain is straightforward, and is particularly natural for this domain in which the core architectures are strong sequence-to-sequence Language
Models: Concatenate the intermediate supervision to the input, and thus jointly train the model to maximize the likelihood of all the intermediate labels as well as the overall output.
Our analysis is framed in this space, and motivates this intuitive incorporation of intermediate supervision in the framework of sequence-to-sequence models.
We show that even with a simple sequence-to-sequence architecture it is feasible to expect such simultaneous compounded learning to be useful.
In this regard, we view our work as providing timely theoretical feedback to the rapid empirical advances in this field.
Limitations:
We proved universal learnability results when sufficient intermediate supervision was provided.
A fundamental question is what happens when we limit the amount of sub-task supervision.
For the task of bit-subset parity, we demonstrated that supervision regarding O ( d ) sub-tasks can yield an exponential advantage.
An interesting question that we leave open for future work is whether there exists a similar advantage with only O (1) sub-tasks.
In addition, while our results show an exponential gain, it is still unclear which sub-tasks are solvable by end-to-end methods, and which tasks require decomposition?
Interestingly, a recent study (Abbe et al., 2022) addressed exactly this question for one-layer hidden networks in the mean-field regime.
However, our understanding of this question for practical architectures is still very limited.
Reproducibility Statement: A complete proof of all the theoretical claims was included in the appendix.
We also provide the source code for the bit-subset parity experiment in the supplemental materials.
A C OMPOUNDED S EQUENCE TO S EQUENCE L EARNABILITY D ETAILS
We start by formally defining our sequence-to-sequence functions complexity measure as:
[Equation]
Where C > 0 is some constant.
Now we prove lemma 1 from the main text.
Essentially this lemma applies the union bound to show that when the zero-one loss of all the single-hop sub-tasks is low, then also at test time — when the model does not have the ground truth results of the previous sub-task and errors may accumulate — the zero-one loss on the final answer is still low.
Proof.
Denote by ϵ the zero-one loss for z train , i.e. , the right hand side in eq 5.
Clearly, for any x when f RNN ,W (cid:0) z train (cid:1) solves all the sub-tasks correctly we have that z test =
z train and therefore l 0 − 1 (cid:16) y, f RNN ,W T ( z test ) (cid:17)
= 0 .
So it is enough to upper bound the probability that f RNN ,W (cid:0) z train (cid:1) makes an error in any sub-task by ϵ .
But by the zero-one loss definition, for any t we have that:
[Equation]
And therefore (cid:80) Tt =
d P x (cid:16) f RNN ,W t (cid:0) z train (cid:1) ̸
= y t (cid:17) =
ϵ .
Finally, by the union bound we got that
[Equation]
B S UB T ASKS L EARNABILITY P ROOFS
In this section we prove lemmas 2,3 from the main text, i.e. , we prove that our intermediate steps are simple enough to be covered by theorem 2.
We begin by formally describing the details of learning parities with sequence-to-sequence models.
Since sequence-to-sequence models expect their inputs to be sequences, we will translate the tree described in section 5 into a sequence by inverse BFS like tree traversal, and concatenate the result sequence after x .
Therefore, our inputs sequence includes all the d variables in x , together with all the sub-tasks decomposition nodes in the binary tree except the root (that represent y ).
So we will have an input sequence length T that is equal to:
[Equation] [Equation]
And the ground-truth sub-task results are recursively defined by:
[Equation]
else (14)
For t > d , at training time, z t will be the ground-truth sub-task result y t − 1 .
At test time z t will be the model prediction at time t − 1 :
[Equation]
Note that f RNN is causal model, i.e. f RNN tdoes not depend on z t 2 for any t 2 > t 1 , and therefore eq 15 is well defined.
Now, we prove lemma 2 from the main text.
Essentially this lemma shows that the intermediate steps of length 2 parities belong to the hypothesis class define in eq 6.
Proof.
Define w := 1 √
[Equation]
 , then
[Equation]
Therefore
[Equation]
it is enough to find ψ such that
[Equation]
Finally
[Equation]
we will use Lagrange basis functions to find the required polynomial and get:
[Equation]
Now we prove lemma 3 from the main text.
Essentially this lemma shows that also our intermediate steps for any functions in the P time complexity class belongs to the hypothesis class define in eq 6.
Proof.
Denote α ( z 1 , . . .
, z N ) :
= (cid:80) N − 1 i =0 2 i · 1 z i =
the function that converts N bits to their binary string, and define w := (cid:113) 3 4 N −  
 202 ...
2 N −     , then w is a unit vector that represents z 1 , . . .
, z N as N bit numbers
[Equation]
z N ) .
Now, we can use the Lagrange basis functions to find the required polynomial:
[Equation]
Finally the O (1) coefficients boundedness follows from taking the maximum 6 over all possible f v functions.
C E XTENSION FOR SGD WITH FINITE PRECISION
In this section, we prove theorem 2 from the main text holds also for algorithm 2 which is a finiteprecision variant of SGD 7 . .
We will follow the proof in Wang et al.
(2021) while taking into account the finite precision gradients.
Data: Data set learning rate η finite precision σ .
Initialization: The entries of W (0) , A, M generated
.d
N m entries of B are generated i.i.d from N (0 , 1 m ) .
for i = 1 , 2 , 3 ...n do
Randomly sample ( x i , y i ) from the data set D .
Get arbitrary σ -approximation of the gradient:
[Equation]
Update weights:
[Equation]
end
We begin by stating theorem 2 9 in Wang et al.
(2021) with our notations:
Theorem 3.
Let δ > 0 , and assume we run algorithm 1 for n iterations with learning rate η = 1 m √ n .
Then there exists m ⋆ = poly (cid:0) n, δ − 1 , T (cid:1) such that if m > m ⋆ then for any h ∈ H ϕ
( T,ψ,N ) with probability at least 1 − δ over the randomness in algorithm 1, the following hold:
[Equation]
where W [ i ] denote the output of algorithm 1 at the i ’th iteration and l 0 − 1 is the zero-one loss.
Clearly when using infinite precision SGD theorem 2 follows from theorem 3 and lemma 1 by simple algebraic manipulations.
Therefore, for proving theorem 2 with finite precision gradient based optimization, it is enough to modify theorem’s 3 proof to analyze algorithm 2 that uses finite precision gradients, instead of algorithm 1 that uses full precision gradients.
While complicated, Wang et al. (2021)’s proof for theorem 3 can be divided into two high-level arguments.
The first argument measure the complexity of the learned hypothesis class with respect to random initialization of f RNN (lemma 6).
And the second argument is a generalization bound for algorithm 1 with networks that are overparameterized enough.
Since the first argument is independent of the gradients, the proof of the first argument still holds and we only need to prove a generalization bound for algorithm 2.
More specifically we only need to prove a lemma that is equivalent to lemma 14 in Wang et al.
(2021) and the rest of the second argument (lemma 7 in Wang et al.
(2021)) remain unchanged.
Lemma 4.
Let n ∈ N , and denote by L i ( W ) :
= l (cid:0) y
( i ) , f RNN ,W (cid:0)
z ( i ) (cid:1)(cid:1) the training loss.
Suppose there exists W ⋆ ∈ B 10 (cid:16) W (0) , R √ m (cid:17) such that R
=
O ( poly ( T ))
=
Ω (cid:0) T 16 (cid:1) and L i ( W ⋆ ) ≤ 1+ R 2 n .
Then for any δ > 0 there exists m ⋆ = poly (cid:0) n, R, T, δ − 1 (cid:1) such that if m > m ⋆ then with probability at least 1 − δ algorithm 2 with η = 1 m √ n and finite precision σ = O (cid:0) 1 m (cid:1) will output:
[Equation]
Proof.
We begin by showing that with high probability over the initialization of f RNN , at any iteration i ≤ n of algorithm 2, the distance of the learned hidden weights matrix W ( i ) from its initialization point W (0) is not too large.
As a results we will get that the assumption of lemmauphold, and therefore its upper bound of the deviation from linearization is valid.
By the triangle inequality for any 0 ≤ i < n we have that:
[Equation]
Substituting algorithm 2 update rule for W ( k +1) , we get that there exist ∥ σ i ∥ ∞ < σ such that:
[Equation]
Now, explicitly writing ∇ W ( k ) ℓ ( y k , f RNN ,W ( k ) ( z k )) with the chain rule we have that: ∇
W
[Equation]
and since 0 ≤ x 1+ x ≤ 1 for any x ≥ 0 , we conclude that:
[Equation]
Now we will use an induction over i , to show that (cid:13)(cid:13) W
( i +1)
− W (0) (cid:13)(cid:13) F = O (cid:16) ( i +1) T 8 m ·√ n (cid:17) for any 0 ≤ i < n .
By the induction hypothesis, lemma 10 assure us that for wide enough networks m ⋆ = Ω
[Equation]
max (cid:8) T 6 log 3 (cid:0) n · Tδ (cid:1) , √ nT 8 (cid:9)(cid:1) , with probability of at least 1 − δ over the initialization of f RNN , max d ≤ t ≤ T (cid:13)(cid:13)(cid:13) ∇ W ( k ) f RNN ,W ( k ) t ( z k ) (cid:13)(cid:13)(cid:13) F = O (cid:0) T 8 (cid:1) .
Therefore, in this case
[Equation]
(29) and hence (cid:13)(cid:13) W ( i +1) − W (0) (cid:13)(cid:13) F = O (cid:16) ( i +1) T 8 m ·√ n (cid:17) as required.
Now after we showed the assumptions of lemma 8 upholds, we can use it to obtain first order Taylor approximation of the training loss:
[Equation]
Where we assumed that m ⋆ > n and therefore (cid:13)(cid:13) W ( i ) − W (0) (cid:13)(cid:13) F < O (cid:16) R √ m (cid:17) .
Using algorithm 2 update rule for W ( i +1) again (see eq 26), we can use an inequality from in ShalevShwartz & Ben-David (2014)’s lemma 14.1 to get that:
[Equation] [Equation]
Now combing with Cauchy–Schwarz inequality we have that:
[Equation]
Substituting the upper bounds from eqs 28, 29 and using the assumption that R = Ω (cid:0) T 16 (cid:1) we get that:
[Equation]
To ensure the left hand side is upper bounded by O (cid:0) R 2 √ n (cid:1) we will chose m ⋆ such that m ⋆ (log 3 m ⋆ ) > n 92 , note that, as required, m ⋆ is polynomial in n, T .
Then for m > m ⋆ we have that (cid:80)
[Equation]
=1 L i (cid:0) W
[Equation]
i )
[Equation]
≤ O (cid:0) R 2 √ n (cid:1) .
Therefore,
[Equation]
Now, to prove generalization bound we will follow lemma 4.3 in Ji & Telgarsky (2020) and use a martingale Bernstein bound argument.
We begin by showing that during the whole training process, our binary cross entropy loss is bounded.
Indeed lemma 9 assure us that :
[Equation] [Equation]
Therefore, their exist a constant C > 0 such that the binary cross entropy loss is bounded by log (cid:16) 1 + e O
( T 14 ) (cid:17)
[Equation]
Now, we will define a bounded martingle.
For any i ≥ 0 , let s i denote ( x i , y i ) and s 0 ,i denote ( s 0 , . . .
, s i ) .
Importantly, the quantity
[Equation] [Equation]
is a martingal w
[Equation]
r
[Equation]
t the filration σ ( s 0 ,i − 1 ) .
This martingal difference sequence is given by
[Equation]
Moreover
[Equation]
we have
[Equation]
Therefore, by lemma C.2 in Ji & Telgarsky (2020) we have that with probability 1 − δ
[Equation]
And hence n (cid:88)
[Equation]
Finally, for y t · f RNN ,W t ( z ) < 0 we have that log (cid:16) 1 + e − y t · f RNN ,W
[Equation]
( z ) (cid:17) > log 2 .
In addition, clearly log (cid:16)
+ e − y t · f RNN ,W t ( z ) (cid:17) > 0 .
Therefore, we conclude that 1 T − d (cid:80) Tt =
d l o − 1 (cid:16) y t , f RNN ,W ( i ) t ( z ) (cid:17) <
1 log2 l (cid:16) y , f RNN ,W ( i ) ( z ) (cid:17) and thus eq 24 uphold.
D E XTENSION FOR GD WITH FINITE PRECISION
In this section, we prove theorem 2 from the main text still holds when using the gradient descent based algorithm 3, instead of the stochastic gradient descent based algorithm 2. .
Establishing our positive results that the parities task is efficiently learnable with sub-task decomposition supervision in the exact same setting of the negative results that show that learning is impossible without intermediate supervision, presented in section F.
We will follow the proof in section C while taking into account the full non-stochastic gradients.
Data: Data set D , learning rate η , finite precision σ .
Initialization: The entries of W (0) , A, M 0 are generated i.i.d.
from N (0 , 2 m ) .
The entries of B are generated i.i.d.
from N (0 , 1 m ) .
for i = 1 , 2 , 3 ...n do
Get arbitrary σ -approximation of the gradient:
[Equation]
Update weights:
[Equation]
end
We begin by sampling a fake training set denoted by x (1) , . . .
, x ( n ) , y (1) , . . .
, y ( n ) .
Essentially, we will apply the same reasoning as in section C with this fake training points.
As in the finite precision
SGD case it is enough to prove a lemma that is equivalent to lemma 4 in section C.
Lemma 5.
Let n ∈ N , and denote by L i ( W ) :
= l (cid:0) y
( i ) , f RNN ,W (cid:0)
z ( i ) (cid:1)(cid:1) the training loss.
Suppose there exists W ⋆ ∈ B 12 (cid:16) W (0) , R √ m (cid:17) such that R =
O ( poly ( T ))
=
Ω (cid:0) T 16 (cid:1) and L i ( W ⋆ ) ≤ 1+ R 2 n .
Then for any δ > 0 there exists m ⋆ = poly (cid:0) n, R, T, δ − 1 (cid:1) such that if m > m ⋆ then with probability at least 1 − δ algorithm 3 with η = 1 m √ n and finite precision σ = O (cid:0) 1 m (cid:1) will output:
[Equation]
Proof.
We begin by showing that there exists ˜ W ∈ B (cid:16) W (0) , T 8 √ m
[Equation]
such that:
[Equation]
Indeed, since the minimum can not be larger than the mean, eq‘50 in the proof of lemma 4 assure us that under the assumptions of lemma 5, for m > max (cid:8) n 2 , ln 4 (cid:0) 1 δ (cid:1)(cid:9) , with probability of at least 1 − δ algorithm 2 will reach such ˜ W during the first max (cid:8) n, ln 2 (cid:0) 1 δ (cid:1)(cid:9) SGD iteration.
Now we shows that that with high probability over the initialization of f RNN , at any iteration i ≤ n of algorithm 3, the distance of the learned hidden weights matrix W ( i ) from its initialization point
W (0) is not too large.
As a results we will get that the assumption of lemma 8 uphold, and therefore its upper bound of the deviation from linearization is valid.
By the triangle inequality for any 0 ≤ i < n we have that:
[Equation]
Substituting algorithm 3 update rule for W ( k +1) , we get that there exist ∥ σ i ∥ ∞ < σ such that:
[Equation]
[Equation]
Now, explicitly writing ∇ W ( k ) ℓ ( y , f RNN ,W ( k ) ( z )) with the chain rule we have that:
[Equation]
56) and since 0 ≤ x 1+ x ≤ 1 for any x ≥ 0 , we conclude by Jensen’s inequality that:
[Equation]
Now we will use an induction over i , to show that (cid:13)(cid:13) W
( i +1)
− W (0) (cid:13)(cid:13) F = O (cid:16) ( i +1) T 8 m ·√ n (cid:17) for any 0 ≤ i < n .
By the induction hypothesis, lemma 10 assure us that for wide enough networks m ⋆ = Ω (cid:0) max (cid:8) T 7 log 3 (cid:0) n · Tδ (cid:1) , √ nT 8 (cid:9)(cid:1) , with probability of at least 1 − δ over the initialization of f RNN , E x (cid:104)(cid:13) (cid:13) (cid:13) ∇ W ( k ) f RNN ,W ( k ) t ( z )
[Equation]
(cid:13) (cid:13) F (cid:105)
=
O (cid:0) T 8 (cid:1) for any d ≤ t ≤ T .
Therefore, in this case (cid:13)(cid:13)(cid:13)
[Equation]
k +
[Equation]
(cid:19) (58) and hence (cid:13)(cid:13) W ( i +1) − W (0) (cid:13)(cid:13) F
= O (cid:16) ( i +1)
T 8 m ·√ n (cid:17) as required.
Now after we showed the assumptions of lemma 11 upholds, we can use it to obtain first order Taylor approximation of the training loss for any x : l
[Equation]
[Equation] [Equation]
Where we assumed that m ⋆ > n and therefore (cid:13)(cid:13) W ( i ) − W (0) (cid:13)(cid:13) F < O (cid:16) T 8 √ m (cid:17) .
Using algorithm 3 update rule for W ( k +1) again (see eq 55), we can use an inequality from ShalevShwartz & Ben-David (2014)
’s section 14.1.1 to get that
[Equation]
Now
[Equation]
we can take expectation over eq
[Equation]
and combine the Cauchy–Schwarz inequality with the above bound and get that:
[Equation]
Substituting the upper bounds from eqs 57, 58 we get that: n
[Equation]
To ensure the left hand side is upper bounded by O (cid:0) R 2 √ n (cid:1) we will chose m ⋆ such that m ⋆ (log 3 m ⋆ ) > n 92 , note that, as required, m ⋆ is polynomial in n, T .
Then since eq 53 assure us that
E x
[Equation]
l
[Equation]
y , f RNN , ˜ W ( z )
[Equation]
≤ O (cid:16) R 2 √ n (cid:17) , we have that (cid:80)
[Equation]
=
[Equation]
x
[Equation]
y , f RNN ,W ( i ) ( z ) (cid:17)(cid:105) ≤ O (cid:0) R 2 √ n (cid:1) for m > m ⋆ .
Therefore,
[Equation]
Finally, for y t · f RNN ,W t ( z ) < 0 we have that log (cid:16) 1 + e − y t · f RNN ,W t ( z ) (cid:17) > log 2 .
In addition, clearly log (cid:16)
+ e − y t · f RNN ,W t ( z ) (cid:17) > 0 .
Therefore, we conclude that 1 T − d (cid:80) Tt =
d l o − 1 (cid:16) y t , f RNN ,W ( i ) t ( z ) (cid:17) <
1 log2 l (cid:16) y , f RNN ,W ( i ) ( z ) (cid:17) and thus eq 52 uphold.
E L EARNABILITY O F RNN S
In this section we state and extend several lemmas from Wang et al.
and Allen-Zhu et al.
We will use this lemmas in sections C,D for extending theorem 2 in the main text for finite precision SGD and GD.
Following Wang et al.
(2021)’s notations, for any target function h ∈ H
ϕ
( T,ψ,N ) and n samples (cid:0) z
( i ) (cid:1) n i
=1 we will denote:
[Equation] [Equation]
and
[Equation]

[Equation]
We start with theorem 4 13 from Wang et al.
(2021) measuring the complexity of a learned hypothesis class with respect to random initialization of f RNN .
Lemma 6.
Let δ > 0 and n ∈ N , then there exist m ⋆ = poly (cid:0) n, δ − 1 , T (cid:1) such that if m > m ⋆ then for any h ∈ H ϕ
( T,ψ,N ) and (cid:0) z
( i ) (cid:1) n i
=1 with probability at least 1 − δ over the random initialization of f RNN there exists matrices H d, ∞ , H d +1 , ∞ , . .
, H T, ∞ ∈ R n × n such that for any d ≤ t ≤ T the following holds:
There exist v ( t ) ∈ B F (cid:32) 0 , 100 (cid:113) ( ˜ y
[Equation]
t ) )
T ( H t, ∞ ) − 1 ˜ y
[Equation]
t ) (cid:33) such that H t + (cid:0) v ( t ) (cid:1) T v ( t ) − H t, ∞ is positive semi-definite matrix.
(cid:113)(cid:0) ˜
y ( t ) (cid:1) T ( H t, ∞ ) − 1 ˜ y
( t ) =
O (cid:16) (cid:112) ϕ
( T, ψ, N ) (cid:17) .
Now we state lemma 15 from Wang et al.
Essentially this lemma state that with high probability over the initialization of f RNN , there exists weights that are not far from the initialization and have low training loss.
Lemma 7.
Let (cid:0) z
( i ) , y ( i ) (cid:1) n i =1 be the training set and denote by L i ( W ) :
= l (cid:0) y
( i ) , f RNN ,W (cid:0)
z ( i ) (cid:1)(cid:1) the training loss.
Then for any δ > 0 there exists m ⋆ = poly (cid:0) n, R, T, δ − 1 (cid:1) such that if m > m ⋆ then with probability at least 1 − δ , there exist W ⋆ ∈ B (cid:16) W (0) , R √ m (cid:17) such that L i ( W ⋆ ) ≤ 1+ R 2 n and R =
˜ O (cid:18) T (cid:80) Tt =
d (cid:113)(cid:0) ˜
y ( t ) (cid:1) T ( H t, ∞ ) − 1 ˜ y
( t ) (cid:19) .
Now we state theorem 13 from Wang et al.
Essentially this lemma bounds the finite width deviation of f RNN from its infinite width neural tangent kernel (Jacot et al., 2018).
Lemma 8.
Let m, n ∈ N and r = O (cid:16) poly ( n,T ) √ m (cid:17) , then with probability of at least 1 −
O ( n ) exp (cid:16) − Ω (cid:16) m 13 (cid:17)(cid:17) 14 over the initialization of f RNN , for all (cid:0) z
( i ) (cid:1) n i =1 and W, ˜ W ∈ B (cid:0) W (0) , r (cid:1) for any d ≤ t ≤ T and i ∈ [ n ] the following hold:
[Equation]
Now we state a simple corollary of lemmas B.3 and C.2.a in Allen-Zhu et al.
Essentially this corollary bound the output of f RNN with high probability over its initialization.
Lemma 9.
Let m ∈ N and W ∈ B 15 (cid:16) W (0) , poly ( T ) √ m (cid:17) , then for a given x and d < t ≤ T with probability of at least 1 − e − Ω
[Equation]
m 13 T
[Equation]
over the random initialization of f RNN the following hold:
[Equation]
Moreover, with probability of at least 1 − e O ( T ) − Ω (cid:18) m 13 T 2 (cid:19) also the following holds:
[Equation]
Proof.
We begin by showing that it is enough to bound h t ( z ) .
This is indeed the case since it is well known that ∥ B ∥ 2 = O (1) with probability of at least 1 − e − Ω( m ) (see for example Bandeira & Van Handel (2016)).
Now lemma B.3 from Allen-Zhu et al.
(2019) assure us that (cid:13)(cid:13)(cid:13) h W (0) t ( z ) (cid:13)(cid:13)(cid:13) =
O ( t ) , and finally lemma C.2.a from Allen-Zhu et al.
(2019) bounds the deviation from the initialization (cid:13)(cid:13)(cid:13)
h
Wt ( z ) − h W (0)
t ( z ) (cid:13)(cid:13)(cid:13) =
O (cid:0) T 6 (cid:13)(cid:13) W − W
(0) (cid:13)(cid:13) F (cid:1) .
Finally a simple union bound on all the possible d bits configurations prove also equation 74.
Now, we use lemma 9 proof together with lemmas B.11 and C.9 from Allen-Zhu et al.
(2019) to prove a lemma that bounds the magnitudes of f RNN ’s gradients.
We will use this lemma for bounding the finite width deviation of f RNN from its infinite width neural tangent kernel (Jacot et al., 2018).
Beyond its application for proving our positive results, lemma 10 below also implies that f RNN , for which we proved our positive results when intermediate supervision exists, upholds the polynomially bounded gradients requirement in the parities negative results with high probability.
Thus proving the actual factor enabling efficient learning is, therefore, intermediate supervision.
Lemma 10.
Let m ∈ N and W ∈ B 16 (cid:16) W (0) , poly ( T ) √ m (cid:17) , then for a given x and d < t ≤ T with probability of at least 1 − e − Ω
[Equation]
over the random initialization of f RNN the following hold:
[Equation]
Moreover, with probability of at least 1 − e O ( T ) − Ω (cid:18) m 13 T 2 (cid:19) it holds simultaneously for all x ’s and t ’s.
Proof.
Let D t ∈ R m × m be a diagonal matrix that its diagonal equals to 1 when h Wt ( z ) > 0 and otherwise 0 .
Then we can write the gradients of f RNN as:
[Equation]
The proof of lemma 9 assure us that (cid:13)(cid:13)
h
Wt ( z ) (cid:13)(cid:13) =
O (cid:0) T 6 (cid:13)(cid:13) W − W
(0) (cid:13)(cid:13) F + t (cid:1) with probability of at least 1 − e − Ω (cid:18) m 13 T 2 (cid:19) over the random initialization of f RNN .
In addition, lemma B. together with lemma C.9.d from Allen-Zhu et al.
(2019) assure us that (cid:13)(cid:13)(cid:13)(cid:81) i +1 j = t (cid:0) W T D t (cid:1)(cid:13)(cid:13)(cid:13) 2 =
O (cid:0) T 7 (cid:13)(cid:13) W − W
(0) (cid:13)(cid:13) F + T 3 (cid:1) for all i, j with probability of at least 1 − e − Ω (cid:18) m 13 T 2 (cid:19) .
Now, it is well known that ∥ B ∥
= O (1) with probability of at least 1 − e − Ω( m ) (see for example Bandeira & Van Handel (2016)), and clearly ∥ D t ∥ 2 ≤ 1 for any t .
Therefore, overall we got that equationholds with probability of at least 1 − e − Ω (cid:18) m 13 T 2 (cid:19) .
Finally, a simple union bound on all the possible d bits configurations and T − d t ’s proves the bound holds simultaneously for all x ’s and t ’s.
Finally, we rely on lemma 8 from Wang et al.
(2021) to bounds the finite width deviation of f RNN from its infinite width neural tangent kernel (Jacot et al., 2018).
Lemma 11.
Let m ∈ N and r = O (cid:16) poly ( T ) √ m (cid:17) , then with probability of at least 1 − exp (cid:16)
O
( T log T )
− Ω (cid:16) m 13 (cid:17)(cid:17) over the initialization of f RNN , for all W, ˜ W ∈ B (cid:0) W (0) , r (cid:1) the following hold:
[Equation]
Proof.
Simple union bound on all the possible
d bits configurations
F B IT -S UBSET P ARITY E ND -T O -E ND N EGATIVE R ESULT P ROOFS
In this section, we present a theorem stating that without intermediate supervision, for any neural network with gradients that are polynomially bounded, one must use an exponential number of GD steps to achieve non negligible accuracy in the above-presented task of bit subset parity.
Theorem 4.
Let f θ be any neural-network with E x (cid:104)(cid:13)(cid:13)
∂∂θ f θ ( x ) (cid:13)(cid:13) 2 (cid:105) =
O ( poly ( d )) 17 (polynomially bounded gradients), and let A be any iterative gradient-based 18 optimization algorithm that runs for n
=
O ( poly ( d )) iterations, and at each iteration receives Ω (cid:0) e − d / 3 (cid:1) -approximation of E x [ ∇ l ( y, f θ ( x ))] .
Then, with probability of at least 1 − O (cid:0) e − d / 3 (cid:1) over the target parity function, the loss of A will be higher than 12 − O ( e − d ) .
This theorem follows directly from Shalev-Shwartz et al.
(2017) and Shamir (2018)
and from the fact that random guessing has high zero-one loss, see full proof below.
Importantly, lemmashows that f RNN , for which we proved our positive results when intermediate supervision exists, upholds the polynomially bounded gradients requirement in theorem 4 above with high probability.
Moreover, section D shows that our positive results holds also for an finite-precision gradient descent optimization algorithm, for with theorem 4 proves the negative results.
So overall both the positive and negative proof are on the exact same setup and hence corollary 1follows.
We will use abuse of notations and sometimes identify a predictor h ∈ H with the corresponding vector in { 0 , 1 } d that his i ’th coordinate equals to 1 if i is one of the indices in the subset and 0 otherwise.
We start by describing a measure from Shalev-Shwartz et al.
(2017) that quantifies the amount of “signal” on the underlying target function contained in the gradient.
Consider the stochastic optimization problem associated with learning a target function h .
[Equation]
where: F h ( w ) :=
E x [ l ( p w ( x ) , h ( x ))] where l is a loss function, x are the stochastic inputs, and p w is some predictor parametrized by a parameter vector w (e.g. a neural network of a certain architecture).
We assume that F is differentiable.
We measure the variance of the gradient of F with respect to h , when h is drawn uniformly at random from a collection of candidate target functions H :
[Equation]
To measure meaningful learnability, we will define the expected loss of random guessing from α ∈ (0 , 1) fraction of the hypothesis class H as:
[Equation]
As α approaches 1 , this measure reflects the expected loss to be attained by randomly assigning a hypothesis from H .
We will use this measure in the following lemma, which is a direct corollary of theorem 4 in Shamir (2018).
Essentially, this addresses any iterative algorithm (possibly randomized), which relies on an ϵ -approximate gradient oracle to optimize F h in eq 79.
The lemma states that if the number of iterations is not larger than Var ( H , F, w ) − 1 / 3 then with high probability, the algorithm will return the same predictor independent of h .
Lemma 12.
Define ϵ = 3 (cid:112) sup w Var
( H , F, w ) and let A be any iterative gradient-based 19 optimization algorithm that runs for n iterations, and at each iteration receives Ω ( ϵ ) -approximation of ∇ F h ( w ) .
Then the following holds:
[Equation]
Lemma 12 above assures us that in order to prove negative learning results regarding some task, it is enough to show it has both exponentially low variance of gradient and high random guessing error.
Now we will show both of these for the task of learning bit subset parity presented in section 5.
Following Shalev-Shwartz et al.
(2017), we start by showing that different parities functions are uncorrelated, and hence this task has exponentially low gradient variance:
Lemma 13.
For any ( i j ) d 2 j =1 ̸ = (cid:0) ˜
[Equation]
j (cid:1)
d 2 j =1 we have that:
[Equation]
Proof.
Denote by h ̸ = ˜ h ∈ { 0 , 1 } d the vectors that corresponding to the ( i j ) d 2 j =1 , (cid:0) ˜ i
j (cid:1)
d 2 j =1 .
Then
[Equation]
Since the coordinates are independent we can swap the order of the expectation and the product:
[Equation]
Finally, since h ̸ = ˜ h there exists some j ∈ [ d ] such that h j ̸ = ˜
h
j and therefore h j + ˜ h
j = 1 and (cid:81) dj
=1 ( − 1) hj +˜ hj +1= 0 .
Now following Shalev-Shwartz et al.
, we show that the zero correlation between different parities implies exponentially low gradient variance.
Lemma 14.
Assuming that E x (cid:104)(cid:13)(cid:13)
∂∂ w p w ( x ) (cid:13)(cid:13) 2 (cid:105) =
O ( poly ( d )) , then sup w Var ( H , F, w ) =
O (cid:16) |H| − 1 (cid:17) where
H denote the hypothesis class of d dimensional parities described in section 5.
Proof.
We use theorem 1 from Shalev-Shwartz et al.
Essentially, this theorem shows that if the functions in the hypothesis class are uncorrelated, then the variance is upper bounded by
E x
(cid:104)(cid:13)(cid:13)
∂∂ w p w ( x ) (cid:13)(cid:13) 2 (cid:105) times the inverse of the hypothesis class size.
In our case, lemma 13 above shows that:
[Equation]
And therefore we have that
[Equation]
Having low gradient variance alone does not imply that learning is impossible, it only implies that all hypotheses perform similarly.
To show the negative result for our parity problem, we must also show that the random guessing error is high.
Lemma 15 establishes this, showing that the task of learning bit-subset parity has non-vanishing random guessing error of Θ (1) with respect to the dimension d , and linear with respect to the fraction of the hypothesis class from which the guessing occurs.
Lemma 15.
Let H denote the hypothesis class of d dimensional parities described in section 5, and l 0 − 1 denote the zero one loss.
then the following holds:
[Equation]
Proof.
Let h ∈ H , we begin by writing the zero-one loss with elementary algebraic operation:
[Equation]
Since the coordinates are independent we can swap the order of the expectation and the product:
[Equation]
Now, in cases where h ̸ =
˜ h there exists some j ∈ [ d ] such that h j ̸ = ˜ h
j .
Therefore, in such cases h j + ˜ h j = 1 which implies that (cid:81) dj
=1 ( − 1) hj +˜ hj
[Equation]
1=
and we get that:
[Equation]
Now clearly
[Equation] [Equation]
And therefore
[Equation]
Finally, by combining lemmas 14,15 with lemma 12 we prove theorem 4.
Proof.
By lemma 14 we know that sup w Var
( H , F, w ) =
O (cid:16) |H| − 1 (cid:17) .
Now since (cid:0) nk (cid:1) > (cid:0) nk (cid:1) k for any k < n , we have that |H| =
(cid:0) d d 2 (cid:1) =
Ω (cid:0) e d (cid:1) i.e. we have exponentially low variance.
Therefore, lemma 12 assure us that with probability of at least 1 − n · O (cid:0) e − d / 3 (cid:1) the loss of A will be higher than E H , 1 − n · O (cid:16) |H| − 1 3 (cid:17) ,l 0 − 1 .
Finally, lemma 15 implies that:
[Equation]
[Table] [Table]
G B IT -S UBSET P ARITY E XPERIMENTS F ULL D ETAILS
Section 5.2 in the main text empirically demonstrates that there exists a large gap when using the commonly used Transformer architecture for learning bit subset parity with and without intermediate supervision.
In this section, we present the full details of the experiments.
Following the bit-subset parity definition in section 5, we randomly sampled a subset of d / 2 predefined unique indices and then we randomly sampled non-overlapping training, validation and test datasets.
For reproducibility purposes, Table 2 reports the random seeds that used for this sampling.
Then, we used the standard implementation of GPT-2 from the transformers framework (Wolf et al., 2020) and trained a BERT-Base size Transformer decoder model with a vocabulary size of 2 .
Even though the small vocabulary size of our model may indicate that it is too shallow for its size (Wies et al., 2021), we still choose to use the standard Transformer-Base configuration.
See full archi- tecture and optimization details in Table 2.
While the evaluation of a model without intermediate supervision is straightforward, we can simply use argmax over the last token logits.
This is no longer the case when intermediate supervision is used since at evaluation time the model must create its own intermediate steps.
As a result, in this case, we need a decoding algorithm that iteratively predicates the intermediate steps.
Since we found in preliminary experiments that greedy decoding tends to be more efficient for longer sequences than random sampling, we choose to use it.
To complement Figure 3 in the main text, Table 1 shows the first iteration 22 for which the model is better than random as well as the test accuracy after 100 k training iterations.
Though “better than random" could be defined in a variety of ways.
Figure 4 illustrates a typical learning trajectory and demonstrate the insignificant differences in definitions due to the observed grokking phenomenon (Power et al., 2021).
For each task we repeated the task 3 times with different dataset seeds, and perform grid search over the hyper-parameters in Table 2.
Table 1 reports the mean and standard deviation test accuracy of the best hyper-parameters according to the validation binary cross-entropy loss, where we break ties by choosing the model that converged faster.
As excepted, without intermediate supervision, the Transformer models can not learn beyond random guessing tasks with more than 18 bits.
In contrast, with intermediate supervision, the test accuracy is almost perfect even at 128 bits.
[Figure]