## Welcome and Introduction Norris: Welcome back to Mechanical Dreams, the podcast where we dive into the gears of machine learning and natural language processing. I am Professor Norris, and joining me as always is my brilliant student, Linda, who never fails to bring me a paper that forces me to rethink how I teach my Intro to Deep Learning course. Linda: Hi everyone! And thank you, Professor. I do try my best to keep you on your toes. This week, I think I have brought something really special. It is a 2021 paper by Alejandro Cabana and Luis F. Lago-Fernandez titled Backward Gradient Normalization in Deep Neural Networks. Norris: Backward Gradient Normalization. Okay, I hear the word normalization and my mind immediately jumps to Batch Norm, Layer Norm, Weight Norm, the list goes on. The field loves normalizing things. What makes this one stand out enough to make it onto our desk today? Linda: I know, I know, yet another normalization technique sounds like a tough sell. But the mechanism here is incredibly elegant. Typically, when we talk about normalization, like Batch Normalization, we are tweaking the activations during the forward pass to keep the network stable. This paper introduces a technique that leaves the forward pass completely untouched. It only modifies the backward pass. Norris: Untouched? You mean it literally does nothing during the forward propagation? Just an identity function? Linda: Exactly! It acts as a phantom layer going forward, simply passing the input to the output. The real magic happens when the error signal starts flowing backwards. It rescales the gradients to ensure they reach the deepest layers of the network without vanishing into the abyss or exploding into numerical issues. Norris: The vanishing and exploding gradient problems. The classic dragons of deep learning. We have been fighting those beasts since the 90s. I usually tell my graduate students that if their network is not learning, it is either a data problem, or their gradients have quietly died somewhere in layer 40. Linda: Right! And as networks get deeper and deeper, especially in fields like computer vision and NLP, keeping those gradients healthy is more critical than ever. The authors propose inserting these Backward Gradient Normalization, or BGN, layers at specific points in the architecture to maintain a well-scaled gradient flow. Norris: It sounds almost too clean. A layer that only wakes up during backprop to tidy up the math. I will admit, Linda, I am a bit skeptical. We already have ResNets, LSTMs, and proper initialization techniques that handle these gradient issues quite well. But, you have definitely piqued my curiosity. If it can do what it claims without messing up the forward activations, it could be a very powerful tool. Linda: Oh, it definitely delivers, and the experimental results on very deep neural networks are fascinating. They tested it on networks up to 120 layers deep! Norris: 120 layers? Well, that is certainly one way to stress-test a gradient. Let us get into the weeds, then. How exactly are we taming the ghost of gradients past? ## The Ghost of Gradients Past Norris: To really appreciate what Cabana and Lago-Fernández are proposing, we have to respect the ghosts we are fighting. For our listeners who might just be entering the field, taking deep networks for granted: back in the dark ages, getting a standard dense network with more than a few layers to converge was like trying to balance a pencil on its tip. The culprit, of course, was the chain rule. Linda: Right. Backpropagation relies on the chain rule to calculate gradients. If you are multiplying a sequence of derivatives that are less than one, like the gradients of the classic sigmoid or tanh functions, the error signal decays exponentially as it flows backward from the output layer to the input layer. The weights in the initial layers basically never update. The network just stalls. Norris: Exactly, the vanishing gradient problem. Or the inverse scenario: if the derivatives are greater than one, you get exploding gradients, where the numbers balloon to infinity and your weights turn into NaNs faster than you can hit the kill switch on your terminal. We didn't just sit around and accept it, though. We came up with some pretty clever workarounds over the years. Gradient clipping was a simple band-aid for the explosions. Linda: And for the vanishing side, the field practically revolutionized itself structurally. We saw architectural changes like LSTMs for recurrent networks, where the gradients can flow through a path that remains almost unchanged. And later, ResNets introduced skip connections in convolutional networks, allowing gradients to bypass layers entirely and take a more direct path backward. Norris: Not to mention throwing out the sigmoid function in favor of ReLU. Due to its constant gradient of one in the active region, ReLU naturally suffers much less from vanishing gradients. Add in smart weight initialization tricks, like scaling initial weights by the fan-in and fan-out of neurons, and it felt like the problem was mostly behind us. Linda: That is true, but even those have limits. That is why Batch Normalization became such a staple in modern architectures. It normalizes the neuron's preactivation using the actual batch data before applying the non-linearity. It is incredibly effective, but as we touched on earlier, it fundamentally alters your forward pass. You are constantly shifting the data distributions. Norris: Which can be an absolute nightmare for certain sequence models, or when your batch size is heavily constrained by GPU memory limits. So, if we accept that Batch Norm is not a silver bullet, where does this new paper draw its inspiration? You mentioned BGN doesn't touch the forward pass. Linda: It draws heavy inspiration from Normalized Gradient Descent, or NGD, and a 2017 paper by Yu et al. on layer-wise gradient normalization. NGD is interesting because it only uses the gradient direction, discarding the magnitude entirely to update the weights. This naturally bounds the gradient norm and provides a lot of numerical stability. Norris: I remember NGD. By constraining the norm, you avoid the extremes of vanishing and exploding natively. And Yu's block-normalization did something similar on a per-layer basis, right? Linda: Yes, but Yu's approach had a fatal flaw that Cabana and Lago-Fernández point out in their introduction. To do Yu's layer-wise normalization, you have to compute the complete gradient for the entire network using the standard backpropagation algorithm first. Only after you have the whole thing computed do you normalize it layer by layer. Norris: Wait a second. I see the trap. If you have a hundred layers and you are using a standard backprop pass first, and the network is already suffering from vanishing gradients, the computation will just underflow to zero in the early layers. Linda: Exactly! You are trying to normalize zeros. You cannot rescue an error signal that has already decayed into floating-point dust. And that is the exact gap BGN is trying to fill. Norris: Floating-point dust. I like that. So BGN intercepts the gradient during the backward pass itself, before it ever has the chance to vanish. Linda: Bingo. It intercepts, scales, and passes it along, step-by-step. The simplicity of how they implement this BGN layer mathematically is what really makes it stand out. I can walk us through the equations they use to pull this off. ## Unpacking Backward Gradient Normalization Linda: So, as we established, BGN is a phantom on the forward pass. To make this work, the authors propose inserting this special BGN layer at very specific points in the network architecture: just before every single activation function. Norris: Okay, right before the non-linearity. That makes sense conceptually. You want to intercept and normalize the pre-activation gradient before the derivative of the activation function has a chance to squash it. Linda: Exactly. Now, during backpropagation, this layer receives a gradient tensor from the layer above it. Let's call that tensor 'g'. Instead of just passing 'g' backward untouched, the BGN layer calculates the L2 matrix norm of 'g' using the entire batch data. It then divides 'g' by that L2 norm, and multiplies the result by a scalar constant called kappa. Norris: A standard normalization step, forcing the norm to be equal to kappa. But what is kappa? If kappa is an arbitrary hyperparameter, we are just trading the vanishing gradient problem for a hyperparameter tuning nightmare. Linda: They thought of that, and thankfully, no tuning is required. In all their experiments, kappa is strictly set to the square root of 'd', where 'd' is the dimension of the gradient 'g', excluding the batch size. Norris: Ah, the square root of the dimension. That echoes classic weight initialization schemes, like Glorot or He initialization. It mathematically keeps the variance of the gradient signal stable across layers of different widths. Very clean. Linda: It is! And they make a point to emphasize that the normalization uses the entire batch data, meaning all dimensions of the tensor are used for the L2 norm. Norris: So it's aggregating over the batch, not just a per-instance normalization. That would give it a nice statistical smoothing effect, somewhat similar to how Batch Normalization smooths the loss landscape, but acting purely on the derivatives. So, how does this alter the actual chain rule math? Linda: Think about the standard backpropagation equation. Normally, the gradient at layer K is the weight matrix transposed, multiplied by the gradient of layer K plus one, and then element-wise multiplied by the derivative of the activation function. Norris: Right, the classic chain rule formulation. I've written that exact equation on the chalkboard for my Intro to Deep Learning course more times than I can count. Linda: Well, with a BGN layer sandwiched in there, that entire expression gets divided by its own norm, scaled by kappa. The authors abbreviate this normalization scalar as 'n_k'. So the new, normalized gradient at layer K is just the standard gradient expression, multiplied by one over 'n_k'. Norris: Wait a minute. If we expand that recursively... all the way back up to the output layer... the normalized gradient at layer K is just the original, unnormalized gradient, multiplied by the product of one over 'n_j' for all the layers above it. Linda: Yes! You see it! Norris: That is absolutely beautiful. Because all those 'n_j' terms are just scalar values! That means the *direction* of the gradient vector is perfectly conserved. BGN doesn't change the direction of the weight update in hyperspace at all, it only changes its magnitude. Linda: Exactly, Professor! The update to the weights and biases is strictly proportional to the theoretical case without BGN. The authors point out that this is mathematically equivalent to simply assigning a different, dynamically calculated learning rate for every single layer in standard gradient descent. Norris: That is a brilliant way to frame it. Instead of relying on an optimizer to guess per-layer learning rates based on historical momentum, the BGN layer structurally forces the error signal to maintain its magnitude algebraically. The gradient vanishing problem is essentially defined out of existence. Linda: It gets even better. Because the pre-activation gradient is forced to have a norm of kappa, the gradient with respect to the actual weights ends up having the same norm as the *input* to that layer, just scaled by kappa. So, the gradient of each layer is approximately as big as its input. Norris: No matter how deep the network is. Whether you are at layer 2 or layer 90, the weight update is scaled relative to the local input, rather than relying on a progressively decaying whisper from the loss function miles away. I have to admit, Linda, mathematically, this is air-tight. It is incredibly satisfying. Linda: I told you it was elegant! And because it normalizes locally during the backward pass step-by-step, we completely avoid that numerical underflow trap we discussed with Yu's layer-wise method. Norris: Alright, you have thoroughly sold me on the theory. The equations are solid, and the preservation of the gradient direction is the cherry on top. But as we both know, elegant math on a PDF doesn't always survive contact with actual silicon. Let's see how this behaves in practice. I believe you mentioned some visualizations? ## Visualizing the Flow Norris: So, as we left off, we have this beautifully elegant mathematical theory that keeps gradient vectors pointing in the right direction while perfectly scaling their magnitudes. But the proof of the pudding is in the plotting. You mentioned a 90-layer network? Linda: I did. To really visualize how the gradients flow, the authors built a 90-layer dense network and plotted the gradient norms for each layer. They looked at the gradients right after weight initialization, and then again after 20 epochs of training. And they ran these tests across three different activation functions: ReLU, Sigmoid, and Tanh. Norris: 90 hidden layers with a Sigmoid activation. That is essentially a deep learning horror story. I can only imagine the unnormalized plots look like a steep cliff? Linda: A very steep cliff. Looking at their Figure 1, the y-axis is on a logarithmic scale. When no normalization is applied, you see a brutal exponential decay of the gradient norm as you move from the output layer back to the input layers. The early layers are receiving gradient signals that are practically microscopic. The Tanh function fares a tiny bit better, but it still exhibits a clear downward trend. Norris: Which is exactly what we would expect from saturating non-linearities. And what about ReLU? As we discussed earlier, its derivative is one in the active region, so it shouldn't vanish quite as aggressively, right? Linda: Right, the ReLU networks manage to compensate for the decay to some degree. The norm of the gradient with respect to the weights is mostly constant, but the values are still extremely small. However, the moment they introduce the BGN layer into the architecture... Norris: Let me guess: a perfectly horizontal line? Linda: A perfectly horizontal line! Across all three activation functions, the backward normalized gradients maintain a constant norm independent of the layer depth. It looks incredibly stable. Norris: That is highly satisfying. But I am curious about the control group here. How do the gradients look when they use standard Batch Normalization instead of BGN? Linda: This is where the plots get really interesting. When they use Batch Normalization alone, the gradient norm actually increases with the layer depth. It slopes upwards, and this effect is especially pronounced for the ReLU and Tanh units. Norris: Ah, so Batch Norm solves the vanishing gradient by accidentally flirting with the exploding gradient problem. Because Batch Norm acts on the forward pass to stabilize the pre-activations, it doesn't algebraically bound the backward pass in the same strict way BGN does. Linda: Exactly. But the authors also tested what happens when you combine them. When they use Batch Normalization and BGN together, the plots flatten right back out. The gradient norms become almost perfectly constant and sit right around a value of 1 for all depths. Norris: So they play nicely together! That is a crucial finding because, let's face it, no one is going to completely rip Batch Norm out of their production codebases tomorrow. But you mentioned these were just the initial gradients at step zero. What happens when the network actually starts to learn? Linda: They generated a second set of plots after 20 epochs of training. For the unnormalized networks, the vanishing gradient problem becomes even more severe. The network tries to adapt, but it just strands the early layers entirely. Their gradients die out even faster than at initialization. Norris: Right, because the later layers adapt quickly and start outputting smaller errors, which means the already-weak signal propagating to the front becomes practically zero. Standard behavior for a naive deep network. Linda: Yes, but with BGN turned on, the gradients remain healthy and stable even after 20 epochs. The authors even plotted the average change in the network weights per layer after training. Without normalization, there is a monotonic decrease in the weight adaptation as you go deeper into the network. The early layers just do not update. Norris: And with BGN? Linda: With BGN, all the network weights adapt on a similar scale. The learning is distributed beautifully across the entire depth of the network. Norris: So it is not just a theoretical trick to keep numbers looking pretty on a graph. It forces the entire network to participate in the learning process, rather than relying on the last ten layers to do all the heavy lifting. That is fantastic. But of course, distributed learning is only useful if it actually results in better predictions. How did it perform on the benchmarks? ## Results, Trade-offs, and Conclusions Norris: So, Linda, we've got perfectly scaled gradients and beautifully distributed weight updates. But do these pretty graphs actually translate to better performance? Did they run this through the wringer to see if it actually predicts anything? Linda: They did! They tested the architectures on the permutation invariant MNIST dataset, specifically looking at dense networks with depths of 30, 60, 90, and 120 layers. They wanted to see if the network could actually learn the problem at those extreme depths. Norris: 120 layers on MNIST using standard dense networks? That is definitely an artificial stress test. Nobody builds networks like that for simple digit recognition in the real world. But I suppose it is a perfect sandbox for proving their theoretical claims about gradient decay. Linda: Exactly. It is a torture test. And the results are wild. Let's look at the ReLU networks. A 120-layer ReLU network with standard Batch Normalization completely fell apart. It scored about 11 percent accuracy. Since MNIST has ten digits, that is basically random guessing. The network failed to learn entirely. Norris: Ouch. Dead neurons and vanishing signals probably compounded until the network just flatlined. Batch Norm was completely helpless at that depth. And how did Backward Gradient Normalization fare? Linda: With BGN, that exact same 120-layer ReLU network jumped to nearly 86 percent accuracy. And it wasn't just an outlier. Across almost every combination of activation function and depth they tested, BGN either achieved the highest accuracy or was extremely competitive with the best baseline. Norris: Going from random guessing to 86 percent is a massive rescue operation for that network. But accuracy is only half the battle in modern machine learning. What about the computational overhead? We touched on Batch Norm being slow earlier. Linda: The time difference is staggering. For a 90-layer ReLU network, the baseline training time without any normalization was about 40 seconds. Adding Batch Normalization pushed that to roughly 118 seconds. It almost tripled the training time. Norris: That is a huge bottleneck. And BGN? Linda: Adding BGN instead of Batch Norm only took about 50 seconds total. So it just added around 10 seconds of overhead compared to the baseline, whereas Batch Norm added nearly 80 seconds. Norris: Wow. That is practically a rounding error in training time, especially considering it provides a mathematically guaranteed gradient scale. You get the stability without the massive computational tax. Are there any catches? Linda: To be fair to the skeptics, and the authors are very transparent about this, they explicitly state that their network design is not very realistic for the problem. They chose this simple, excessively deep setup specifically to isolate the vanishing and exploding gradient problems. Norris: Which is a highly responsible concession. To truly dethrone our current normalization standards, this needs to be tested on state-of-the-art architectures, like deep CNNs for vision or massive Transformers for natural language processing. Linda: Right. They acknowledge that more systematic comparisons on standard benchmark problems are needed to fully validate the technique. But as a proof of concept, it is incredibly promising. It opens the door to improving very deep neural network training by rethinking how we handle the backward pass. Norris: And that is exactly what good science looks like. Propose a mathematically sound theory, prove it works in a controlled stress test, and clearly state the boundaries of your claims. I have to say, Linda, you have successfully brought me around from a skeptic to a fan of this paper today. Linda: I consider that a huge win! Backward Gradient Normalization is such a neat, elegant tool. It really shows that there is still room for fundamental algorithmic innovation, even on problems we thought we had already solved. Norris: Indeed it does. It is a fantastic reminder to never stop questioning standard practices. Well, I think that is a perfect place to wrap up. Thank you, Linda, for bringing this excellent paper to our attention, and thank you to our listeners for joining us on this mathematical journey. Linda: Thanks everyone! Keep your gradients flowing! Norris: Until next week, this has been Mechanical Dreams.