Module 5 — Neural Network Fundamentals
Neural Networks are the foundation of modern Deep Learning and Transformer architectures. Every Transformer layer consists of linear transformations, activation functions, normalization layers, and regularization techniques.
Topics
- Linear Layer
- Bias
- Activation Functions
- Sigmoid
- Tanh
- ReLU
- GELU
- Softmax
- LayerNorm
- Dropout
1. Linear Layer
A linear layer performs a linear transformation on the input vector.
Formula
where
- = Input vector
- = Weight matrix
- = Bias vector
- = Output vector
2. Bias
The bias shifts the output of a linear transformation.
Formula
Bias allows the model to fit data more effectively by introducing an offset.
3. Activation Functions
Activation functions introduce non-linearity into neural networks.
General Formula
4. Sigmoid
Maps input values to the range .
Formula
Derivative
5. Tanh
Maps input values to the range .
Formula
Derivative
6. ReLU
Rectified Linear Unit is the most widely used activation function.
Formula
Derivative
7. GELU
Gaussian Error Linear Unit is the default activation used in BERT, GPT, ViT, and most modern Transformer models.
Exact Formula
where
is the cumulative distribution function (CDF) of the standard normal distribution.
Approximation
8. Softmax
Softmax converts logits into probabilities.
Formula
Properties
Softmax is used in:
- Token Prediction
- Classification
- Attention Mechanisms
9. Layer Normalization (LayerNorm)
Layer Normalization stabilizes training by normalizing features.
Mean
Variance
Normalize
Output
where
- = Scale parameter
- = Shift parameter
10. Dropout
Dropout randomly deactivates neurons during training to reduce overfitting.
Formula
where
- = Binary mask
- = Dropout probability
Expected Value
Why Neural Networks Matter in Transformers
Neural Network fundamentals are used throughout Transformer architectures.
Applications include:
- Embedding Layers
- Self-Attention
- Multi-Head Attention
- Feed Forward Networks
- Encoder Layers
- Decoder Layers
- BERT
- GPT
- T5
- Vision Transformers (ViT)
- Large Language Models (LLMs)
Summary
| Concept | Formula |
|---|---|
| Linear Layer | |
| Bias | |
| Activation |