Deep Learningbeginnermust-know4 min

Activation Functions

Without them, a deep network is just one big straight line.

Activation functions introduce non linearity into neural networks, allowing them to learn complex non linear patterns. Without non linear activation steps, a multi layer neural network collapses into a simple linear model regardless of depth. Common activations include Sigmoid for probabilities between 0 and 1, Tanh for zero centered signals between minus 1 and plus 1, ReLU for fast computation, and GELU for modern transformer architectures.

Deep Learningbeginnermust-know4 min

Dropout

Randomly switching off neurons, which somehow makes the network better.

Dropout fights overfitting by randomly switching off a fraction of neurons at each training step, often half in large layers. Because any neuron might vanish, the network cannot rely on fragile partnerships between specific neurons, so it learns more robust, spread-out features. In effect it trains a huge number of smaller sub-networks that share weights. At prediction time nothing is switched off, and the outputs are rescaled so the overall signal stays the same size as during training.

Deep Learningintermediatemust-know5 min

Backpropagation

The engine of deep learning. Most candidates know the intuition; few can trace matrix dimensions correctly.

Backpropagation computes gradients of scalar loss L with respect to all network weights W using the multivariable chain rule in reverse mode. Running backwards from output to input computes all ∂L/∂W in O(W) operations, whereas finite differences or forward-mode differentiation require O(W²) complexity. Key interview topics include computational graphs, local gradients, error signals (δ), and matrix shape matching.

Deep Learningintermediatemust-know4 min

Vanishing & Exploding Gradients

Why deep networks used to stop learning, or blow up, partway through training.

Vanishing and Exploding Gradients are major training instabilities in deep neural networks and recurrent models. The chain rule multiplies local derivatives across layers during backpropagation. If local derivatives are smaller than 1, multiplying them repeatedly causes gradients to shrink exponentially toward zero, preventing early layers from learning. If local derivatives are larger than 1, gradients grow exponentially, causing weight instability or NaN overflow.

Deep Learningintermediatemust-know5 min

Batch Normalization

Keeping the numbers inside a network steady so it trains faster.

Batch normalisation keeps the numbers flowing through a network in a steady range. For each feature, it takes the current mini-batch, shifts the values to an average of zero and a spread of one, then lets the network learn its own preferred scale and shift on top. This makes training faster and more stable, allows higher learning rates, and adds a mild regularising effect. It depends on batch statistics, so it struggles with tiny batches, which is why Transformers use layer normalisation instead.

Deep Learningintermediatemust-know5 min

SGD, Momentum, Adam & AdamW

From plain gradient descent to Adam: how networks decide each weight update.

Optimisers decide how to update a network's weights from the gradient. Plain stochastic gradient descent steps straight downhill. Momentum adds a running average of past steps, so updates build speed in consistent directions and roll past small bumps. Adam goes further and gives every weight its own step size, based on how large and how noisy its recent gradients have been, so it works well with little tuning. AdamW fixes how Adam applies weight decay, and is now the default for training Transformers.

Deep Learningintermediatemust-know4 min

Transfer Learning & Fine-Tuning

Start from a model that already learned a lot, then adapt it to your task.

Transfer Learning adapts a model pretrained on a large source dataset (ImageNet, C4, Wikipedia) to a specific target task. Strategies range from Feature Extraction (freezing backbone weights and training a new linear classification head) to Full Fine-Tuning and Parameter-Efficient Fine-Tuning (PEFT / LoRA). Key decision factors include target dataset size and domain similarity to the source data.

Deep Learningintermediatemust-know5 min

Debugging a Training Run

A checklist for when your loss spikes, stalls or does something strange.

Debugging a Training Run requires a structured diagnostic protocol to isolate bugs in data pipelines, loss functions, and model architectures. Key steps include overfitting a single batch of 10 samples to zero loss, verifying loss values at step zero, monitoring gradient norms, checking for NaN/Inf floats, and inspecting activation statistics. Systematic debugging prevents wasted GPU compute costs and resolves training stalls quickly.

