3.4.9Convolutional Neural Networks

ResNet and skip connections

2,237 words10 min readdifficulty · medium1 backlinks

Overview

Residual Networks (ResNet) revolutionized deep learning by solving the degradation problem—the counterintuitive observation that deeper networks can perform worse than shallower ones, even on training data. The key innovation is skip connections (or residual connections), which allow gradients to flow directly through the network.

Figure — ResNet and skip connections

Core Problem: The Degradation Paradox

The Residual Learning Solution

Intuition: Learning the Delta, Not the Function

Mathematical Formulation

Gradient Flow Analysis

ResNet Architecture Details

Common Configurations

Model Layers Blocks Parameters Top-5 Error
ResNet-18 18 Basic 11.7M 10.76%
ResNet-34 34 Basic 21.8M 10.12%
ResNet-50 50 Bottleneck 25.6M 7.13%
ResNet-101 101 Bottleneck 44.6M 6.44%
ResNet-152 152 Bottleneck 60.2M 6.16%

Worked Examples

Common Mistakes and Misconceptions

Concept Map

expected

actually causes

caused by

caused by

worsened by

distinct from

solves

uses

forms

learns

easier when

lets flow

Deeper networks

Better performance

Degradation problem

Vanishing gradients

Optimization difficulty

Sigmoid tanh grads < 1

Overfitting

ResNet

Skip connections

Residual block y = F x + x

Residual F x = H x - x

H x approx identity

Gradients flow directly

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, yahaan ka core problem samajhna sabse zaroori hai. Logically hum sochte hain ki jitni zyada layers add karenge, network utna hi powerful banega—more capacity, better results. Lekin experiment mein ulta hua: 56-layer wala plain network 20-layer wale se training data pe bhi kharab perform karta tha. Yeh overfitting nahi hai (woh sirf test accuracy hurt karta), balki yeh ek optimization failure hai jise degradation problem kehte hain. Iske do reasons hain—vanishing gradients (jahan backprop mein gradients har layer se multiply hote-hote itne chhote ho jaate hain ki shuru ki layers seekhna hi band kar deti hain) aur deep networks ka complex error surface jahan optimization phas jaata hai.

ResNet ka jugaad genius hai: layers ko poora mapping H(x)H(x) seekhne ke bajaye, sirf residual F(x)=H(x)xF(x) = H(x) - x seekhne do, aur phir input xx ko wapas add kar do—yaani H(x)=F(x)+xH(x) = F(x) + x. Yeh skip connection hai. Iska fayda yeh hai ki agar optimal mapping identity ke kareeb hai (matlab input ko zyada badalna nahi hai), toh network ko bas F(x)F(x) ko zero ke paas push karna hai, jo bahut aasan hai. Analogy yeh samjho—agar tum apni manzil ke 99% paas ho, toh baaki 1% adjustment describe karna easy hai bajaye poora 100% raasta dobara banane ke.

Ab why-it-matters: jab backprop hota hai, skip connection ek "gradient highway" bana deta hai. Gradient ka formula ban jaata hai Lx=Ly[F(x)x+1]\frac{\partial \mathcal{L}}{\partial x} = \frac{\partial \mathcal{L}}{\partial y} \cdot [\frac{\partial F(x)}{\partial x} + 1]—dekho woh +1 term! Iski wajah se gradient chahe kitni bhi deep layers ho, kabhi puri tarah vanish nahi hota, kyunki hamesha kam se kam ek direct path hai jahan se gradient bina shrink hue flow karta hai. Isi ek chhote se idea ki wajah se aaj hum 100+, yahaan tak ki 1000+ layer wale networks train kar paate hain, aur yeh modern deep learning ki foundation ban gaya. Isliye ResNet ko revolutionary kaha jaata hai bhai.

Go deeper — visual, from zero

Test yourself — Convolutional Neural Networks

Connections