4. Building makemore Part 3: Activations, Gradients, BatchNorm
We dive into some of the internals of MLPs with multiple layers and scrutinize the statistics of the forward pass activations, backward pass gradients, and some of the pitfalls when they are improperly scaled. We also look at the typical diagnostic tools and visualizations you’d want to use to understand the health of your deep network. We learn why training deep neural nets can be fragile and introduce the first modern innovation that made doing so much easier: Batch Normalization. Residual connections and the Adam optimizer remain notable todos for later video.
Links:
- makemore on github:
- jupyter notebook I built in this video:
- collab notebook:
Useful links:
- “Kaiming init“ paper:
- BatchNorm paper:
- Bengio et al. 2003 MLP language model paper (pdf):
- Good paper illustrating some of the problems with batchnorm in practice:
Exercises:
- E01: I did not get around to seeing what happens when you initialize all weights and biases to zero. Try this and train the neural net. You might think either that 1) the network trains just fine or 2) the network doesn’t train at all, but actually it is 3) the network trains but only partially, and achieves a pretty bad final performance. Inspect the gradients and activations to figure out what is happening and why the network is only partially training, and what part is being trained exactly.
- E02: BatchNorm, unlike other normalization layers like LayerNorm/GroupNorm etc. has the big advantage that after training, the batchnorm gamma/beta can be “folded into“ the weights of the preceeding Linear layers, effectively erasing the need to forward it at test time. Set up a small 3-layer MLP with batchnorms, train the network, then “fold“ the batchnorm gamma/beta into the preceeding Linear layer’s W,b by creating a new W2, b2 and erasing the batch norm. Verify that this gives the same forward pass during inference. i.e. we see that the batchnorm is there just for stabilizing the training, and can be thrown out after training is done! pretty cool.
Chapters:
00:00:00 intro
00:01:22 starter code
00:04:19 fixing the initial loss
00:12:59 fixing the saturated tanh
00:27:53 calculating the init scale: “Kaiming init”
00:40:40 batch normalization
01:03:07 batch normalization: summary
01:04:50 real example: resnet50 walkthrough
01:14:10 summary of the lecture
01:18:35 just kidding: part2: PyTorch-ifying the code
01:26:51 viz #1: forward pass activations statistics
01:30:54 viz #2: backward pass gradient statistics
01:32:07 the fully linear case of no non-linearities
01:36:15 viz #3: parameter activation and gradient statistics
01:39:55 viz #4: update:data ratio over time
01:46:04 bringing back batchnorm, looking at the visualizations
01:51:34 summary of the lecture for real this time
25 views
5712
1896
10 years ago 01:44:11 169
Unreal Engine 4 RTS Building Units
8 years ago 01:04:19 12
Making Giants Part 4: The Building
7 years ago 00:04:32 0
Building 4
10 years ago 00:17:07 723
The Sims 4 House Building - Design Villa - Speed Build
10 years ago 00:16:55 18
FIFA 15 | SQUAD BUILDING | #4
6 years ago 00:13:04 23
The Sims 4 House Building - 5x5 Tiny Home
4 years ago 00:28:48 71
DevTalk #4: Building the Endgame
8 years ago 00:21:35 12
Sims 4 Building. СТРОИТЕЛЬСТВО КВАРТИРЫ
10 years ago 00:16:08 584
The Sims 4 - House Building - Modern Mansion with GLASS FLOOR
5 years ago 00:03:42 987
Sims 4 Bunk Bed | NO CC | Tutorial | NEW Platforms | Sims 4 Building Tips & Tricks
11 years ago 00:28:44 43
Aircraft Modelling Techniques Part 4 - Building & Fitting the Wings
10 years ago 00:09:59 977
The Sims 4 - House Building - Red Velvet
3 years ago 00:09:23 220
This Item Changes Building FOREVER! | Terraria (Spoilers)
12 years ago 00:03:10 10
Building a Reaver Titan Part 4
13 years ago 00:11:25 23
How To Sculpt Ecorche Hercules Ecorche - Part 4 Armature Stand Building
7 years ago 02:33:04 47
Unreal Engine 4 - Building a zombie game from scratch! (Part 1)
3 years ago 00:11:49 55
4 TOP CHEST BUILDING EXERCISES!
10 months ago 00:09:43 0
Chapter 4 Building an argument
6 years ago 00:12:40 95
Tiny House - The Sims 4 Build
9 years ago 00:12:31 296
The Sims 4 | Apartment Building - Hippy Apartment
8 years ago 00:06:26 501
Обзор игрового набора «The Sims 4 Родители» | Building
9 years ago 01:29:16 8
Minecraft vs Fallout 4 building - Строительство x1
11 years ago 00:02:30 179
The Sims 4 - Build Mode Gameplay Trailer
9 years ago 00:01:26 699
The Sims 4 - Building Tips & Tricks | 3 MoveObjects Ideas