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
19 views
4411
1477
2 hours ago 00:21:22 1
[Sliinky 2] High Elimination Solo Zero Builds (Fortnite Chapter 6)
4 hours ago 00:01:00 2
Казань, Россия.Вид на воздушный вид семейного центра Казан (свадебный дворец), вид с воздухом, точка интереса
5 hours ago 00:55:42 4
[Made in scale] Petlyakov Pe-2 dive bomber 1/48 scale model build, Zvezda 4809
5 hours ago 00:00:16 2
Долли зум.Хаарлем, Нидерланды.Церковь Святого Баво - готический храм.Панорамный вид на центр города Хаарлем.Облачная ...
7 hours ago 00:00:12 1
Памятник Умберто-и.Villa Borghese Gardens, Рим, Италия
8 hours ago 00:08:05 6
[BERKLEY] 😱ТОП 10 ЛУЧШИХ СКРИПТОВЫХ МОДОВ ДЛЯ ГТА 5 (2024)! ЛУЧШИЕ МОДЫ ДЛЯ GTA 5! TOP 10 GTA 5 MODS 2024
9 hours ago 00:00:07 2
Долли зум.Сергиев Посад, Россия.Троицкий-сергиус Лавра является крупнейшим мужским монастырем русской православной це...
9 hours ago 00:15:24 1.3K
Нам 38 лет ВРАЛИ о ЧЕРНОБЫЛЕ❗Правда которую скрывали...
9 hours ago 00:31:53 2
БИСТРО - СТРОИТЕЛЬСТВО СИМС 4 // The Sims 4 Speed Build No CC
9 hours ago 00:23:29 1
ФЕРМЕРСКИЙ РЫНОК - СТРОИТЕЛЬСТВО СИМС 4 // The Sims 4 Speed Build No CC
10 hours ago 00:20:18 1
КОННОЕ РАНЧО - СТРОИТЕЛЬСТВО В СИМС 4 // The Sims 4 Speed Build No CC
10 hours ago 00:00:16 2
Генуя, Италия.Центральная часть города, вид с воздуха.Корабли в порту, вид с воздуха
10 hours ago 00:10:08 1
АЗИАТСКИЙ ПАРК - СТРОИТЕЛЬСТВО В СИМС 4 // The Sims 4 Speed Build No CC
10 hours ago 00:13:38 1
CAKE PARTY HOUSE // The Sims 4 Speed Build No CC
10 hours ago 00:10:26 1
ЧАЙНАЯ ВЕЧЕРИНКА (АЛИСА В СТРАНЕ ЧУДЕС) - СТРОИТЕЛЬСТВО СИМС 4 // The Sims 4 Speed Build No CC
10 hours ago 00:12:08 1
LUXURY JEWELRY SHOP (Tiffany & Co) // The Sims 4 Speed Build No CC
10 hours ago 00:14:42 1
СТРОИМ СРЕДНЕВЕКОВЫЙ ЗАМОК В ВИНДЕНБУРГЕ В СИМС 4 | THE SIMS 4 CASTLE SPEED BUILD NO CC
10 hours ago 00:00:55 2
Нэнси, Франция.Панорама центральной части города.Лето, солнечный день, вид с воздуха
10 hours ago 00:11:51 2
[Jimmy Vegas] UNITY 6 TUTORIAL PART 4 - LIGHT AND SHADOWS - HOW TO MAKE A GAME FOR BEGINNERS
11 hours ago 00:03:50 6
(480p).mp4
11 hours ago 00:00:19 2
Стокгольм, Швеция.Остров Riddarholmen и Lake Malaren.Церковь Риддархольмен.Панорама города.Летний день, вид с воздуха
11 hours ago 00:02:48 9
(720p).mp4
11 hours ago 00:00:06 9
(720p).mp4
11 hours ago 00:05:18 1
Alagir Gorge. Uastyrdzy. North Ossetia mountains. Russia. Full HD