Deep Learningbeginner4 min

Perceptron & the MLP

How tiny artificial neurons stack up into a deep neural network.

A Perceptron is the simplest artificial neuron. It takes multiple input numbers, multiplies each input by a weight number, adds a bias number, and passes the result through an activation step. Single perceptrons can only learn straight line decision boundaries. A Multi Layer Perceptron combines layers of connected neurons with non linear activation steps, allowing the network to learn complex curved patterns in data.

Deep Learningbeginner4 min

Choosing a Loss Function

The number your model tries to shrink, and how to pick the right one.

A Loss Function measures the numerical error between model predictions and true ground truth targets. For continuous regression, Mean Squared Error penalizes large outliers heavily while Mean Absolute Error provides robust median predictions. For classification, Binary Cross Entropy and Categorical Cross Entropy measure divergence between predicted probability distributions and target one hot vectors.

Deep Learningbeginner5 min

Data Augmentation

Getting more training data for free by flipping, cropping and tweaking what you have.

Data Augmentation artificially expands training datasets by applying domain specific transformations to existing data samples. In computer vision, techniques range from geometric spatial transforms (crops, flips, rotations) to color jitter and AutoAugment. In natural language processing, techniques include Back Translation, Synonym Replacement, and Contextual Word Insertion.

Deep Learningintermediate4 min

Universal Approximation Theorem

Why one hidden layer can, in theory, learn any curve, and why that is not enough.

The Universal Approximation Theorem proves that a feedforward neural network with a single hidden layer containing enough neurons and non linear activation functions can approximate any continuous function to any desired degree of accuracy. While the theorem guarantees that a sufficiently wide network can represent complex functions theoretically, it does not guarantee that gradient descent optimization can easily find those weights or that the network will generalize well to unseen data.

Deep Learningintermediate5 min

Computational Graphs & Autograd

How PyTorch works out every gradient for you, automatically.

Computational Graphs and Automatic Differentiation (Autograd) power deep learning frameworks like PyTorch and TensorFlow. A Computational Graph is a Directed Acyclic Graph (DAG) where nodes represent data tensors or mathematical operations. PyTorch builds Dynamic Computational Graphs on the fly during forward passes, using Reverse Mode Automatic Differentiation to execute backpropagation gradients automatically.

Deep Learningintermediate4 min

The Dying ReLU Problem

How some neurons switch off for good and stop learning.

The Dying ReLU Problem occurs when neurons using the Rectified Linear Unit activation function become permanently inactive. Because ReLU outputs zero with zero gradient for all negative inputs, a large gradient update can push a neuron weights into a state where it outputs negative numbers for all training samples. Once a neuron dies, its gradient remains zero forever, preventing backpropagation from ever updating its weights again. Fixes include using Leaky ReLU, ELU, lower learning rates, or proper weight initialization.

Deep Learningintermediate4 min

Gradient Clipping

A simple safety net that prevents exploding gradients from crashing deep learning models.

Gradient Clipping is a practical optimization technique that prevents exploding gradients during neural network training. If the length or magnitude of a gradient vector exceeds a maximum threshold value, it is rescaled back down to the threshold while preserving its direction. Gradient clipping is essential when training Recurrent Neural Networks, Transformer Language Models, and Deep Reinforcement Learning agents.

Deep Learningintermediate5 min

Weight Initialization (Xavier/He)

Start the weights at the wrong size and training dies on step one.

Weight Initialization sets the starting random values for neural network parameters before training begins. Initializing all weights to zero causes symmetry problems where all neurons learn identical features. Random initialization must scale weight variance relative to layer input and output dimensions. Xavier Glorot initialization scales variance for Sigmoid and Tanh activations, while He Kaiming initialization doubles variance to account for zeroed out ReLU inputs.

Deep Learningintermediate4 min

Learning Rate Schedules & Warmup

Big steps early, small steps late. Changing the learning rate makes training work.

