R EVISITING L OCALLY S UPERVISED L EARNING : AN A LTERNATIVE TO E ND - TO - END T RAINING
A BSTRACT
Due to the need to store the intermediate activations for back-propagation, end-toend (E2E) training of deep networks usually suffers from high GPUs memory footprint.
This paper aims to address this problem by revisiting the locally supervised learning, where a network is split into gradient-isolated modules and trained with local supervision.
We experimentally show that simply training local modules with
E2E loss tends to collapse task-relevant information at early layers, and hence hurts the performance of the full model.
To avoid this issue, we propose an information propagation (InfoPro) loss, which encourages local modules to preserve as much useful information as possible, while progressively discard task-irrelevant information.
As InfoPro loss is difﬁcult to compute in its original form, we derive a feasible upper bound as a surrogate optimization objective, yielding a simple but effective algorithm.
In fact, we show that the proposed method boils down to minimizing the combination of a reconstruction loss and a normal cross-entropy/contrastive term.
Extensive empirical results on ﬁve datasets (i.e., CIFAR, SVHN, STL-10,
ImageNet and Cityscapes) validate that InfoPro is capable of achieving competitive performance with less than 40% memory footprint compared to E2E training, while allowing using training data with higher-resolution or larger batch sizes under the same GPU memory constraint.
Our method also enables training local modules asynchronously for potential training acceleration.
Code is available at: https://github.com/blackfeather-wang/InfoPro-Pytorch .
I NTRODUCTION
End-to-end (E2E) back-propagation has become a standard paradigm to train deep networks (Krizhevsky et al., 2012; Simonyan & Zisserman, 2014; Szegedy et al., 2015;
He et al., 2016;
Huang et al., 2019).
Typically, a training loss is computed at the ﬁnal layer, and then the gradients are propagated backward layer-by-layer to update the weights.
Although being effective, this procedure may suffer from memory and computation inefﬁciencies.
First, the entire computational graph as well as the activations of most, if not all, layers need to be stored, resulting in intensive memory consumption.
The GPU memory constraint is usually a bottleneck that inhibits the training of state-of-the-art models with high-resolution inputs and sufﬁcient batch sizes, which arises in many realistic scenarios, such as 2D/3D semantic segmentation/object detection in autonomous driving, tissue segmentation in medical imaging and object recognition from remote sensing data.
Most existing works address this issue via the gradient checkpointing technique (Chen et al., 2016) or the reversible architecture design (Gomez et al., 2017), while they both come at the cost of signiﬁcantly increased computation.
Second, E2E training is a sequential process that impedes model parallelization (Belilovsky et al., 2020; L¨owe et al., 2019), as earlier layers need to wait for their successors for error signals.
As an alternative to E2E training, the locally supervised learning paradigm (Hinton et al., 2006;
Bengio et al., 2007; Nøkland & Eidnes, 2019; Belilovsky et al., 2019; 2020) by design enjoys higher memory efﬁciency and allows for model parallelization.
In speciﬁc, it divides a deep network into several gradient-isolated modules and trains them separately under local supervision (see Figure(b)).
Since back-propagation is performed only within local modules, one does not need to store all
[Table]
[Figure]
[Table]
[Figure]
[Table]
/2369V6rS6POS1YhVCl4tmLNlY+0TG1KCKXcgpIUUgZZJ9sSvEekUV1iqE7oR50CSRP1hX1qQLbHCgFhA1tF78dfB0V2hDfzJmKtQsvPv4SWJq0CZsIuAQyezNlPRdm1s7j7gkn7+0c/52CK4A2o1NoF9kNkJe141gyatOOxOAhplg0HJ1bsOSSFd65ORJVBoYYOpZbWE8gu2I5yLMpNqnEzrm1Zf2PIFnL326BzelvaXQOWLkilf+KhH36UqUzyBq/BQtzBD+ffx/dwtxt2IdjzPrdFM5U8rQDXgesnAW2My+syqI8RdV1TjlH7RHuoYchxpddd0sZc8FN8owzpuAJYKkr3KA39Erqq/0wayYdEIKzrEIR3q70hQPErL3H2E2EuJR0uCcZ4Yps0Xuw2hIR+zULFt0/i3p+mNlZPh2ZP7biHXIftqAdTIZ5MWk8vWW+QjkZuCq6k2f54hkPCstsilv3AM+LRU9omx5DUnIe1Ur8BuKX8zaoSH/K7yQmgm0i88ndsniqLnumlCF9SBydJ1i9o6tZlKEDOTszOWd4esuww9h5Dx9LsSn0Duri4TuXqStDnxXMGr84c1eJS98fizmHN8N8ZIweb4u2IxMELO5Oa/KmnBaa2zWrXrNeP63uPi9u0VV6QA/
pEXr2Ge3SS9rDCeHSO/pMX+ir8c34bvwwfmro8lJhc5/GHuP3P1HJjwE=</latexit>
[Figure]
Supervised Learning
[Figure]
intermediate activations at the same time.
Consequently, the memory footprint during training is reduced without involving signiﬁcant computational overhead.
Moreover, by removing the demands for obtaining error signals from later layers, different local modules can potentially be trained in parallel.
This approach is also considered more biologically plausible, given that brains are highly modular and predominantly learn from local signals (Crick, 1989; Dan & Poo, 2004; Bengio et al., 2015).
However, a major drawback of local learning is that they usually lead to inferior performance compared to E2E training (Mostafa et al., 2018; Belilovsky et al., 2019; 2020).
In this paper, we revisit locally supervised training and analyse its drawbacks from the informationtheoretic perspective.
We ﬁnd that directly adopting an E2E loss function (i.e., cross-entropy) to train local modules produces more discriminative intermediate features at earlier layers, while it collapses task-relevant information from the inputs and leads to inferior ﬁnal performance.
In other words, local learning tends to be short sighted, and learns features that only beneﬁt local modules, while ignoring the demands of the rest layers.
Once task-relevant information is washed out in earlier modules, later layers cannot take full advantage of their capacity to learn more powerful representations.
Based on the above observations, we hypothesize that a less greedy training procedure that preserves more information about the inputs might be a rescue for locally supervised training.
Therefore, we propose a less greedy information propagation (InfoPro) loss that aims to encourage local modules to propagate forward as much information from the inputs as possible, while progressively abandon task-irrelevant parts (formulated by an additional random variable named nuisance), as shown in
Figure 1 (c).
The proposed method differentiates itself from existing algorithms (Nøkland & Eidnes, 2019; Belilovsky et al., 2019; 2020) on that it allows intermediate features to retain a certain amount of information which may hurt the short-term performance, but can potentially be leveraged by later modules.
In practice, as the InfoPro loss is difﬁcult to estimate in its exact form, we derive a tractable upper bound, leading to surrogate losses, e.g., cross-entropy loss and contrastive loss.
Empirically, we show that InfoPro loss effectively prevents collapsing task-relevant information at local modules, and yields favorable results on ﬁve widely used benchmarks (i.e., CIFAR, SVHN,
STL-10, ImageNet and Cityscapes).
For instance, it achieves comparable accuracy as E2E training using 40% or less GPU memory, while allows using a 50% larger batch size or a 50% larger input resolution with the same memory constraints.
Additionally, our method enables training different local modules asynchronously (even in parallel).
W HY LOCALLY SUPERVISED LEARNING UNDERPERFORMS E2E TRAINING ?
We start by considering a local learning setting where a deep network is split into multiple successively stacked modules, each with the same depth.
The inputs are fed forward in an ordinary way, while the gradients are produced at the end of every module and back-propagated until reaching an earlier module.
To generate supervision signals, a straightforward solution is to train all the local modules as
16 LayerIndex
T e s t E rr o r( % )
LinearSeparabilityofIntermediateFeatures(inTestErrors) K =
K =2 K =4 K =
K =     10 12 14 16 LayerIndex 0 .0 .0 .0 .0 .0 .0 .0 .
E s t i m a t
e s o f
I ( h , x )
MutualInformationbetweenFeatures h andInputs x K =
K =2 K =4 K =
K =     10 12 14 16 LayerIndex 0 .0 .0 .0 .0 .0 .0 .0 .
E s t i m a t
e s o f
I ( h , y )
MutualInformationbetweenFeatures h
andLabel y
K =1 K =2 K =
K =8 K =
[Equation]
[Table]
independent networks, e.g., in classiﬁcation tasks, attaching a classiﬁer to each module, and computing the local classiﬁcation loss such as cross-entropy.
However, such a greedy version of the standard supervised learning (greedy SL) algorithm leads to inferior performance of the whole network.
For instance, in Table 1, we present the test error of a ResNet-32 (He et al., 2016) on CIFAR-10 (Krizhevsky et al., 2009) when it is greedily trained with K modules.
One can observe a severe degradation (even more than 15% ) with K growing larger.
Plausible as this phenomenon seems, it remains unclear whether it is inherent for local learning and how to alleviate this problem.
In this section, we investigate the performance degradation issue of the greedy local training from an information-theoretic perspective, laying the basis for the proposed algorithm.
Linear separability of intermediate features.
In the common case that greedy SL operates directly on the features output by internal layers, a natural intuition is to investigate how these locally learned features differ from their E2E learned counterparts in task-relevant behaviors.
To this end, we ﬁx the networks in Table 1, and train a linear classiﬁer using the features from each layer.
The test errors of these classiﬁers are presented in the left plot of Figure 2, where the horizontal axis denotes the indices of layers.
The plot shows an intriguing trend: greedy SL contributes to dramatically more discriminative features with the ﬁrst one (or few) local module, but is only able to slightly improve the performance with all the consequent modules.
In contrast, the E2E learned network progressively boosts the linear separability of features throughout the whole network with even more signiﬁcant effects in the later layers, surpassing greedy SL eventually.
This raises an interesting question: why does the full network achieve inferior performance in greedy SL compared to the E2E counterpart, even though the former is based on more discriminative earlier features?
This observation appears incompatible with prior works like deeply-supervised nets (Lee et al., 2015a).
Information in features.
Since we use the same training conﬁguration for both greedy SL and E2E learning, we conjecture that the answer to the above question might lie in the differences of features apart from merely separability.
To test that, we look into the information captured by the intermediate features.
In speciﬁc, given intermediate feature h corresponding to the input data x and the label y
(all of them are treated as random variables), we use the mutual information
I ( h , x ) and I ( h , y ) to measure the amount of all retained information and task-relevant information in h , respectively.
As these metrics cannot be directly computed, we estimate the former by training a decoder with binary cross-entropy loss to reconstruct x from h .
For the latter, we train a CNN using h as inputs to correctly classify x , and estimate I ( h , y ) with its performance.
Details are deferred to Appendix G.
The estimates of I ( h , x ) and I ( h , y ) at different layers are shown in the middle and right plots of Figure 2.
We note that in E2E learned networks, I ( h , y ) remains unchanged when the features pass through all the layers, while I ( h , x ) reduces gradually, revealing that the models progressively discard task-irrelevant information.
However, greedily trained networks collapse both I ( h , x ) and
I ( h , y ) in their ﬁrst few modules.
We attribute this to the short sighted optimization objective of earlier modules, which have relatively small capacity compared with full networks and are not capable of extracting and leveraging all the task-relevant information in x , as the E2E learned networks do.
As a consequence, later modules, even though introducing additional parameters and increased capacity, lack necessary information about the target y to construct more discriminative features.
Information collapse hypothesis.
The above observations suggest that greedy SL induces local modules to collapse some of the task-relevant information that may be useless for short-term performance.
However, the information is useful for the full model.
In addition, we postulate that, although E2E training is incapable of extracting all task-relevant information at earlier layers as well, it alleviates this phenomenon by allowing a larger amount of task-irrelevant information to be kept, even though it may not be ideal for short-term performance.
More empirical validation of our hypothesis is provided in Appendix A.
I NFORMATION P ROPAGATION (I NFO P RO ) L OSS
In this section, we propose an information propagation (InfoPro) loss to address the issue of information collapse in locally supervised training.
The key idea is to enforce local modules to retain as much information about the input as possible, while progressively discard task-irrelevant parts.
As it is difﬁcult to estimate InfoPro loss in its exact form, we derive an easy-to-compute upper bound as the surrogate loss, and analyze its tightness.
3. L EARNING TO D ISCARD U SELESS I NFORMATION
Nuisance.
We ﬁrst model the task-irrelevant information in the input data x by introducing the concept of nuisance.
A nuisance is deﬁned as an arbitrary random variable that affects x but provides no helpful information for the task of interest (Achille & Soatto, 2018).
Take recognizing a car in the wild for example.
The random variables determining the weather and the background are both nuisances.
Formally, given a nuisance r , we have I ( r, x ) >
and I ( r, y ) = 0 , where y is the label.
Without loss of generality, we suppose that y , r , x and h form the Markov chain ( y, r ) → x → h , namely p ( h | x , y, r ) =
p ( h | x ) .
As a consequence, for the intermediate feature h from any layer, we obviously have I ( r, x ) ≥ I ( r, h ) .
Nevertheless, we postulate that max r I ( r, h ) > 0 .
This assumption is mild since it does not hold only when h strictly contains no task-irrelevant information.
Information Propagation (InfoPro) Loss.
Thus far, we have been ready to introduce
the proposed
InfoPro loss.
Instead of overly emphasizing on learning highly discriminative features at local modules, we also pay attention to preventing collapsing useful information in the feed-forward process.
A simple solution to achieve this is maximizing the mutual information
I ( h , x ) .
Ideally, if there is no information loss, all useful information will be retained.
However, it goes to another extreme case where the local modules do not learn any task-relevant feature, and is obviously dispensable.
By contrast, in E2E training, intermediate layers progressively discard useless (taskirrelevant) information as well as shown above.
Therefore, to model both effects simultaneously, we propose the following combined loss function:
[Equation]
where the nuisance r ∗ is formulated to capture as much task-irrelevant information in h as possible, and the coefﬁcient β controls the amount of information that is propagated forward (ﬁrst term) and task-irrelevant information that is discarded (second term).
Notably, we assume that the ﬁnal module is always trained using the normal E2E loss (e.g., softmax cross-entropy loss for classiﬁcation) weighted by the constant 1, such that α is essential to balance the intermediate loss and the ﬁnal one.
In addition, L InfoPro ( h ) is used to train the local module outputting h , whose inputs are not required to be x .
The module may stack over another local module trained with the same form of L InfoPro ( h ) but (possibly) different α and β .
Our method differs from existing works (Nøkland & Eidnes, 2019; Belilovsky et al., 2019; 2020) in that it is a non-greedy approach.
The major effect of minimizing L InfoPro ( h ) can be described as maximally discarding the task-irrelevant information under the goal of retaining as much information of the input as possible.
Obtaining high short-term performance is not necessarily required.
As we explicitly facilitate information propagation, we refer to L InfoPro ( h ) as the InfoPro loss.
3. U PPER B OUND OF L InfoPro
The objective function in Eq.(1) is difﬁcult to be directly optimized, since it is usually intractable to estimate r ∗ , which is equivalent to disentangling all task-irrelevant information from intermediate features.
Therefore, we derive an easy-to-compute upper bound of L InfoPro as an surrogate loss.
Our result is summarized in Proposition 1, with the proof in Appendix B.
Proposition 1.
Suppose that the Markov chain ( y, r ) → x → h holds.
Then an upper bound of
L InfoPro is given by
[Equation]
where λ 1 = α (1 − β ) , λ 2 = αβ .
For simplicity, we integrate α and β into two mutually independent hyper-parameters, λ 1 and λ 2 .
Although we do not explicitly restrict λ 1 ≥ 0 , we ﬁnd in experiments that the performance of networks is signiﬁcantly degraded with λ 1 → 0 + (see Figure 4), or say, β → 1 − , where models tend to reach local minima by trivially minimizing I ( r ∗ , h ) in Eq.
Thus, we assume λ 1 , λ 2 ≥ 0 .
With Proposition 1, we can optimize the upper bound ¯ L InfoPro as an approximation, circumventing dealing with the intractable term I ( r ∗ , h ) in L InfoPro .
To ensure that the approximation is accurate, the gap between the two should be reasonably small.
Below we present an analysis of the tightness of ¯
L InfoPro in Proposition 2, (proof given in Appendix C).
We also empirically check it in Appendix H.
Proposition 2 provides a useful tool to examine the discrepancy between L InfoPro and its upper bound.
Proposition 2.
Given that r ∗ = argmax r, I ( r, x ) > 0 , I ( r,y )=
I ( r, h ) and that y is a deterministic function with respect to x , the gap (cid:15) =
¯ L InfoPro − L InfoPro is upper bounded by
[Equation]
3. M UTUAL I NFORMATION E STIMATION
In the following, we describe the speciﬁc techniques we use to obtain the mutual information
I ( h , x ) and I ( h , y ) in ¯ L InfoPro .
Both of them are estimated using small auxiliary networks.
However, we note that the involved additional computational costs are minimal or even negligible (see Tables 3, 4).
Estimating I ( h , x ) .
Assume that R ( x | h ) denotes the expected error for reconstructing x from h .
It has been widely known that R ( x | h ) follows I ( h , x )
=
H ( x ) − H ( x | h ) ≥ H ( x ) −R ( x | h ) , where H ( x ) denotes the marginal entropy of x , as a constant (Vincent et al., 2008; Rifai et al., 2012; Kingma & Welling, 2013; Makhzani et al., 2015; Hjelm et al., 2019).
Therefore, we estimate
I ( h , x ) by training a decoder parameterized by w to obtain the minimal reconstruction loss, namely
I ( h , x ) ≈ max w [ H ( x ) −R w ( x | h )] .
In practice, we use the binary cross-entropy loss for R w ( x | h ) .
Estimating I ( h , y ) .
We propose two ways to estimate I ( h , y ) .
Since I ( h , y ) =
H ( y ) −
H ( y | h ) =
H ( y ) − E
( h ,y )
[ − log p ( y | h )] , a straightforward approach is to train an auxiliary classiﬁer q ψ ( y | h ) with parameters ψ to approximate p ( y | h ) , such that we have I ( h , y )
≈ max ψ { H ( y ) − E h
[ (cid:80) y − p
( y | h ) log q ψ ( y | h )] } .
Note that this approximate equation will become an equation if and only if q ψ ( y | h ) ≡ p ( y | h ) (according to the Gibbs’ inequality).
Finally, we estimate the expectation on h using the samples { ( x i , h i , y i ) } Ni =1 , namely I ( h , y )
≈ max ψ { H ( y ) − 1 N [ (cid:80)
Ni =1 − log q ψ ( y i |
h i )] } .
Consequently, q ψ ( y | h ) can be trained in a regular classiﬁcation fashion with the cross-entropy loss.
In addition, motivated by recent advances in contrastive representation learning (Chen et al., 2020;
Khosla et al., 2020; He et al., 2020), we formulate a contrastive style loss function L contrast , and prove in Appendix D that minimizing L contrast is equivalent to maximizing a lower bound of I ( h , y ) .
Empirical results indicate that adopting L contrast may lead to better performance if a large batch size is available.
In speciﬁc, considering a mini-batch of intermediate features { h 1 , . . .
, h N } corresponding to the labels { y 1 , . . .
, y N } , L contrast is given by:
[Equation]
Herein, 1 A ∈ { 0 , 1 } returns 1 only when A is true, τ > 0 is a pre-deﬁned hyper-parameter, temperature, and f φ is a projection head parameterized by φ that maps the feature
h
i to a representation vector z
i (this design follows Chen et al.
Khosla et al.
Implementation details.
We defer the details on the network architecture of w , ψ and φ to Appendix
E. Brieﬂy, on CIFAR, SVHN and STL-10, w is a two layer decoder with up-sampled inputs (if not otherwise noted), with ψ and φ sharing the same architecture consisting of a single convolutional layer followed by two fully-connected layers.
On ImageNet and Cityscapes, we use relatively larger auxiliary nets, but they are very small compared with the primary network.
Empirically, we ﬁnd that these simple architectures are capable of achieving competitive performance consistently.
Moreover, in implementation, we train w , ψ and φ collaboratively with the main network.
Formally, let θ denote the parameters of the local module to be trained, and then our optimization objective is minimize θ , w , ψ
[Equation]
which corresponds to using the cross-entropy and contrast loss to estimate I ( h , y ) , respectively.
Such an approximation is acceptable as we do not need to acquire the exact approximation of mutual information, and empirically it performs well in various experimental settings.
E XPERIMENTS
Setups.
Our experiments are based on ﬁve widely used datasets (i.e., CIFAR-10 (Krizhevsky et al., 2009), SVHN (Netzer et al., 2011), STL-10 (Coates et al., 2011), ImageNet (Deng et al., 2009) and Cityscapes (Cordts et al., 2016)) and two popular network architectures (i.e., ResNet (He et al., 2016) and DenseNet (Huang et al., 2019)) with varying depth.
We split each network into K local modules with the same (or approximately the same) number of layers, where the ﬁrst K −modules are trained using ¯ L InfoPro , and the last module is trained using the standard E2E loss, as aforementioned.
Due to spatial limitation, details on data pre-processing, training conﬁgurations and local module splitting are deferred to Appendix F.
The hyper-parameters λ
and λ 2 are selected from { 0 , 0 . 1 , 0 . 5 , 1 , 2 , 5 , 10 , 20 } .
Notably, to avoid involving too many tunable hyper-parameters when K is large (e.g., K =16 ), we assume that λ 1 and λ 2 change linearly from 1 st to ( K − 1) th local module, and thus we merely tune λ 1 and λ 2 for these two modules.
We always use τ =0 .
07 in L contrast .
Two training modes are considered: (1) simultaneous training , where the back-propagation process of all local modules is sequentially triggered with every mini-batch of training data; and (2) asynchronous training , where local modules are isolatedly learned given cached outputs from completely trained earlier modules.
Both modes enjoy high memory efﬁciency since only the activations within a single module require to be stored at a time.
The second mode removes the dependence of local modules on their predecessors, enabling the fully decoupled training of network components.
The experiments using asynchronous training are referred to as “Asy-InfoPro”, while all other results are based on simultaneous training.
4. M AIN R ESULTS
[Figure]
Comparisons with other local learning methods.
We ﬁrst compare the proposed
InfoPro method with three recently proposed algorithms, decoupled greedy learning (Belilovsky et al., 2020) (DGL), BoostResNet (Huang et al., 2018a) and deep incremental boosting (Mosca & Magoulas, 2017) (DIB) in Figure 3.
Our method yields the lowest test errors with all values of K .
Notably, DGL can be viewed as a special case of InfoPro where λ 1 =0 .
Hence, we use the same architecture of auxiliary networks as us in DGL for fair comparison.
In addition, we present the estimates of mutual information between intermediate features and labels in the right plot of Figure 3.
One can observe that DGL suffers from a severe collapse of task-relevant information at early modules, since it optimizes local modules greedily for merely short-term performance.
By contrast, our method effectively alleviates this problem, retaining a larger amount of task-relevant information within intermediate features.
Results on various image classiﬁcation benchmarks are presented in Table 2.
We also report the result of DGL (Belilovsky et al., 2020) in our implementation.
It can be observed that InfoPro outperforms greedy SL by large margins consistently across different networks, especially when K is
[Table]
[Table] [Table]
large.
For example, on CIFAR-10, ResNet-32 + InfoPro achieves a test error of 12 .
75% with K =16 , surpassing greedy SL by 11 .
For ResNet-110, we note that our method performs on par with
E2E training with K = 2 , while degrading the performance by up to 0 .
8% with K = 4 .
Moreover,
InfoPro is shown to compare favorably against DGL under most settings
[Table]
In addition, given that our method introduces auxiliary networks, we enlarge network depth for greedy SL to match the computational cost of InfoPro, named as greedy SL + .
However, this only slightly ameliorates the performance since the problem of information collapse still exists.
Another interesting phenomenon is that InfoPro (Contrast) outperforms InfoPro (Softmax) on CIFAR-10 and
SVHN, yet fails to do so on STL-10.
We attribute this to the larger batch size we use on the former two datasets and the proper value of the temperature τ .
A detailed analysis is given in Appendix H.
Asynchronous and parallel training.
The results of asynchronous training are presented in Tableas “Asy-InfoPro”, and it appears to slightly hurt the performance.
Asy-InfoPro differentiates itself from InfoPro on that it adopts the cached outputs from completely trained earlier modules as the inputs of later modules.
Therefore, the degradation of performance might be ascribed to lacking regularizing effects from the noisy outputs of earlier modules during training (L¨owe et al., 2019).
However, Asy-InfoPro is still considerably better than both greedy SL and DGL, approaching E2E
[Table]
[Figure]
Besides, we note training can be easily extended to training different local modules in parallel by dynamically caching the outputs of earlier modules.
To this end, we preliminarily test training two local modules parallelly on 2 GPUs when
K = 2 , using the same experimental protocols as Huo et al. (2018b) (train ResNetwith a batch size of 128 on CIFAR-10) and their public code.
Our method gives a 1.5 × speedup over the standard parallel paradigm of E2E training (the DataParallel toolkit in
Pytorch).
Note that parallel training has the same performance as simultaneous training (i.e., “InfoPro” in Table 2) since their training processes are identical except for the parallelism.
Reducing GPUs memory requirements.
Here we split the network into local modules to ensure each module consumes a similar amount of GPU memory during training.
Note that this is different from splitting the model into modules with the same number of layers.
We denote the results in this setting by InfoPro ∗ , and the trade-off between GPU memory consumption and test errors is presented in Table 3, where we report the minimally required GPU memory to run the training algorithm.
The contrastive and softmax loss are used in InfoPro ∗ on CIFAR-10 and STL-10, respectively.
One can observe that our method signiﬁcantly improves the memory efﬁciency of CNNs.
For instance, on STL-10, InfoPro ∗ ( K = 4 ) outperforms the E2E baseline by 1 .
05% with 37.9% of the GPUs memory requirements.
The computational overhead is presented in both the theoretical results and the practical wall time.
Due to implementation issues, we ﬁnd that the latter is slightly larger than the former for InfoPro ∗ .
Compared to the gradient checkpointing technique (Chen et al., 2016), our method achieves competitive performance with signiﬁcantly reduced computational and time cost.
Results on ImageNet are reported in Table 4.
The softmax loss is used in InfoPro ∗ since the batch size is relatively small.
The proposed method reduces the memory cost by 40%, and achieves slightly better performance.
Notably, our method enables training these large networks using 16 GB GPUs.
Results of semantic segmentation on Cityscapes are presented in Table 5.
We report the mean
Intersection over Union (mIoU) of all classes on the validation set.
The softmax loss is used in
InfoPro ∗ .
The details of ψ and w are presented in
Appendix E.
Our method boosts the performance of the DeepLab-V3 (Chen et al., 2017) network and allows training the model with 50% larger batch sizes (2 → 3 per GPU) under the same memory constraints.
This contributes to more accurate statistics for batch normalization, which is a practical requirement for tasks with high resolution inputs.
In addition, InfoPro ∗ enables using larger crop sizes ( 512 × 1024 → 640 × 1280 ) during training without enlarging GPUs memory footprint, which signiﬁcantly improves the mIoU. Note that this does not increase the training or inference cost.
4. H YPER - PARAMETER S ENSITIVITY AND ABLATION STUDY
The coefﬁcient λ 1 and λ 2 .
To study how λ 1 and λ 2 affect the performance, we change them for the 1 st and 3 rd local modules of a ResNet-32 trained using InfoPro (Contrast), K = 4 , with the results shown in Figure 4.
We ﬁnd that the earlier module beneﬁts from small λ 2 to propagate more information forward, while larger λ 2 helps the later module to boost the ﬁnal accuracy.
This is compatible with previous works showing that removing earlier layers in ResNets has a minimal impact on performance (Veit et al., 2016).
[Table]
Ablation study .
For ablation, we test directly removing the decoder w or replacing the contrastive head φ by the linear classiﬁer used in greedy SL, as shown in Table 6.
R ELATED W ORK
Greedy training of deep networks is ﬁrst proposed to learn unsupervised deep generative models, or to obtain an appropriate initialization for E2E supervised training (Hinton et al., 2006; Bengio et al., 2007).
However, later works reveal that this initialization is indeed dispensable once proper networks architectures are adopted, e.g., introducing batch normalization layers (Ioffe & Szegedy, 2015), skip connections (He et al., 2016) or dense connections (Huang et al., 2019).
Some other works (Kulkarni & Karande, 2017; Malach & Shalev-Shwartz, 2018; Marquez et al., 2018; Huang et al., 2018a) attempt to learn deep models in a layer-wise fashion.
For example, BoostResNet (Huang et al., 2018a) trains different residual blocks in a ResNet (He et al., 2016) sequentially with a boosting algorithm.
Deep Cascade Learning (Marquez et al., 2018) extends the cascade correlation algorithm (Fahlman & Lebiere, 1990) to deep learning, aiming at improving the training efﬁciency.
However, these approaches mainly focus on theoretical analysis and are usually validated with limited experimental results on small datasets.
More recently, several works have pointed out the inefﬁciencies of back-propagation and revisited this problem (Nøkland & Eidnes, 2019; Belilovsky et al., 2019; 2020).
These works adopt a similar local learning setting to us, while they mostly optimize local modules with a greedy short-term objective, and hence suffer from the information collapse issue we discuss in this paper.
In contrast, our method trains local modules by minimizing the non-greedy InfoPro loss.
Alternatives of back-propagation have been widely studied in recent years.
Some biologicallymotivated algorithms including target propagation (Lee et al., 2015b; Bartunov et al., 2018) and feedback alignment (Lillicrap et al., 2014; Nøkland, 2016) avoid back-propagation by directly propagating backward optimal activations or error signals with auxiliary networks.
Decoupled Neural
Interfaces (DNI) (Jaderberg et al., 2017) learn auxiliary networks to produce synthetic gradients.
In addition, optimization methods like Alternating Direction Method of Multipliers (ADMM) split the end-to-end optimization into sub-problems using auxiliary variables (Taylor et al., 2016; Choromanska et al., 2018).
Decoupled Parallel Back-propagation (Huo et al., 2018b) and Features Replay (Huo et al., 2018a) update parameters with previous gradients instead of current ones, and show its convergence theoretically, enabling training network modules in parallel.
Nevertheless, these methods are fundamentally different from us as they train local modules by explicitly or implicitly optimizing the global objective, while we merely consider optimizing local objectives.
Information-theoretic analysis in deep learning has received increasingly more attention in the past few years.
Shwartz-Ziv & Tishby (2017) and Saxe et al.
(2019) study the information bottleneck (IB) principle (Tishby et al., 2000) to explain the training dynamics of deep networks.
Achille &
Soatto (2018) decompose the cross-entropy loss and propose a novel IB for weights.
There are also efforts towards fulﬁlling efﬁcient training with IB (Alemi et al., 2016).
In the context of unsupervised learning, a number of methods have been proposed based on mutual information maximization (Oord et al., 2018; Tian et al., 2020; Hjelm et al., 2019).
SimCLR (Chen et al., 2020) and MoCo (He et al., 2020) propose to maximize the mutual information of different views from the same input with the contrastive loss.
This paper analyzes the drawbacks of greedy local supervision and propose the
InfoPro loss from the information-theoretic perspective as well.
In addition, our method can also be implemented as the combination of a contrastive term and a reconstruction loss.
C ONCLUSION
This work studied locally supervised deep learning from the information-theoretic perspective.
We demonstrated that training local modules greedily results in collapsing task-relevant information at earlier layers, degrading the ﬁnal performance.
To address this issue, we proposed an information propagation (InfoPro) loss that encourages local modules to preserve more information about the input, while progressively discard task-irrelevant information.
Extensive experiments validated that
InfoPro signiﬁcantly reduced GPUs memory footprint during training without sacriﬁcing accuracy.
It also enabled model parallelization in an asynchronous fashion.
InfoPro may open new avenues for developing more efﬁcient and biologically plausible deep learning algorithms.
A CKNOWLEDGMENTS
This work is supported in part by the National Science and Technology Major Project of the Ministry of Science and Technology of China under Grants 2018AAA0100701, the National Natural Science
Foundation of China under Grants 61906106 and 62022048, the Institute for Guo Qiang of Tsinghua
University and Beijing Academy of Artiﬁcial Intelligence.
B P ROOF OF PROPOSITION
Proposition 1.
Suppose that the Markov chain ( y, r ) → x → h holds.
Then an upper bound of
L InfoPro is given by
[Equation]
6) where λ 1 = α (1 − β ) , λ 2 = αβ .
Proof .
Note that, L InfoPro is given by
[Equation]
Due to the Markov chain ( y, r ) → x → h , we have I ( h , ( y, r ∗ ))
≤
I ( h , x ) .
Given that
[Equation]
8) we have
[Equation]
By the deﬁnition of nuisance, we note that r ∗ and y are mutually independent, and thus we obtain
[Equation]
Combining Eqs.
(9) and (10), we have
[Equation] [Equation]
Finally, Proposition 1 is proved by combining Eq.
(7) and Inequality (11).
C P ROOF OF PROPOSITION
We ﬁrst introduce a Lemma proven by Achille & Soatto (2018).
Lemma 1.
Given a joint distribution p ( x , y ) , where y is a discrete random variable, we can always ﬁnd a random variable r independent of y such that x = f ( y, r ) , for some deterministic function f .
Proposition 2.
Given that r ∗ = argmax r, I ( r, x ) > 0 , I ( r,y )=
I ( r, h ) and that y is a deterministic function with respect to x , the gap (cid:15) =
¯ L InfoPro − L InfoPro is upper bounded by
[Equation] [Equation]
Proof .
Let ˜ r be the random variable in Lemma 1, and then, since we can ﬁnd a deterministic function that maps x to y , we have
[Equation]
Assume ζ =
[ I ( h , x ) − I ( h , y )] − I ( h , r ∗ ) , in terms that r ∗ = argmax r, I ( r, x ) > 0 , I ( r,y )
=
I ( r, h ) , we obtain
[Equation]
Since y and ˜ r are mutually independent, namely H ( y | ˜ r )
=
H ( y ) , we have
[Equation]
When considering y as a deterministic function with regards to x , we obtain H ( y | x ) = 0 , and therefore
[Equation]
Given that (cid:15) =
¯ L InfoPro − L InfoPro =
λ 2 ζ , we have
[Equation]
(17) for which we have proven Proposition 2.
D W HY MINIMIZING THE CONTRASTIVE LOSS MAXIMIZES THE LOWER BOUND OF TASK - RELEVANT INFORMATION ?
In this section, we show that minimizing the proposed contrastive loss, namely
[Equation]
actually maximizes an lower bound of task-relevant information
I ( h , y ) .
We start by considering a simpliﬁed but equivalent situation.
Suppose that we have a query sample z + , together with a set
X = { z 1 , . . .
, z N } consisting of N samples with one positive sample z p from the same class as z + deﬁnitely, and other negative samples are randomly sampled, namely X = { z p } ∪ X neg .
Then the expectation of
L contrast can be written as
[Equation]
Eq.
(19) can be viewed as a categorical cross-entropy loss of recognizing the positive sample z p correctly.
Hence, we deﬁne the optimal probability of this classiﬁcation problem as P pos ( z i | X ) , which denotes the true probability of z i being the positive sample.
Assuming that the label of z p is y , the positive and negative samples can be viewed as being sampled from the true distributions p ( z | y ) and p ( z ) , respectively.
As a consequence, P pos ( z i | X ) can be derived as
[Equation]
which indicates that an optimal value for exp ( z + (cid:62) z p /τ ) is p ( z p | y ) p ( z p ) .
Therefore, by assuming that z + is uniformly sampled from all classes, we have
[Equation]
In the above, Inequality (24) follows from Oord et al.
(2018), which quickly becomes more accurate when N increases.
Inequality (27) follows from the data processing inequality (Shwartz-Ziv &
Tishby, 2017).
Finally, we have E
[ L contrast ] ≥ log ( N − 1) − I ( h , y ) , and thus minimizing L contrast under the stochastic gradient descent framework maximizes a lower bound of I ( h , y ) .
E A RCHITECTURE OF AUXILIARY NETWORKS
Here, we introduce the network architectures of w , ψ and φ we use in our experiments.
Note that, w is a decoder that aims to reconstruct the input images from deep features, while ψ and φ share the same architecture except for the last layer.
The architectures used on CIFAR, SVHN and STLare shown in Table 7 and Table 8.
Architectures on ImageNet are shown in Table 9 and Table 10.
The architecture of ψ for the semantic segmentation experiments on Cityscapes is shown in Table 11, where we use the same decoder w as on ImageNet (except for the size of feature maps).
An empirical study on the size and architecture of auxiliary nets is presented in Appendix H.
F D ETAILS OF E XPERIMENTS
Datasets.
The CIFAR-10 (Krizhevsky et al., 2009) dataset consists of 60,000 32x32 colored images of 10 classes, 50,000 for training and 10,000 for test.
We normalize the images with channel
[Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
, BatchNorm
[Table]
×
[Table]
conv., stride=2, padding=1, output channels
[Table]
, BatchNorm
[Table]
×
[Table]
conv., stride=2, padding=1, output channels
[Table]
512, BatchNorm
[Table]
1 × 1 conv., stride
[Table]
1, padding
[Table]
0, output channels
[Table]
, BatchNorm
[Table] [Table]
means and standard deviations for pre-processing.
Then data augmentation is performed by 4x random translation followed by random horizontal ﬂip (He et al., 2016; Huang et al., 2019).
SVHN (Netzer et al., 2011) consists of 32x32 colored images of digits.
73,257 images for training and 26,032 images for test are provided.
Following Tarvainen & Valpola (2017);
Wang et al.
(2020a), we perform random 2x2 translation to augment the training set.
(3) STL-10 (Coates et al., 2011) contains 5,000 training examples divided into 10 predeﬁned folds with 1000 examples each, and 8,000 images for test.
We use all the labeled images for training and test the performance on the provided test set.
Data augmentation is performed by 4x4 random translation followed by random horizontal ﬂip.
(4) ImageNet is a 1,000-class dataset from ILSVRC2012 (Deng et al., 2009), with 1. million images for training and 50,000 images for validation.
We adopt the same data augmentation and pre-processing conﬁgurations as Huang et al.
(2019; 2018b)
; Wang et al
Following Chen et al.
(2017), we conduct our experiments on the ﬁnely annotated dataset and report the performance on the validation set.
The training images are augmented by randomly scaling (from 0.5 to 2.0) followed by randomly cropping high-resolution patches (512 × 1024 or 640 × 1280).
At test time, we simply feed the whole 1024 × 2048 images into the model.
Networks and training hyper-parameters.
Our experiments on CIAFR-10, SVHN and STL-10 are based on three popular networks, namely ResNet-32/110 (He et al., 2016) and DenseNet-BC-100-
(Huang et al., 2019).
The networks are trained using a SGD optimizer with a Nesterov momentum of 0.9 for 160 epochs.
The L2 weight decay ratio is set to 1e-4.
For ResNets, the batch size is set to 1024 and 128 for CIFAR-10/SVHN and STL-10, associated with an initial learning rate of 0.
and 0.1, respectively.
For DenseNets, we use a batch size of 256 and an initial learning rate of 0.2.
The cosine learning rate annealing is adopted.
Note that, the results of greedy supervised learning presented in Table 1 follows exactly the same experimental conﬁgurations stated here.
On ImageNet, we train ResNet-101 and ResNet-152 with a batch size of 1024 and an initial learning rate of 0.4.
For
ResNeXt-101, 32 × 8d, we use a batch size of 512 and an initial learning rate of 0.2.
The number of training epochs is set to 90.
Other hyper-parameters are the same as CIAFR-10.
For the DeepLab-V model used in semantic segmentation, we follow the training conﬁgurations of MMSegmentation (Contributors, 2020) (with ResNet-101 and synthetic batch normalization), except for using an initial learning rate of 0.015 when setting the batch size to 12 or using 640 × 1280 cropped patches.
Local module splitting.
Since ResNets consist of a cascade of residual blocks, which naturally should not be further divided into smaller parts, we view each residual block as a minimal indivisible unit, or say, a basic layer (distinguished from a single convolutional layer).
Particularly, the ﬁrst convolutional layer of the network is individually viewed as a basic layer.
As a consequence, ResNet32 has 16 basic layers, and ResNet-110 has 55 basic layers.
If ResNet-32 is split into K = 8 local modules, then each module will have 2 basic layers.
In the cases where the number of basic layers is not divisible by K , we assign one less basic layer to earlier modules.
For example, if ResNetis split into K = 4 modules, the corresponding numbers of basic layers will be { 13 , 14 , 14 , 14 } .
If ResNet-110 is split into K = 16 modules, the corresponding numbers of basic layers will be { 3 } × 9 modules + { 4 } × 7 modules.
For DenseNet-BC, similarly, we view each dense layer (the composite function BN-ReLU- × 1Conv-BN-ReLU-3 × 3Conv) as a basic layer following their paper (Huang et al., 2019).
The ﬁrst convolutional layer and the transition layers are viewed as individual basic layers.
The splitting criteria is the same as ResNets.
Notably, for InfoPro ∗ , the networks are divided to make sure that each local module has the same memory consumption during training, and hence the aforementioned splitting criteria based on the same numbers of basic layers is not applicable, as we discussed in Section 4.1.
G D ETAILS OF M UTUAL I NFORMATION E STIMATION
In this section, we describe the details on obtaining the estimates of I ( h , x ) and I ( h , y ) we present in Figures 2, 3 and 6.
As we have discussed in Section 3.3, the expected reconstruction error R ( x | h ) follows I ( h , x )=
H ( x ) − H ( x | h ) ≥ H ( x ) −R ( x | h ) (Vincent et al., 2008; Rifai et al., 2012; Kingma & Welling, 2013; Makhzani et al., 2015; Hjelm et al., 2019).
Therefore, similar to Section 3.3, we estimate
I ( h , x ) by training a decoder parameterized by w to obtain the minimal reconstruction loss, namely
I ( h , x ) ≈ max w [ H ( x ) − R w ( x | h )] .
Note that, ideally, this bound can be arbitrarily tight provided that w has sufﬁcient capacity.
In speciﬁc, we use the same network architecture as Table 7, and train it for 10 epochs to minimize the averaged binary cross-entropy reconstruction loss of each pixel.
An adam (Kingma & Ba, 2014) optimizer with default hyper-parameters (lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight decay=0) is adopted.
Naive as this procedure might seems, for one thing, we ﬁnd that it is sufﬁcient to reconstruct the input images well given enough information, and meanwhile distinguish different values of I ( h , x ) via the quality of reconstructed images, as shown in Figure 7.
For another, we are primarily concerned with the comparisons of I ( h , x ) between end-to-end training and various cases of greedy supervised learning rather than obtaining the exact values of
I ( h , x ) .
The same training process is applied to all the intermediate features h , and hence the comparisons are fair.
Finally, since H ( x ) is a constant, for the ease of understanding, we simply present 1 − AverageBinaryCrossEntropyLoss ( x | h ) as the estimates of I ( h , x ) , equivalent to adding the constant 1 − H ( x ) to the real estimates of I ( h , x ) .
[Figure] [Figure]
[Figure]
For I ( h , y ) , as we have discussed in Section 3.3 as well, since I ( h , y )
=
H ( y ) − H
( y | h ) =
H ( y ) − E
( h ,y )
[ − log p ( y | h )] , we train an auxiliary classiﬁer q ψ ( y | h ) with parameters ψ to approximate p ( y | h ) , such that we have I ( h , y )
≈ max ψ { H ( y ) − 1 N [ (cid:80)
Ni =1 − log q ψ ( y i |
h i )] } .
Here we simply adopt the test accuracy of q ψ ( y | h ) as the estimate of I ( h , y ) , which is highly correlated to the value of − 1 N [ (cid:80) Ni =1 − log q ψ ( y i | h i )] } (or say, the cross-entropy loss).
This can be viewed as the highest generation performance that a classiﬁer based on h is able to reach.
Notably, we use a ResNet-32 as q ψ .
For the inputs of q ψ , we up-sample h to 32 × 32 and map h to 16 channels at the ﬁrst layer.
All training hyper-parameters of the ResNet-32 are the same as Appendix F.
H M ORE R ESULTS
Size and architecture of auxiliary nets .
Here we investigate how the auxiliary nets (i.e., w , ψ and φ ) inﬂuence the performance of our method.
Since ψ and φ share the same architecture, we study the decoder w and the projection head φ for example.
We start by scaling their width with a certain factor (which equals 1 for our original design), and show the results in Figure 8.
It can be observed that using larger w and φ both improve the performance, but the effects are less signiﬁcant.
In addition, their sizes can be shrunk by up to 2 times without severely degrading the accuracy.
We also test other architectures for φ in Table 12, where “Conv” and “Linear” refer to convolutional and linear layers, respectively.
We ﬁnd that involving at least one conv layer and a following MLP instead of a simple linear layer are both important designs.
Besides, although adding more conv layers further boosts the performance, we observe that this comes at a considerably increased computational overhead.
Temperature τ .
In Figure 9, we change the temperature τ for InfoPro (Contrast).
Our method is robust to τ when τ ≤ 0 .
However, we ﬁnd the training tends to be unstable when τ < 0 .
Batch size .
For a comprehensive comparison of InfoPro (Softmax) and InfoPro (Contrast), we vary the batch sizes for the SGD optimizer, and present the results in Table 13.
It is shown that training models with small mini-batches for sufﬁcient epochs is beneﬁcial for InfoPro (Softmax), but produces limited positive effects on InfoPro (Contrast).
We also note that using small mini-batches
[Figure] [Figure]
[Table] [Table]
[Table]
usually prolongs the practical training time as they cannot make full use of even a single GPU (Nvidia Titan Xp).
Besides, when considering a short schedule with the same number of updates (iterations), adopting small mini-batches signiﬁcantly hurts the performance of InfoPro (Contrast)
[Table]
This observation is consistent with previous works (Chen et al., 2020;
He et al., 2020; Khosla et al., 2020).
[Figure]
E s t i m a t
e s o f
I ( h , y ) a nd
I ( x , y )
Tightness of the Upper Bound ¯ L InfoPro
I ( x ,y ) I ( h ,y )
Empirical study on the tightness of the upper bound.
Here, we empirically study the gap between of the upper bound ¯ L InfoPro and L InfoPro .
Since the gap (cid:15) = ¯
L InfoPro − L InfoPro is upper bounded by (cid:15) ≤ λ
[ I ( x , y ) − I ( h , y )] , we sim- ply need to check the gap between I ( x , y ) and
I ( h , y ) .
To this end, we consider training a
ResNet-110 on CIFAR-10 using InfoPro (Contrast) with K =2 , and estimate the mutual information
I ( h , y ) between the outputs of the ﬁrst local module and the label.
In addition, to obtain a comparable estimate of I ( x , y ) , we assume that in end-to-end learned networks, the intermediate features retain all the task-relevant information within the original inputs (which is empirically observed in this paper).
Hence, we can estimate I ( x , y ) by training the network in an end-to-end fashion, and estimating the mutual information
I ( h , y ) in the same position as the end of the ﬁrst module.
The comparisons between the estimates of I ( x , y ) and I ( h , y ) are presented in Figure 10.
One can observe that the gap (cid:15) shrinks gradually during the training process.
Results with VGG are presented in Table 14.
Obviously, similar observations to Table 2 can be obtained.
InfoPro achieves competitive performance with E2E training, while outperforming DGL.
Transferability.
To verify the transferability of the models trained by the proposed method, we initialize the backbone of Faster-RCNN (Ren et al., 2015) using ResNet-101 trained by E2E training and InfoPro ∗ , K = 2 on ImageNet, and train it for the MS COCO (Lin et al., 2014) object detection task.
The training process adopts the default conﬁguration of MMDetection (Chen et al., 2019) with feature pyramid networks (FPN)
(Lin et al., 2017).
The results are reported in Table 15.
It can be observed that the locally learned backbone using InfoPro ∗ outperforms its E2E counterpart in terms of average precision (AP).
This result is consistent with the accuracy on ImageNet.
I A DDITIONAL D ISCUSSIONS AND F UTURE W ORK
Applying InfoPro to regression tasks.
Although this paper mainly focuses on implementing InfoPro in the context of classiﬁcation based tasks (i.e., image classiﬁcation and semantic segmentation), the formulation of L InfoPro and ¯ L InfoPro is general and ﬂexible.
As long as the mutual information
I ( h , x ) and I ( h , y ) can be estimated, InfoPro is able to be used in more tasks.
In vision tasks,
I ( h , x ) can usually be estimated with a decoder, as we introduced in Section 3.3, while for estimating
I ( h , y ) , the technique we discussed may be easily extended to the regression tasks (e.g., depth estimation, bounding box regression in object detection).
For example, consider a target value y i ∈ [0 , 1] corresponding to the sample x i and the hidden representation h i .
It can be viewed as a Bernoulli distribution where P ( y = 1) =
y i , such that we have I ( h , y )
≈ max ψ { H ( y ) −
N [ (cid:80) N i =1 − y
i log q ψ ( y = 1 | h i ) − (1 − y i ) log q ψ ( y =
| h i )] } .
As a result, the auxiliary network q ψ ( y | h ) can be trained with the binary cross-entropy loss.
This might also be approximated by the mean-square loss as it has the same minima as the binary cross-entropy loss.
In the future, we will focus on applying InfoPro to more complex tasks, such as 2D/3D detection, instance segmentation and video recognition.