← All mindmapsMAIN TOPIC · 05 / 14Deep Learning
Networks, optimization, regularization and sequence models
Explore full topic ↗ Readable revision notes (20 concepts)
The same content as the visual sheet, optimized for mobile and assistive technology.
01 · Neural networks
- Layer: z=Wx+b; activation a=f(z)
- Weights learned; depth builds representations
- ReLU=max(0,z); sigmoid gates; softmax normalizes
02 · Loss functions
- Regression: MSE / MAE; classification: cross-entropy
- CE = −Σ yᵢ log pᵢ; use stable logits-based loss
- Match activation and loss to task
03 · Backpropagation
- Chain rule propagates loss derivatives
- θ ← θ−η∇L; gradients computed by autodiff
- Zero grads between steps when framework accumulates
04 · Optimization
- SGD mini-batches; momentum smooths direction
- Adam uses adaptive first/second moment estimates
- Learning-rate schedules; clip exploding gradients
05 · Regularization
- Dropout masks activations during training
- Weight decay penalizes large weights; early stopping
- Augment training data; validation monitors generalization
06 · Normalization & stability
- BatchNorm uses batch stats during training
- LayerNorm normalizes selected feature dimensions
- Residuals help gradients; initialize weights appropriately
07 · CNN
- Local shared kernels extract spatial features
- Stride/padding control spatial resolution
- Pooling or strided conv reduces dimensions
08 · Sequence models
- RNN updates hidden state; BPTT trains recurrence
- LSTM: input/forget/output gates; GRU simpler gates
- Attention addresses long-range dependencies
09 · Training checklist
- Train/eval modes; monitor loss and gradients
- Mixed precision saves memory; validate numerical stability
- Transfer learning; freeze/unfreeze; test independently
10 · Perceptron & MLP
- Neuron z=wᵀx+b; nonlinearity permits non-linear boundaries.
- Without nonlinear activations stacked linear layers collapse to one linear map.
- Dense layer parameters=(input+1)×output.
11 · Activation functions
- ReLU=max(0,x); dead units possible; Leaky ReLU retains negative slope.
- Sigmoid gates [0,1], tanh [−1,1]; saturate at extremes.
- GELU/SiLU smooth activations; softmax for mutually exclusive class outputs.
12 · Loss & output pairing
- Binary/multilabel: sigmoid + binary CE; multiclass: softmax + CE.
- Use logits-based library loss to avoid numerical instability.
- MSE for continuous targets; Huber balances squared and absolute behavior.
13 · Backprop example
- For ŷ=wx, L=(ŷ−y)²: dL/dw=2(ŷ−y)x.
- Chain rule distributes gradients through graph; optimizer updates parameters.
- Gradient check finite differences on small deterministic example.
14 · SGD, momentum & Adam
- SGD: θ←θ−ηg; momentum accumulates gradient direction.
- Adam: moving mean m and squared mean v; bias-correct then scale m/√v.
- AdamW decouples weight decay from adaptive gradient update; schedule LR.
15 · Initialization & gradient flow
- Xavier suits many symmetric activations; He initialization for ReLU families.
- Repeated small/large Jacobians cause vanishing/exploding gradients.
- Residual paths, normalization, gating and clipping improve stability.
16 · CNN & convolution
- Output floor((N+2P−D(K−1)−1)/S)+1.
- Parameter count KₕKᵥCᵢCₒ+Cₒ (with bias, groups=1).
- Shared local filters; pooling/stride trades detail for receptive field.
17 · RNN / LSTM / GRU
- RNN hₜ=f(Wₓxₜ+Wₕhₜ₋₁+b); BPTT over time.
- LSTM cₜ=fₜ⊙cₜ₋₁+iₜ⊙gₜ; output gate controls exposed state.
- GRU reset/update gates; fewer state components; compare validation/latency.
18 · BatchNorm vs LayerNorm
- BatchNorm uses mini-batch feature statistics and running stats at inference.
- LayerNorm normalizes across chosen feature dimensions per sample/token.
- Small batches can destabilize BN; LN common in transformers.
19 · Training diagnostics
- Plot train vs validation; high train loss may be underfit or optimizer failure.
- NaN: inspect LR, input scale, mixed precision and gradient norms.
- Overfit: augment, dropout, weight decay, early stop; monitor held-out data.
20 · Transfer & distributed training
- Freeze backbone then unfreeze as needed; differential LR.
- Mixed precision reduces memory; gradient accumulation simulates larger batch (with caveats).
- Data parallel replicates model; model parallel shards model; checkpoint activation tradeoff.
References & further study
Original schematics illustrate concepts, not measured data. Review these references for full derivations and implementation details.