Learning Rate Schedules change the optimizer step size over the course of training. Using a fixed learning rate is sub optimal: high rates cause divergence or bouncing around minima, while low rates slow training. Common schedules include Linear Warmup (gradually raising rate at step one), Cosine Decay (smoothly reducing rate to near zero), and Step Decay.

Deep Learningintermediate4 min

How Batch Size Changes Training

How batch size changes training speed, GPU use and how well a model generalises.

Batch size defines the number of training samples processed in a single forward and backward pass before updating model weights. Small batch sizes provide noisy gradient updates that act as implicit regularization, helping models escape sharp sub optimal minima. Large batch sizes maximize GPU parallel hardware throughput, but require scaling the learning rate linearly to prevent generalization degradation.

Deep Learningintermediate4 min

Softmax, Logits & Numerical Stability

Turning raw scores into probabilities, without the numbers overflowing.

Logits are raw unnormalized real number outputs from the final layer of a neural network. The Softmax function converts a vector of logits into a normalized probability distribution where all values are positive and sum to 1. To prevent floating point numerical overflow when exponentiating large numbers, implementations subtract the maximum logit value before applying Softmax.

Deep Learningintermediate4 min

Label Smoothing

Telling a model to be slightly less sure, so it stops being overconfident.

Label Smoothing is a regularization technique that replaces hard binary targets with softened probability distributions. Standard cross entropy loss uses hard one hot targets like 1.0 for the correct class and 0.0 for all other classes, forcing the network to output infinite logit values to reach zero loss. Label smoothing softens targets to values like 0.9 for the correct class and redistributes 0.1 uniformly across incorrect classes, improving model calibration and generalization.

Deep Learningintermediate5 min

Convolutional Neural Networks

How small sliding filters let a network see edges, shapes and objects.

Convolutional Neural Networks (CNNs) are specialized deep learning architectures designed for 2D and 3D grid data like images and video. Instead of using dense fully connected layers that flatten spatial layouts, CNNs slide small feature filters over input pixels to extract local spatial patterns. Key building blocks include Convolutional Layers for feature extraction, Activation Layers for non linearity, Pooling Layers for spatial downsampling, and Dense Layers for final predictions.

Deep Learningintermediate5 min

Pooling, Strides & Receptive Field

How a CNN shrinks an image while seeing more of it at once.

Pooling, Strides, and Receptive Field control spatial resolution and information flow in CNNs. Pooling downsamples feature maps by taking maximum (Max Pooling) or average (Average Pooling) values across local regions. Stride defines the filter step size across spatial dimensions. Receptive Field measures the total input image region that influences a specific feature unit in a deeper layer.

Deep Learningintermediate4 min

Residual Connections

The shortcut that let networks grow past a hundred layers.

A residual connection adds a block's input straight back onto its output, so the block only has to learn the change, not the whole transformation. That simple shortcut is what made very deep networks trainable. During backpropagation, the gradient can flow back through the shortcut untouched, so early layers still get a strong learning signal instead of a faded one. Before ResNet introduced this, adding layers often made networks worse. Today every Transformer uses residual connections around each of its layers.

Deep Learningintermediate5 min

RNNs, LSTMs & GRUs

How networks read sequences one step at a time, and how LSTMs remember longer.

Recurrent Neural Networks (RNNs) process sequential data by passing a hidden state vector from one time step to the next. Standard RNNs suffer from severe vanishing gradients over long sequences, preventing them from remembering distant past information. Long Short Term Memory (LSTM) networks solve vanishing gradients using a cell state memory highway controlled by input, forget, and output gates. Gated Recurrent Units (GRUs) simplify LSTMs by combining gates into reset and update gates.

Deep Learningintermediate5 min

Seq2Seq & Encoder–Decoder

Read a sentence in, write a different one out. The design behind early translation.

