



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




CS 7810 - Advanced Deep Learning | Notes: Wk 3- Topics: backprop, optimization, attention mechanism, transformer architecture
Foundation of DL. Just chain rule applied to computational graphs. People overcomplicate this. Chain rule: if L = f(g(x)), then dL/dx = (dL/df)(df/dx) <- works for scalars; for vectors need Jacobians Backprop in a graph: forward pass computes activations and caches them. Backward pass computes gradients starting from loss, propagates backward through graph using chain rule at each node. Computational complexity: forward = O(params), backward = O(params) too. Memory: need to cache all intermediate activations for backward pass -> memory scales w/ depth. Gradient checkpointing trades compute for memory (recompute activations during backward instead of storing).
Deep networks suffer from this. Gradients get multiplied many times during backprop.
Vanilla SGD: theta <- theta - lr * gradient. Too slow, sensitive to lr, gets stuck in saddle points. SGD + Momentum: accumulate exponentially decaying moving avg of past gradients. v <- betav - lrg, theta <- theta + v. Beta ~= 0.9 typically.
Adam (Kingma & Ba 2014 - prob most cited ML paper ever??):
Constant LR rarely optimal. Common schedules:
Each encoder layer:
Has an EXTRA sublayer compared to encoder:
Self-attention is permutation invariant (no notion of position). Need to add positional info. Original paper: fixed sinusoidal encoding:
Key properties:
Weight decay: L2 penalty on weights. In AdamW, applied directly (not through gradient), i.e., theta <- theta * (1 - lr * lambda) - lr * g. Important distinction from L2 regularization w/ Adam. Mixed precision training (FP16/BF16): store weights in FP32, forward/backward in FP16, scale loss to avoid underflow. BF16 preferred over FP16 for stability (same exponent range as FP32). Huge memory savings.
Two major pretraining paradigms: