{'fraction_non_alphanumeric': 0.035983662014182974, 'fraction_numerical': 0.010424236349512617, 'mean_word_length': 4.868823529411765, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Why should we add early exits to neural networks?

Deep neural networks are generally designed as a stack of differentiable layers, in which a prediction is obtained only after running the full stack. Recently, some contributions have proposed techniques to endow the networks with early exits, allowing to obtain predictions at intermediate points of the stack. These multi-output networks have a number of advantages, including: (i) significant reductions of the inference time, (ii) reduced tendency to overfitting and vanishing gradients, and (iii) capability of being distributed over multi-tier computation platforms. In addition, they connect to the wider themes of biological plausibility and layered cognitive reasoning. In this paper, we provide a comprehensive introduction to this family of neural networks, by describing in a unified fashion the way these architectures can be designed, trained, and actually deployed in time-constrained scenarios. We also describe in-depth their application scenarios in 5G and Fog computing environments, as long as some of the open research questions connected to them.


Introduction
The success of deep networks can be attributed in large part to their extreme modularity and compositionality, coupled with the power of automatic optimization routines such as stochastic gradient descent [78]. While a number of innovative components have been proposed recently (such as attention layers [71], neural ODEs [17], and graph modules [63]), the vast majority of deep networks is designed as a sequential stack of (differentiable) layers, trained by propagating the gradient from the final layer inwards.
Even if the optimization of very large stacks of layers can today be greatly improved with modern techniques such as residual connections [77], their implementation still brings

INTRODUCTION
forth a number of possible drawbacks. Firstly, very deep networks are hard to parallelize because of the gradient locking problem [52] and the purely sequential nature of their information flow. Secondly, in the inference phase, these networks are complex to implement in resource-constrained or distributed scenarios [57,34]. Thirdly, overfitting and vanishing gradient phenomena can still happen even with strong regularization, due the possibility of raw memorization intrinsic to these architectures [29].
When discussing overfitting and model selection, these are generally considered properties of a given network applied to a full dataset. However, recently, a large number of contributions, e.g., [38,73,48,7,3], have shown that, even in very complex datasets such as ImageNet, the majority of patterns can be classified by resorting to smaller architectures. For example, [40] shows that the features extracted by a single convolutional layer already achieve a top-5 accuracy exceeding 30% on ImageNet. Even more notably, [75,32] show that predictions that would be correct with smaller architectures can become incorrect with progressively deeper architectures, a phenomenon the authors call over-thinking.
In this paper, we explore a way to tackle with all these problems simultaneously, by endowing a given deep networks with multiple early exits (auxiliary classifiers) departing from separate points in the architecture (see Fig. 1). Having one/two auxiliary classifiers is a common technique to simplify gradient propagation in deep networks, such as in the original Inception architecture [67]. However, recently it was recognized that these multi-exit networks have a number of benefits, including the possibility of devising layered training strategies, improving the efficiency of the inference phase, regularizing for computational cost, just to name a few. Depending on which of these aspects takes priority on a certain application, in this paper we overview a number of techniques and ideas to design, train, and deploy this emerging class of neural network models.

Contribution of this work
While multi-exit networks have attracted significant interest lately, the related literature is widely fragmented, with similar ideas reappearing under broadly different names (e.g., cascaded networks [48], IDK networks [75], deeply-supervised models [38], etc.). In this paper, we aim at providing a coherent and unified introduction to them, by highlighting the key challenges and opportunities related to their optimized design, training, and implementation.
To this end, this overview is broadly structured as follows. Section 2 briefly overviews three separate research lines that are closely connected to this paper. In Section 3 we describe the multi-exit neural network models. We also briefly introduce the main issues related to them, which are explored more in-depth in the following sections: designing and placing the auxiliary components (Section 4), training strategies (Section 5), and multi-exit inference (Section 6). Then, in Section 7 we connect our discussion to some broader themes of interest, namely, biological plausibility of the training paradigms, distributed implementation on multi-tiered (e.g., networked) platforms, and the information bottleneck principle. We conclude by highlighting some open research challenges in Section 8.

Related works
Before moving to the main part of the overview, we briefly review three lines of works that are related to the topics we describe. This also allows us to properly define the domain of the paper.

Fast inference in neural networks
Designing NN with fast execution times is a critical task, especially in resource-constrained applications (e.g., mobile and IoT). An early example is the work pursued by [14], where a very deep NN generates an endless stream of labelled examples for the adaptive training of a much smaller student network. More in general, several authors have considered lowering the implementation complexity by reducing the computational precision of the performed per-layer operations, either through compression (e.g., group sparsity), quantization, or the introduction of specific low-latency components [26,59].
Multi-output neural networks are well suited for fast inference, but they exploit an orthogonal mechanism to the works described before. Instead of searching for a single, efficient network for processing all input patterns, they constrain the processing time to be small for the majority of input patterns, through the introduction of early exits (see in particular Section 6 later on). We avoid an overview of the relevant literature here, as it would be redundant with respect to the rest of the manuscript. We refer for this especially to Section 5.

Distributed training of neural networks
As we describe below, a second important motivation for multiple exits is to distribute model training and evaluation on a multi-tiered platform, such as in emerging Fog Computing (FC) applications. In fact, the general topic of the design of multi-tier FC platforms is receiving large attention in these last years, mainly due to the emerging areas of the Mobile Cloud, Pervasive Computing and Edge Computing [54,46]. These contributions focus on the offloading of (parts of) application programs from mobile devices to nearby FC servers through the exploitation of WiFi/Cellular-based communication technologies (see, for example, [4] and references therein for an updated overview of this topic). NNs with multiple exits fit naturally into this paradigm, and we overview this more in-depth in Section 7.2. A related topic is that of distributed training of NN architectures on networks of interrelated agents, e.g., [62]. As we discuss in Section 7.2 and Section 5.3, some training approaches for multi-output networks naturally lend themselves to distributed implementations.

Layered training
Having multiple early exits makes the NN a stage-wise classifier (see in particular Fig. 3(a) and Section 5.3). Layerwise training approaches have always been a fundamental area of research in neural networks. In fact, some of the earliest models predating back-propagation were iterative [28,7], and (unsupervised) layerwise strategies were instrumental in the training of some early very deep CNN models [10]. In this paper, we also survey layered optimization strategies in the context of multi-output neural networks. However, we underline that many recent lines of research on multi-layered training, such as boosting neural classifiers [18,25], kernel-based methods [35], progressive growing architectures [31], or clustering methods [47], do not fit into our model.

Description of the model
The discussion in Section 2 has framed several key concerns in the use of neural networks. We now turn to introducing formally the idea of multi-output networks, a design strategy that can be exploited to simplify training, reduce the inference cost, and distribute computation.

Basic neural networks
Consider a generic deep neural network f (x), taking an input x and providing a prediction y. The input x can be as simple as a vector, or a more structured data type, such as an image, a sequence, a video, a graph, etc. Without loss of generality, we assume that f is composed by the cascade of L differentiable operators f 1 , . . . , f L : where • denotes function composition such that ( f i • f j )(·) = f i ( f j (·)). Examples of operations that can act as components in (1) include convolutional layers for images [21], batch normalization, self-attention [71], and many others. 1 We denote by h i the output of the ith operation, so that h i f i (h i−1 ), and h L = y is the final output of the network. It is common to refer to h i as the ith embedding generated by the network for the input x. Finally, θ i will denote the set of adaptable parameters of the ith layer, which can eventually be empty (e.g., in the case of dropout). Given a set of examples D = {(x n , y n )} N n=1 and a loss function l(·, ·) penalizing the wrong predictions of the network, the parameters are tuned by performing stochastic gradient descent (SGD) on the expected loss: where θ = L i=1 θ i is the union of all trainable parameters. In this basic setup, all L layers must be evaluated before obtaining a prediction and this full processing, as we elaborated on in the introduction, might not be necessary and even downright harmful in terms of overfitting and energy consumption. Next, we describe a model that attempts to address these drawbacks by adding intermediate prediction steps along the network stack.

Neural networks with early exits
In order to describe this extended architecture, we begin by selecting a set of early exit indices C ⊆ {1, . . . , L − 1} corresponding to 'interesting' mid-points in the architecture. We will have more to say on how to properly select C in the following sections of the paper. At each mid-point i ∈ C that was selected, we feed the intermediate embedding h i to an auxiliary classifier/regressor c i to obtain an intermediate prediction y i : where c i is another (smaller) auxiliary neural network in the form (1), typically consisting of only one/two layers. We call f the backbone network, c i the ith auxiliary classifier/regressor, and y i the ith early-exit from the backbone. This setup is depicted graphically in Fig. 1. As a result, by running the full network with all early exits we obtain a sequence of predictions y i , i ∈ C, each potentially more refined and accurate than the previous one. However, in order to make the specification of this model useful, a number of questions must be answered, forming the basis for the rest of this overview. We briefly summarize the key points below. Note that some design choices are mutually dependent (e.g., the training strategy can influence the criterion for placing the auxiliary classifiers). However, for clarity, we try to keep them conceptually separated and mention inter-dependencies when needed in the corresponding sections.

Selecting where and how to early-exit
Firstly, one has to select the design of the auxiliary models, the number of early exits, and their placements over the backbone network. If the multi-exit architecture is used only to counter overfitting, then a small number of early exits is generally sufficient. For example, the original Inception model described in [67] has two early exits, placed roughly at 1/3 and 2/3 of the backbone network. More in general, however, placing a set of early exits to satisfy energy or efficiency constraints is a combinatorial problem. This problem is formally described in Section 4.

Training the network
Secondly, a proper training mechanism must be devised. Here, we partition the possible training approaches in three broad classes: 1. The overall architecture can be trained jointly by defining a single optimization problem that embraces all intermediate exits. This can be done by a combination of per-classifier losses [38], or by first combining the outputs and then building a single loss atop this combination [61].

2.
We can adopt a layer-wise approach, where at each iteration we train a single auxiliary classifier together with the backbone layers preceding it, and, then, we freeze them after training [23].
3. We can first train the backbone network, and then separately train the auxiliary classifiers on top of it [72]. This can be interpreted as a very primitive form of knowledge distillation [24].
We describe these three classes, along with some design considerations, in Section 5.

Exploiting multiple early exits in the inference phase
Thirdly, once the network is trained, a suitable inference mechanism must be chosen. Once again, in the simplest case, auxiliary classifiers are used only to simplify gradient flow, and in this case their intermediate exits can be discarded [67]. Alternatively, the different predictions can be combined to obtain an ensemble almost for free [61]. In the most interesting case, however, one wants to exploit the different exits to process each input as efficiently as possible, by selecting the first auxiliary classifier that has a reasonable chance to provide the correct prediction, exploiting the full network only for cases that are extremely hard to predict [79]. In this case, it is necessary to select (and possibly train) a criterion to decide whether to exit the network or whether to continue processing over the next block. We consider this task in Section 6.

Formal properties of multi-exit networks
Finally, we can consider the properties induced by the separate exits, in terms of, e.g., nonconvexity of the optimization problem [77], convergence and generalization gaps of the different training approaches, guaranteed accuracy of the intermediate predictions, and so on. While the focus of this survey is more application-oriented, we still overview some of the most interesting results on these formal topics later on.

Placement and optimized design of the early exits
To begin with, we need to devise an optimized strategy for designing and implementing the auxiliary classifiers c i . 2 For fully-connected layers, the vast majority of works consider either simple linear classifiers [68], or small neural networks with one/two hidden layers [32]. For convolutional layers, this is slightly more complex because early layers in most CNNs have a very high dimensionality, which would result in extremely high-dimensional classifiers [32].
A simple solution in this case is to consider very strong dimensionality reduction procedures before the classification step, in the form of global average pooling or pooling with very large windows.
A similar consideration has to be taken into account when designing the set of indexes C for the placements of the early exits. Properly selecting this set is especially important for the case in which early exits must be used to speed-up the inference phase. A very simple technique is to estimate the relative computational cost of each layer, and place the early exits to some given percentiles of the network' total cost [32].
More in general, let us suppose that γ i denotes the computational cost of running the network up to early exit i (as measured, e.g., in total number of operations to be performed). Similarly, denote by I i the fraction of data that exits at the ith early exit (techniques to decide when to stop are discussed later on in Section 6). Focusing only on early exit i, using the auxiliary classifier improves the efficiency of the network whenever the following relation is met [56]: Because the number of possible placements of M early exits in a network grows exponentially in the network's depth L, the optimal placement according to (4) can only be evaluated for small networks. However, possibly sub-optimal greedy algorithms have been proposed to evaluate the placement from the original of the network up to the final layer [56,3]. The algorithm in [3], in particular, allows to define a further hyper-parameter TH ∈ [0, 1] to fine-tune the final validation accuracy. To use the same description as in [61], we overload our previous notation and define γ f i to be the computational cost of f i alone, and similarly for γ c i . In addition, we define a compression ratio cm i = I i+1 I i . Then, the greedy approach in [3] keeps an early exit whenever the following relation at layer i is met: An alternative approach, described in [12], is to evaluate each early exit considering both constant auxiliary classifiers and adaptive auxiliary classifiers. Whenever the former performs better in terms of training / efficiency trade-off, we remove them from our set. General hyperparameter optimization procedures [65] can also be used to fine-tune the entire architecture, including the eventual placement of some early exits.

Training neural networks with early exits
In this section, we consider the second problem introduced in Section 3, namely, training the architecture. We describe several variants that have been proposed in the literature, and we highlight some of their formal properties. Note that, once the set C of the early exit placements has been designed, we can always assume that there is a one-to-one correspondence between layers and auxiliary classifiers, since in-between layers can be merged into a single layer. Because this simplifies our notation, we will make this assumption from here on. This section is organized as follows: we start with joint training strategies in Sections 5.1 and 5.2, then we describe layer-wise strategies in Section 5.3, and we conclude with other variants in Section 5.4.

Joint training approaches
In the simplest setup, we can associate a loss L i to each intermediate classifier c i , and perform SGD on a suitable combination of all losses. We call this joint training (JT) or, equivalently, deeply-supervised [38]. Specifically, we train the model on: where L (called the overall loss in [38]) is the final loss defined in (2), L i is an auxiliary loss (called companion loss in [38]) defined as: and α i weights the contribution of the ith auxiliary classifier. We will discuss the selection of these weights later on. In general, if the auxiliary classifiers are only used to improve performance, it is customary to weight earlier classifiers less. For example, the Inception model [67] propose to set α i = 0.3. A schematic description of the joint training method is provided in Fig. 2. Apart from Inception, similar approaches have been successfully applied to, among others, face recognition [66], object detection [15], image segmentation [16], pose estimation [27], saliency detection [43], metric learning [76], visual attention prediction [74], and super resolution [36,70]. JT approaches are also popular in the case of recurrent neural networks for sequence classification / regression, in which intermediate predictions can be obtained for free by considering the outputs of the network at each time-step [42].

On the convergence property of the JT approach
Interestingly, it can be shown that even a relatively simple setup as (7) can improve the convergence of the resulting network with early exits. [38] analyzes the case where the loss is selected as the squared hinge loss (although the proof can be easily extended to other losses, such as the cross-entropy), and each loss is augmented by an 2 regularization term. In this case, they prove in [38] the following result. 3 close to the optimal θ * . Let us denote by T the number of iterations of SGD, by η t = 1/t the decaying step size at iteration t, by θ standard T the solution obtained by SGD at iteration T when optimizing (2), and by θ joint T the one obtained by optimizing (7). Then, optimizing (7) compared to (2) provides a relative speed-up in convergence of

Theorem 1 (Theorem 1, [38]) Assume that
The authors in [38] argue that, in practice, the Lipschitz constant λ of the companion loss is large (compared to the Lipschitz constant of the original loss), providing a justification for the good empirical performance of the JT approach. However, analyzing and proving the relationship between the inner (local) and standard optimization problems remain open questions. Also, we note that this strategy could benefit from a more efficient sampling of patterns at the different exits, although this aspect has not received much attention in the literature.

Joint training on a combined output
A variant of the JT approach is described in [33]. Instead of merging the auxiliary losses, we can adaptively merge the predictions of the network as: where the weights α and α i can be trained simultaneously with θ . Several variants can be devised where, for example, weights are constrained to be positive, or they are processed through a softmax function to arrive at a convex combination. More in general, we can devise a range of options to adaptively combine the different auxiliary predictions. For example, [69] analyze max-pooling and average-pooling to combine the different predictions with a fixed (non-trainable) operation. Alternatively, [61] endows each early exit with an additional binary classifier g i (x) ∈ [0, 1] to decide how much the current prediction should be trusted. In this case, the global output can be defined recursively as:ĉ where the base case is the final predictionĉ L (x) = f (x). The combination process can also be implemented through an additional network component (e.g., an LSTM or recurrent network), providing a further degree of freedom to the system. This last setup is related to the use of boosting methods to incrementally build the network's architecture [18,51].

Layer-wise training
The insertion of auxiliary local classifiers opens up interesting alternatives to the standard joint training described above. In particular, we can devise a layer-wise training (LT) strategy by separately optimizing each layer in the architecture. Note that supervised and unsupervised LT methods were explored repeatedly in the initial attempts at building deeper architectures [10,37]. Only recently, however, have they become a successful tool for training them, e.g., through boosting [18,25], clustering [47], and kernel similarity [35].
In the context of multi-exit networks as described in this paper, [23] introduced the general idea under the name 'forward thinking', while [48] calls it 'deep cascade learning'. We depict it visually in Fig. 3(a).
According to Fig. 3(a), the LT approach proceeds as follows: 1. Start by training the first auxiliary classifier c 1 ( f 1 (x)), depicted as Training #1 in Fig.  3(a). Considering the notation of Section 5.1, this is equivalent to minimize L 1 individually.
2. Freeze the previous layer, by replacing all inputs x i in the training set with the corresponding embedding f 1 (x i ).
3. Train the second layer c 2 ( f 2 (·)), by solving L 2 only with respect to the weights θ 2 .

Repeat steps (2)-(3) for as many layers as needed.
The advantage of this method is that, since each layer is relatively small (depending on the size of each f i and c i ), regularization problems such as vanishing and exploding gradients should be less prominent under this training approach [23]. An extension to semi-supervised problems with growing networks is presented in [73].

On the formal properties of the LT approach
A preliminary formal analysis of the LT approach is provided in [8], and later extended in [7]. Roughly speaking, their works show that, if each layer-wise optimization process incurs an error that is upper bounded by , the final predictions given by the network will have an error with a similar upper bound given by O(L 2 ). They also show, empirically and through an informal analysis, that the approach will naturally lead to increasing the linear separability of the data for each layer that is added. Notably, [7] is the first work to show that LT can scale to large-scale problems, such as image classification on ImageNet. Additional formal considerations are provided in [3] showing that, under suitable considerations on the blocks composing the architecture, there always exists a solution in which adding a new layer does not worsen the empirical error of the model.

Further training approaches
Besides joint training (Sections 5.1 and 5.2) and layer-wise training (Section 5.3), the flexibility of the architectures analyzed in this paper lend themselves to a variety of alternative training approaches, which we briefly describe in the sequel. First of all, several authors  Figure 4: Example of progressively freezing out layers as in [13]. [72,55,12,32] have considered a variation of LT, in which the backbone network is trained separately from each of the auxiliary classifier. This is depicted visually in Fig. 3(b). This kind of approach is especially suitable for describing and analyzing situations in which the backbone network is provided beforehand, and we desire to turn it into a multi-exit architecture. It also allows for easy experimentation on the selection of the auxiliary classifiers, which can be trained and removed quickly according to the rules-of-thumb introduced in Section 4. Finally, it allows for the use of non-neural auxiliary classifiers [72], such as using decision trees or support vector machines for the intermediate predictions.
Some strategies mix different approaches. For example, freezeout [13] is a variation of the JT approach, in which layers are iteratively 'freezed' by annealing their learning rates to zero, providing a trade-off between the accuracy of training everything jointly with a partial speed-up similar to a layer-wise training. Specifically, denote by η i (t) the learning rate of layer i at iteration t. Given a budget of training iterations T , we select a set of freezing points t i equispaced in [0, T ]. Then, the learning rate of layer i for t < t i is given by: while η i (t) = 0 for t > t i . An example with L = 3, T = 150, and η i (0) = 0.1 is shown in Fig.  4.
To conclude this section, we also mention that some authors have considered reinforcement learning strategies to train the overall architecture [22].

Inference in multi-exit networks
We now focus on the topic of performing inference in architectures with multiple auxiliary classifiers. Note that, in some cases, this is trivial. For example, in architectures such as Inception [67], where the auxiliary classifiers are only used for improving the training phase, one can discard them and use f (x) as the single final exit. In other cases, such as the aggregated output from (8) or (9), the network automatically provides a joint prediction that merges all the intermediate ones.
In the most interesting case, however, we can assume that every input x has an optimal depth corresponding to one specific prediction c i (x). In this case, we prefer to process each input up to the corresponding exit and, then, stop the forward propagation. In fact, similar schemes have been shown to provide significant improvements in inference time [68,69], and they can also prevent overfitting. In particular, [32] describes a phenomenon it calls over-thinking, in which a prediction c i (x) on the test set is correct, but later predictions turn out to be wrong.
For classification problems, a common setup in this case is to consider the confidence of the network on its own prediction, and exploit this to decide whether to early-exit the architecture. According to this setup, denote by c i t (x) the prediction of the ith classifier on the tth class, and by C the total number of classes. The normalized entropy of the prediction is: The value H [c i (x)] is always normalized between 0 and 1. By comparing H [c i (x)] against a user-selected threshold β i , we can make the final decision on whether to exit the architecture. This strategy was popularized by BranchyNet [68,69]. The drawback of this approach is that a separate threshold must be selected for each auxiliary classifier, in order to ensure that the average accuracy of the model does not degrade. [75] describes other alternatives, including using the most-confident prediction instead of the entropy, or learning the confidence score on top of c i (x) with a separate trainable function g i (c i (x)). The gating approach described in (9) is a specialization of this idea. Alternatively, [3] introduces an iterative approach to fine-tune a single threshold given a desired accuracy on the level, based on a gradient-like approach exploiting the error between the current level of accuracy and the desired one. The strategy is also proved in [3] to be convergent.

Regularizing for computational cost
One interesting side benefit arising from the utilization of early exits we study here is that we can regularize the resulting networks for efficiency. Searching for efficient architectures is a wide problem in the literature on neural model selection [58]. Having multiple auxiliary classifiers allows for an unprecedented opportunity of optimizing the accuracy/efficiency trade-off for each input [61].
To this end, denote by δ i j an indicator function describing whether the ith training pattern was processed by the jth auxiliary classifier. In addition, denote by ε j the cost of executing the jth auxiliary classifier as compared to the ( j − 1)th one. Cost here is a generic quantity, that we can define to simply consider the number of operations executed by the auxiliary classifier (in this case ε j = γ c j as defined in Section 4), or a more abstract definition, which can include the communication costs in a distributed environment [79]. The average cost of f is, then, defined as follows: Relation (12) can now be used in any procedure to select the hyper-parameters of the model, in order to explicitly trade-off the average inference cost of the neural network.
In addition, supposing that the exit strategy g i (x) is differentiable (such as the entropy measure described previously), similarly to (9), we can define a soft-approximation to (12) as [61]: where: Since the above expression is differentiable, we can use it as an alternative to the classical p regularization to provide an explicit trade-off concerning accuracy and efficiency of the network, as described by the average computation cost incurred for a single example.
In the case of a pre-trained backbone network, [12] explores training separately each auxiliary classifier with a constraint on computational time. The global problem is, then, reduced to a sequence of weighted binary classification problems, where the weights depend on the costs. This is extended in [65], where the entire network design (including multiple hyper-parameters) is optimized through a Bayesian optimization procedure.

Additional topics
In this section we detail three interesting applicative fields for the multi-output architecture described in the paper. We start with the topic of biological plausibility of deep networks and their training algorithms in Section 7.1, move on to a distributed implementation over multi-tiered or distributed environments in Section 7.2, and conclude with an overview of layer-wise training in the context of the information bottleneck principle in Section 7.3.

Biological plausibility of multi-exit networks
Multi-exit architectures in their LT formulation provide an interesting perspective on biological plausibility of neural network training [49]. In fact, backpropagation in classical neural networks is generally considered to be biologically implausible for multiple reasons [11], i.e.,: (i) the need to store the outputs for each intermediate layer f i , to re-use it in the backward pass; (ii) the symmetry of weight matrices between forward and backward passes; and (iii) the perfect synchronization required by the process. Point (ii) has been explored in-depth in the literature on feedback alignment (and similar) [41,52,5], in which it is shown that the transpose of the weight matrix can be replaced by a (fixed) random matrix during the backward pass while still allowing for convergence of the algorithm. This approach, however, still requires a global error to be back-propagated from the final output layer, thus failing to satisfy points (i) and (iii).
[49] explores a variation of the LT approach, in which each auxiliary classifier is set as where M is a random matrix, which is eventually replaced by a separate random matrix K (of the same size) during the backward pass. This approach can still obtain good results in training (albeit not at the level of a classical LT training), while being implementable through highly compact update equations involving only local error terms, thus drastically improving the overall biological plausibility of the model.
How to extend this framework to improve the classification results closer to the state-ofthe-art while not sacrificing the biological plausibility remains an open research question. For example, [53] further replaces the true label at each auxiliary exit with a randomly projected version, while at the same time increasing the supervised loss with a separate one that forces the embeddings of the network to be similar whenever the corresponding projected outputs are similar. In [9], the authors investigate this approach for parallel optimization of the network, where a set of intermediate buffers is added to ensure the possibility of decoupling a layer from the previous ones. Based on the literature on target propagation [39], the authors in [30] propose a further extension to decouple the different updates, in which the targets for the different early exits are computed adaptively from the original output y i by an additional set of autoencoder networks.

Distributed implementation of multi-exit networks
Many recent computation frameworks, ranging from 5G cellular networks to IoT sensors and fog computing, are built upon the idea of multi-tier computations, in which decisions can be taken both at the edge of the networks or delegated to other, more powerful decision centers that incur some communication latency [57,79]. In these works, it is common to design systems in which separate neural networks, of different complexities, can run on the different tiers or on different computational units [44,50].
Multi-exit neural networks fit naturally inside these emerging classes of technologies, by distributing different auxiliary classifiers over the different tiers, as depicted in Fig. 5. In this case, an estimation of the cost of communicating across the channel can be included both in the design of the early exits, as described in Section 4, or in the model selection /  regularization phase, as described in Section 6.1 [40]. An interesting question concerns the additional implementation of a distributed training phase [62], which is necessary whenever the separate tiers have to adapt to new data without the possibility of communicating everything to a centralized controller. LT methods lend themselves naturally to an iterative implementation, in which every tier trains its own model before sending the new set of input features to the next tier. Alternatively, more sophisticated distributed optimization strategies, possibly taking into account also communication constraints, are an open interesting research area [6,4].

The information bottleneck principle
The last application context that we consider is that of the information bottleneck (IB) principle [1]. The IB was proposed as a general principle to explain the expressive power of deep networks, relying on information theoretic principles. Interestingly, one possibility for the actual implementation and test of the IB principle results in a different training scenario for multi-exit neural networks [19].
Slightly overloading our notation, denote by X a random variable describing the inputs to the network, by Y a second random variable describing the corresponding targets, and by F i a third random variable describing the embeddings generated by layer f i . In addition, denote by I(·, ·) the mutual information between two random variables. Roughly, the IB principle states that neural networks work because their intermediate representations tend to simultaneously maximize their mutual information with the target, while at the same time minimizing their mutual information with the input. Stated differently, they tend to compress information as much as possible while keeping the most predictive bits of information. Stated more formally, the IB principle states that intermediate representations tend to minimize: where β is a trade-off parameter. 4 While the IB principle has received ample empirical validation [60,64], it is common to evaluate and/or apply it only to a single layer of the network. [19] proposes to exploit the IB principle as a training criterion for neural networks, wherein the network is trained according to a LT approach, substituting the local loss term L i in (7) with an approximation of (15). Interestingly, this approximation requires the addition of multiple auxiliary classifiers to the network, acting as discriminators between embeddings corresponding to separate classes. Alternative supervised and unsupervised training strategies have also been proposed in a number of papers [20,45].

Open research challenges
In this paper, we provided a self-contained, unified introduction to the design, implementation, and training of neural network with multiple early exits. As we argued, these models have a number of favourable properties, including a higher resilience to gradient problems, as long as a large flexibility to more advanced training / inference strategies. They also provide a viable entry point to the study of more biologically plausible alternatives to classical back-propagation, and they are more naturally suited to an implementation in multi-tiered computational frameworks such as the emerging fog computing one [2].
Apart from the multiple minor points discussed in the paper, we identify three main areas where research is needed in this context.

Challenge 1: How powerful are multi-output neural networks?
The formal properties of these more general network architectures are only recently starting to be investigated, as we described in this paper, leaving ample margins to, e.g., quantify the relative generalization gap of each component. In addition, while these techniques have been applied multiple times to CNNs and, in smaller measure, to RNNs, their usefulness remains to be tested on more modern neural layers, such as graph convolutional networks, and transformer architectures. Finally, how to properly consider both architectural constraints, accuracy, and communication costs when implementing the networks in a distributed environment is still an open question.

Challenge 2: Full integration in FC/IoT environments
In principle, multi-output NNs promise to be a perfect match for distributed, multi-tiered systems given by the convergence of several recent paradigms, most notably Fog Computing