Sequence to sequence models turn one sequence into another of a different length, like translating a French sentence into English. An encoder reads the input word by word and squeezes its meaning into a single summary vector. A decoder then reads that summary and writes the output one word at a time, until it produces an end token. The weakness was the single summary, since long sentences lost detail when crammed into one fixed vector. That bottleneck is exactly what attention was invented to fix.

Deep Learningintermediate4 min

Autoencoders

Squeeze data down to a tiny code, then rebuild it. What survives is what matters.

An Autoencoder is an unsupervised neural network designed to compress inputs into a low dimensional bottleneck vector and reconstruct the original input. It consists of an Encoder that maps input x to a bottleneck representation z, and a Decoder that reconstructs x_hat from z. Autoencoders are used for dimensionality reduction, anomaly detection, image denoising, and representation learning.

Deep Learningintermediate4 min

Which Layers to Freeze

When fine-tuning, which layers to lock and which to keep training.

Freezing Layers sets parameter requires_grad to False during Transfer Learning. Pretrained early layers capture domain independent low level features (edges, textures, grammar roots) that generalize across tasks. Freezing early layers accelerates training, cuts GPU memory overhead, and prevents catastrophic forgetting when fine tuning on small target datasets.

Deep Learningintermediate4 min

Reproducibility & Nondeterminism

Why the same code gives different results, and how to make runs repeatable.

Reproducibility in deep learning requires controlling random seeds and hardware nondeterminism. Nondeterminism stems from random weight initializations, data loader shuffling, dropout masks, and asynchronous atomic floating point operations in GPU CUDA algorithms (cuDNN convolutions and atomicAdd). Achieving reproducible training requires setting global seeds across Python, NumPy, PyTorch, and enabling deterministic CUDA flags at a small performance cost.

Deep Learningadvanced5 min

LayerNorm vs BatchNorm vs RMSNorm

Why CNNs use batch norm and every Transformer uses layer norm.

Normalization techniques stabilize neural network training by normalizing activation distributions. Batch Normalization computes mean and variance across mini batch samples for each feature channel, excelling in computer vision. Layer Normalization computes mean and variance across feature dimensions independently for each single sample, making it ideal for sequential text and transformers. RMSNorm simplifies Layer Normalization by removing mean calculation, saving GPU compute time in modern LLMs like LLaMA.

Deep Learningadvanced5 min

Depthwise Separable Convolutions

The trick that makes image models small and fast enough for phones.

Depthwise Separable Convolutions split standard convolution into two separate steps: Depthwise Convolution (filtering spatial features per channel independently) and Pointwise Convolution (1x1 convolution combining channels). This factorization reduces computational FLOPs and parameter counts by 8 to 9 times with almost zero drop in model accuracy. Depthwise separable convolutions form the architectural engine behind efficient mobile models like MobileNet and ConvNeXt.

Deep Learningadvanced4 min

Backprop Through Time

How backpropagation works on a network that loops over time.

Backpropagation Through Time (BPTT) is the training algorithm used for Recurrent Neural Networks. BPTT unrolls an unrolled recurrent sequence across time steps into a deep computational graph, calculating gradients for shared weight matrices by summing gradient contributions from each time step. Truncated BPTT splits long sequences into shorter fixed sub sequences to prevent memory overflow and vanishing gradient degradation.

Deep Learningadvanced4 min

Teacher Forcing & Exposure Bias

Feeding the right answer during training speeds it up, but leaves a blind spot.

When training a model that writes one word at a time, teacher forcing feeds it the correct previous word at each step, rather than whatever it actually predicted. That keeps training stable, because one early mistake cannot snowball through the rest of the sentence. The catch is called exposure bias. Since the model never practises recovering from its own errors, it can stumble when it generates freely at test time, where every word it reads is one it wrote itself.

Deep Learningadvanced5 min

Variational Autoencoders

An autoencoder that can also invent brand-new examples.

