RESIDUAL NETWORKS CLASSIFY INPUTS BASED ON THEIR NEURAL TRANSIENT DYNAMICS

1 INTRODUCTION . Residual networks ( ResNets ) , first introduced in ( He et al. , 2016 ) , have been more successful in classification tasks in comparison with many other standard methods . This success is attributed to the skip connections between layers that facilitate the propagation of the gradient throughout the network , and in practice allow very deep networks to undergo a successful training . Apart from mitigating the gradient problem in deep networks , the skip connections introduce a dependency between variables in different layers that can be seen as a system state . This novelty provides an opportunity for interesting theoretical analysis of their functioning , and has been the underlying pillar for some interesting analysis of such networks from dynamical system point of view ( Ciccone et al. , 2018 ; Chang et al. , 2018 ; Haber & Ruthotto , 2017 ; Lu et al. , 2017 ; Liao & Poggio , 2016 ; Ruthotto & Haber , 2018 ; Chaudhari et al. , 2017 ) . This study mainly emphasizes the importance of internal transient dynamics in ResNets on classification performance . Using a dynamical system approach , for a general ResNet , we derive dynamics of state evolutions of the residuals in different layers . It is well-known that very deep residual networks with weight sharing are equivalent to shallow recurrent neural networks , with similar performance to ResNets with variable weights between layers ( Liao & Poggio , 2016 ) . Inspired by this work , we study ResNets with shared weights and sigmoid activation functions , which provide a more tractable mathematical analysis . Then , we show empirically that those dynamics are observed in ResNets with variable weights as well . To study the classification performance of ResNets on noisy inputs , we compare the dynamics of noise evolution in these networks with that of Multi-Layer Perceptrons ( MLP ) , and find that for small noise amplitudes , MLP has a higher value of signal to noise ratio . However , for increased noise amplitude , ResNets are more robust . The main contributions of the paper are : 1 . We show that network internal dynamics that are shaped by neural transient dynamics are well separated for each input class . 2 . We compare the transient dynamics of MLP and ResNets , and show how a noise term in the input evolves in the network , and how it affects the classification robustness . 3 . Based on residual dynamics , we develop a new method to obtain an adaptive depth for ResNets , during training , for input classification . 2 RELATED WORK . In ( Haber & Ruthotto , 2017 ) , the authors have studied residual networks using difference equations , and analyzed the stability of the forward propagation of input data , and have linked the inverse problem to the well-posedness of the learning problem . To circumvent the vanishing or exploding gradient problem , it is suggested in ( Haber & Ruthotto , 2017 ) to design the eigenvalues of the feedforward propagation close to the edge of stability , so that the inverse problem is not ill-posed . It is however not clear whether having the eigenvalues set close to the edge of stability is beneficial for the network performance , because it depends on the dynamics required by the actual task . Employing this idea , the authors in ( Chang et al. , 2018 ) suggest a new reversible architecture for neural networks based on Hamiltonian systems . Also , in a recent study , ResNets have been employed as an unrolled non-autonomous time-invariant ( with weight sharing ) system of differential equations ( Ciccone et al. , 2018 ) , wherein , each ResNet block receives an external input , which depends on the previous block . This successive process of feeding the following block by the output of the previous block continues until the latent space converges . Our approach in this paper is similar to the aforementioned studies , however , to understand the classification mechanism in ResNets , we focus on the role of the intrinsic transient dynamics of the residuals over different layers of the network . Some studies on ResNets have focused on tracking the features layer by layer ( Greff et al. , 2017 ; Chu et al. , 2017 ) , and have challenged the idea that deeper layers in neural networks build up abstract features that are different than those formed in lower layers . One supporting evidence for this challenge comes from lesion studies on ResNets ( Veit et al. , 2016 ) and Highway networks ( Srivastava et al. , 2015 ) which show that after the network is trained , perturbing the weights in the deep layers does not have a fundamental effect on the network performance , and therefore , does not bring the performance to chance level . However , changing the weights which are closer to initial layers , have more damaging effect . Empirical studies in ( Greff et al. , 2017 ; Chu et al. , 2017 ) suggest an alternative explanation for feature formation in deep layers ; that is , successive layers estimate the same features which , along the depth of the network , are more refined , and yield an estimate with smaller standard deviation than earlier layers . Our study supports this idea by showing that features in different layers of a ResNet with shared weights are formed by the transient dynamics of residuals that may converge towards their steady state values if they are stable . In attractor networks , perturbing the initial layers changes those dynamics more drastically compared to perturbation of deeper layers , because the residuals in the deep layers are either very close to their stable fixed point , or have already converged . If there are no attractors for the residuals , sensitivity to initial conditions and the internal dynamics of the residuals play an important role in classification . In this case , perturbations of the network at initial layers can potentially change the dynamic evolution of the residuals completely , and this will have a more sever impact on the output . Classification based on unstable internal states is similar to Reservoir networks ( Maass et al. , 2002 ) , where it has been shown that the high dimensionality of the neurons at the readout layer can compensate for the lack of stability of the neural activities . Moreover , one important topic in this domain is the depth of ResNets . On the one hand , the success of ResNets in classification has been attributed to their deep architecture ( He et al. , 2016 ) , on the other hand , there are studies that claim most of the training is accomplished in the initial layers , and having a very deep architecture is not necessary ( Zagoruyko & Komodakis , 2016 ) . Another challenge is to understand the generalization property of ResNets ( which may be related to its depth ) , because their power is correlated with their ability in recognizing unseen data that also belong to the classes that these networks have been trained on . In our analysis of the transient and steady state dynamics of the residuals , we discuss these issues . In fact , an important finding of this paper is that residual networks classify inputs based on summing over all the residual ’ s outputs throughout the network , meaning different transitions of residuals ( convergence to their steady state , or their long wandering trajectories without convergence ) can potentially change the classification result . Interestingly , in biological neuronal networks , it has been suggested that optimal stimulus separation in neurons that encode sensory information occurs during the transients rather than the fixed points of the neuronal activity trajectories ( Mazor & Laurent , 2005 ; Rabinovich et al. , 2008 ) . Also , it has been discussed that spatio-temporal processing in cortical circuits are state dependent , and the role of transients are crucial ( Buonomano & Maass , 2009 ) . In our study we show that also in ResNets , these transients are the decisive factors for classification . Based on this finding , we show how a noise term in the input is mapped to the output , and we develop a new method to control the depth of ResNets . 3 DYNAMICS OF INTERACTIONS BETWEEN RESIDUALS . We consider a dense ResNet with N input dimensions , and arbitrary T layers with exactly N neurons at each layer . A unique property of a ResNet that distinguishes it from conventional feedforward networks ( such as MLP ) is the skip connection between layers . In the ResNet we consider here , the activity of neuron i at layer t , before the output of the previous layer ( t − 1 ) is added to it , is represented as yi ( t ) , and the activity of all neurons in the same layer is represented by the vector y ( t ) . After the integration of the output from layer t − 1 , the output of layer t is represented by x ( t ) . The components of these residuals y ( t ) are calculated based on a linear function of x ( t ) , i.e . zi ( t ) = ∑N i=1 wij ( t ) xj ( t ) followed by a nonlinear function f ( zi ) . Figure 1 illustrates the relation between x and y . Any hidden layer t represents a sample of the dynamical states x after t steps . Input data is considered as the initial condition of the system , and is depicted by x ( 0 ) . Interpreting the network as a dynamical system which evolves throughout the layers , the dynamics of neural activations are x ( t + 1 ) = x ( t ) + y ( t + 1 ) , where y ( t ) is the output of the neurons , and in the rest of the paper , they are called ” residuals ” . This equation implies a difference equation for the variable x ( t ) , that is x ( t+1 ) −x ( t ) = y ( t+1 ) . The left side of this equation resembles the forward Euler method of derivative of a continuous system , when the discretization step is equal to 1 . This approximates a continuous system with dynamics that follow ẋi ( t ) = yi ( t ) . We are interested in understanding how the neural activities evolve over layers in a feedforward fully connected ResNet . The dynamics of x ( t ) and inputs to the residuals , z ( t ) , follow ẋi ( t ) = yi ( t ) = f ( zi ( t ) ) =⇒ xi ( t ) = ∫ t 0 yi ( τ ) dτ + xi ( 0 ) zi ( t ) = N∑ j=1 wij ( t ) xj ( t ) + bi =⇒ żi ( t ) = N∑ j=1 wij ( t ) ẋj ( t ) + ẇij ( t ) xj ( t ) ( 1 ) The first line of equation 1 indicates that x ( t ) stores the sum of the residuals and the input ( x ( 0 ) ) from the input layer up to layer t , meaning that x ( t ) is a cumulative signal for y ( t ) , as well as the input data . For a ResNet with shared weights between layers , ẇij ( t ) = 0 ; because the weights do not change between layers . This constraint makes the analysis simpler , and results in żi ( t ) = ∑N j=1 wij ẋj ( t ) . In this case , after replacing ẋi ( t ) by yi ( t ) in equation 1 , the dynamics of z ( t ) and the residuals y ( t ) will be żi ( t ) = N∑ j=1 wij ( t ) yj ( t ) ẏi ( t ) = ∂yi ( t ) ∂zi ( t ) ∂zi ( t ) ∂t = ∂f ( z ) ∂z ( N∑ j=1 wij ( t ) yj ( t ) ) . ( 2 ) A steady state solution for yi , in a network with a time invariant weight wij ( shared weights across layers ) , is obtained from setting either of the two terms on the right hand side of equation 2 to zero . For a general nonlinear f ( . ) , according to equation 2 , the interactions between the residuals are either competitive or cooperative , depending on the positive or negative influence that they have on each other . For a logistic function f ( . ) , the derivative is yi ( t ) ( 1− yi ( t ) ) , which results in a particular form of predator-prey equation , well-known in studying ecosystems . In this case , equation 2 yields ẏi ( t ) = yi ( t ) ( 1− yi ( t ) ) ( N∑ j=1 wij ( t ) yj ( t ) ) ( 3 ) For N residuals , the number of possible fixed points ( solutions of equation 3 ) is 3N . However , for a given weight W , only some of the fixed points are stable . The initial condition for the residuals is determined by the output of the first layer . After some transients over the next layers , each residual converges to its stable solution , if there is one . Note that the derivatives at yi = 0 or 1 are equal to zero , and the system ’ s trajectories are confined to this space . According to equation 1 and figure 1 , the cumulative of the residuals over the entire network feeds the classifier . Therefore , perturbations at initial layers of the network disrupt the output more severely than perturbations of the deeper layers ( lesion studies have considered weight perturbations , which reflects on neural activity perturbations ) . A discrete-time analysis of the effect of perturbations at different layers on the output value is given in the Appendix . To study the contribution of input noise ( ξ ) in the final hidden layer , we derive the noise evolution for the ResNet considered above ( a similar analysis applies to ResNets with continuous activation functions ) . Represented in vector notations , the signal plus noise evolution is obtained by replacing yi in equation equation 3 by y + ξ. ẏ + ξ̇ = ( y + ξ ) ( 1− y − ξ ) ( W ( y + ξ ) ) = y ( 1− y ) ( Wy ) + y ( 1− y ) ( Wξ ) + ξ ( 1− 2y ) ( W ( y + ξ ) ) − ξ2 ( W ( y + ξ ) ) ( 4 ) Assuming that y ( t ) is the solution of the neural activity at layer t for the input signal without noise ( that is reflected in initial condition y ( 1 ) ) , subtracting equation 3 from equation 4 yields ξ̇ = y ( 1− y ) ( Wξ ) + ξ ( 1− 2y ) ( W ( y + ξ ) ) − ξ2 ( W ( y + ξ ) ) = y ( 1− y ) ( W ( ξ + y − y ) ) + ξ ( 1− 2y − ξ ) ( W ( y + ξ ) ) = y ( 1− y ) ( Wy ) + y ( 1− y ) ( W ( ξ − y ) ) + ξ ( 1− 2y − ξ ) ( W ( y + ξ ) ) = ẏ + y ( 1− y ) ( W ( ξ − y ) ) + ξ ( 1− y − ( y + ξ ) ) ( W ( y + ξ ) ) ( 5 ) In equation 5 and equation 4 , the vectors y and ξ are functions of t. This equation indicates how the growth rate of the noise ( ξ̇ ) differs from the growth rate of the residuals ( ẏ ) .

Summary: This paper aims to view the computations performed by residual networks through the lens of transient dynamical systems. A rough intuition is provided, followed by experiments in a toy concentric circle example and on MNIST. Finally, a method to determine the appropriate depth of ResNets is proposed, though experiments are only performed in the toy concentric circle experiment.