Source

Yes you should understand backprop | by Andrej Karpathy | Medium

Open the source

Karpathy teaches that backpropagation is a leaky abstraction whose mechanics must be understood to build and debug neural networks effectively. He demonstrates how backward-pass behavior causes saturated sigmoids, dead ReLUs, unstable RNN gradients, and a subtle DQN clipping bug, then recommends intuition-focused study and manual implementation.

- Automatic differentiation does not guarantee that arbitrary combinations of layers will learn successfully. - Saturated sigmoid or tanh units can produce zero gradients, while sigmoid gates diminish gradient magnitude even when they are not saturated. - ReLU neurons that never activate receive zero gradient and can remain permanently dead, with aggressive learning rates able to kill them during training. - Repeated multiplication by an RNN recurrence matrix can make gradients vanish or explode, motivating gradient clipping or LSTMs. - Clipping a forward-pass error can unintentionally set its gradient to zero; a Huber loss can provide the intended robust gradient behavior. - Writing forward and backward passes manually helps develop the intuition needed to diagnose neural-network failures.

Based on Andrej Karpathy's public content. Not affiliated with or endorsed by Andrej Karpathy.

Supports these rules

Quotes from this video

“The problem with Backpropagation is that it is a** [**leaky”

“Backpropagation is a leaky abstraction; it is a credit assignment scheme with non-trivial consequences.”

“I hope you’ll be much more suspicious of backpropagation going forward and think carefully through what the backward pass is doing.”

“if you’re using **sigmoids** or **tanh**non-linearities in your network and you understand backpropagation you should always be nervous about making sure that the initialization doesn’t cause them to be fully saturated.”

“The rest of the backward pass will come out all zero from this point on due to multiplication in the chain rule.”

“These are neurons that never turn on for any example in your entire training set, and will remain permanently”

“Neurons can also die during training, usually as a symptom of aggressive learning rates.”

“This sequence either goes to zero if **\|b\|** 1, or explodes to infinity when **\|b\|>1**.”

“If you understand backpropagation and you’re using RNNs you are nervous about having to do gradient clipping, or you prefer to use an LSTM.”

“This is well-intentioned and looks sensible from the perspective of the forward pass, but it introduces a major bug if you think about the backward pass.”

“the gradient becomes exactly zero during backprop. The authors are clipping the raw Q delta, when they are likely trying to clip the gradient for added robustness.”

“In that case the correct thing to do is to use the Huber loss in place of **tf.square**:”

“the lowest level. The students had to implement the forward and the backward pass of each layer in raw numpy.”

“Instead, I would recommend the [CS231n lecture on backprop](https://www.youtube.com/watch?v=i94OvYb6noo) which emphasizes intuition (yay for shameless self-advertising).”

“And if you can spare the time, as a bonus, work through the [CS231n assignments](https://cs231n.github.io/), which get you to write backprop manually and help you solidify your understanding.”

Topics