A variational autoencoder learns to compress data into a small code and rebuild it, like a normal autoencoder, but with a twist that lets it generate new examples. Instead of mapping each input to one fixed point, it maps it to a small cloud of possible points. Training balances two goals: rebuild the input accurately, and keep all those clouds tidy and overlapping. That tidiness means you can pick any point, decode it, and get a sensible new example, like a face that never existed.

Deep Learningadvanced5 min

Generative Adversarial Networks

Two networks in a contest: one fakes images, the other tries to spot the fakes.

A generative adversarial network pits two networks against each other. The generator starts from random noise and tries to create fake data, like images, that look real. The discriminator looks at a mix of real and fake examples and tries to tell them apart. Each improves by beating the other: the discriminator gets sharper at spotting fakes, and the generator gets better at fooling it. Ideally training ends when the fakes are so good that the discriminator can only guess.

Deep Learningadvanced5 min

Mode Collapse & GAN Instability

Why GANs are so hard to train, and what keeps them stable.

GANs are hard to train because two networks are competing rather than working toward one shared goal. The best-known failure is mode collapse, where the generator finds a few outputs that fool the discriminator and produces only those, losing all variety. If the discriminator gets too good too fast, the generator stops getting useful feedback and learning stalls. Training can also just oscillate and never settle. Wasserstein GANs with a gradient penalty fix much of this with a smoother measure of how real the fakes look.

Deep Learningadvanced5 min

Diffusion Models

Generate an image by starting from static and removing noise step by step.

Diffusion models generate images by learning to remove noise. During training you take real images and add a little random noise, over and over, until only static is left. A network learns to undo one of those small steps at a time, by predicting the noise to remove. To create something new, you start from pure static and run that denoising step many times, and an image gradually appears. Stable Diffusion speeds this up by working on a compressed version of the image rather than every pixel.

Deep Learningadvanced5 min

Flow Matching & Rectified Flow

A faster route from noise to image, using nearly straight paths.

Flow matching is a newer way to build image generators that is simpler and faster than classic diffusion. Diffusion turns noise into an image along a winding, random path that takes many small steps. Flow matching instead learns which direction to move at every point, so it carries noise toward real data along smooth paths. Rectified flow goes further and makes those paths nearly straight lines, and a straight path can be followed in very few steps, sometimes just one to four.

Deep Learningadvanced5 min

Graph Neural Networks

Neural networks for data that is a web of connections, not a grid.

Graph Neural Networks (GNNs) are specialized deep learning architectures designed for non Euclidean graph structured data (social networks, molecular graphs, knowledge graphs). GNNs operate via Message Passing: each node collects feature vectors from its connected neighbors, aggregates them using permutation invariant functions (sum, mean, max), and updates its own node embedding. Popular variants include Graph Convolutional Networks (GCN), Graph Attention Networks (GAT), and GraphSAGE.

Deep Learningadvanced4 min

Mixup & CutMix

Blending two training images together to make a model more robust.

Mixup and CutMix are data augmentation tricks that blend training images together. Mixup overlays two whole images, say seventy percent cat and thirty percent dog, and blends their labels in the same proportion. CutMix instead cuts a rectangle out of one image, pastes in a patch from another, and sets the label by how much area each covers. Both stop the model becoming overconfident and help it generalise, and CutMix keeps every pixel looking like a real image rather than a ghostly blend.

Deep Learningadvanced5 min

Mixed Precision Training

Train about twice as fast by doing most of the maths in 16-bit numbers.

Mixed precision training speeds up training and roughly halves memory use by doing most calculations with 16-bit numbers instead of 32-bit ones. Modern GPUs have special hardware that runs 16-bit maths much faster. To avoid losing accuracy, a master copy of the weights is still kept in 32-bit, and updates are applied there. Very small gradients can round down to zero in 16-bit, so the loss is temporarily scaled up to keep them visible, then scaled back down.

Deep Learningadvanced5 min

Gradient Accumulation & Checkpointing

Training a model that is too big for your GPU's memory.

Gradient Accumulation and Activation Checkpointing are two foundational GPU memory optimization techniques for deep learning. Gradient Accumulation simulates large global batch sizes by accumulating gradients over N micro batches before calling optimizer steps. Activation Checkpointing (Gradient Checkpointing) trades compute for memory by discarding intermediate activations during the forward pass and recomputing them on demand during backpropagation, reducing activation memory by up to 80 percent.

Deep Learningadvanced5 min

Data vs Model Parallelism

Splitting training across many GPUs, by data or by model.

Distributed Training scales neural network training across clusters of multiple GPUs and nodes. Distributed Data Parallelism (DDP) replicates full model weights across all GPUs, splitting mini batches across GPUs and synchronizing gradients via AllReduce collectives. Model Parallelism splits large model parameters across GPUs when a model is too large to fit inside a single GPU VRAM, using Tensor Parallelism (intra-layer) or Pipeline Parallelism (inter-layer).

Deep Learningadvanced5 min

ZeRO, FSDP & Sharded Training

Stop every GPU holding a full copy of the model, and big models suddenly fit.

Normal multi-GPU training gives every GPU a full copy of the model, its gradients and the optimiser's extra state, which wastes huge amounts of memory. ZeRO and PyTorch's FSDP split those copies up instead, so each GPU holds only its own share and fetches the rest only when it needs it. Stage 1 splits the optimiser state, stage 2 also splits the gradients, and stage 3 splits the weights themselves. That is how models with billions of parameters fit across ordinary GPU clusters.

Deep Learningadvanced5 min

Contrastive & Self-Supervised Learning

Learning useful features without labels, by matching pairs that belong together.

Contrastive Learning is a self-supervised representation learning paradigm that trains neural networks without human annotations. It pulls augmented positive pairs of the same sample together in embedding space while pushing negative pairs apart using InfoNCE loss. Foundational architectures include SimCLR, MoCo, and CLIP, building high quality representations for vision, text, and multimodal retrieval.

Deep Learningadvanced5 min

Knowledge Distillation

A small student network learns by copying a big teacher.

Knowledge distillation trains a small, fast student network to imitate a large teacher network. The trick is to train the student on the teacher's full set of probabilities, not just its final answers. If the teacher thinks an image is ninety percent dog and eight percent wolf, that small wolf score teaches the student which classes look alike, information a plain label throws away. Softening the probabilities with a temperature makes this easier to learn, and the student often keeps most of the teacher's accuracy.

Deep Learningadvanced5 min

Pruning & Quantization

Making a model smaller and faster by cutting weights and using fewer bits.

Pruning and Quantization are the two core model compression techniques for deploying deep neural networks to edge hardware. Pruning removes redundant weight connections based on magnitude or gradient importance (Magnitude Pruning, Structured Pruning). Quantization converts high precision 32 bit float weights (FP32) into lower bit integer representations (INT8 / INT4), using Post Training Quantization (PTQ) or Quantization Aware Training (QAT).

Deep Learningadvanced5 min

Catastrophic Forgetting

Teach a network something new and it can forget what it already knew.

Catastrophic Forgetting occurs when a neural network fine-tuned sequentially on a new task drastically degrades or completely forgets capabilities learned during initial pretraining. Because standard backpropagation updates shared parameter weights globally, gradient steps optimized for Task B overwrite weight configurations critical for Task A. Mitigations include Parameter Efficient Fine Tuning (LoRA), Elastic Weight Consolidation (EWC), Experience Replay, and Regularization bounds.

Deep Learningadvanced5 min

Double Descent & Grokking

Bigger models were supposed to overfit more. Deep learning breaks that rule.

Classic statistics says that past a certain size, a bigger model overfits and gets worse on new data. Deep learning breaks that rule. As a model grows, test error falls, then rises sharply around the point where the model can only just fit every training example, and then falls again as the model keeps growing. This second fall is called double descent. A related effect, grokking, is when a model suddenly generalises long after it has already memorised its training data.

SCROLL · SAVE · TAP TO GO DEEPER