Forward propagation computation
3.1.3· AI-ML › Neural Network Fundamentals
Forward propagation exist kyun karta hai?
Kaunsa problem solve karta hai? Ek neural network ek function hai jisme millions tunable knobs (weights) hote hain. Jab tak hum un knobs ko seekhna (backprop) shuru karein, pehle hume diye gaye input ke liye prediction compute karni aani chahiye. Forward propagation wohi computation hai — "network run karo" wala step.
Yeh design (linear + nonlinear) kyun?
- Pure stack of linear layers collapse ho jaati hai: — kitni bhi deep ho, phir bhi linear rehti hai. Isliye depth useless ho jaati.
- Layers ke beech mein ek nonlinear activation daalna us collapse ko todta hai, jisse network curved, complex functions ko approximate kar sake. Yehi reason hai ki deep nets itne powerful hote hain.
HOW: pehle principles se build karna
Step 1 — Ek single neuron
Ek neuron inputs receive karta hai, jinme har ek ki importance hoti hai, plus ek bias .
Bias kyun? ke bina, har neuron ki decision boundary origin se guzarni chahiye. Bias shift karta hai activation ko left/right, taaki neuron inputs zero hone par bhi fire kar sake.
Step 2 — Ek layer ko vectorize karo
Ek layer mein neurons stack karke, jinme se har ek ki apni weight row hoti hai. Unhe collect karo:
ki row mein neuron ke weights kyun hote hain? Kyunki matrix–vector multiply har output ko ek row aur input ke dot product se compute karta hai. Row · input — bilkul wohi weighted sum jo neuron ke liye chahiye.
Step 3 — Poore network ko chain karo
Input ke saath, ke liye repeat karo:
Final activation prediction hai. Classification ke liye usually softmax hoti hai; regression ke liye aksar identity hoti hai.

Step 4 — Batch form (matrices kyun use karte hain)
Ek input vector ki jagah, examples ek saath () ke columns ke roop mein process karo: Bias () saare columns mein broadcast hoti hai. Batch kyun? Ek bada matmul hardware (GPU) ko chhote matmuls se kahin zyada efficiently use karta hai.
Common activations (aur WHY har ek)
Common hidden activations: ReLU (sasta, ke liye vanishing gradient nahi), sigmoid ( mein squash karta hai), tanh ( mein squash karta hai).
Worked Example 1 — haath se ek tiny 2-layer network
Input . Hidden layer (2 units), ReLU: Output layer (1 unit), identity:
Layer 1 pre-activation — Kyun? Inputs ko weights + bias se combine karo:
Layer 1 activation — Kyun? ReLU apply karo (negatives ko 0 pe clip karo):
Layer 2 — Kyun? Same recipe, identity activation:
Worked Example 2 — softmax output
Logits . Exponentiate kyun? Scores ko positive, comparable weights mein convert karne ke liye: Sum se divide kyun? Taaki outputs ek probability distribution banayein (). Class 0 sabse zyada likely hai.
Forecast-then-Verify
Common mistakes (Steel-manned)
Recall Ek 12-saal ke bache ko samjhao (Feynman)
Ek bucket-brigade socho jo paani pass kar rahi ho. Har insaan apne peeche waalon se paani leta hai, lekin kuch padosiyon par zyada bharosa karta hai — isliye trusted waalon se zyada scoop karta hai (ye hain weights). Woh apna ek fixed splash bhi milata hai (bias). Phir ise ek ajeeb funnel se dalte hain jo kitna baahir nikalta hai use change karta hai (activation). Paani insaan dar insaan aage pass hota rehta hai jab tak aakhri insaan answer nahi dikhaata. Forward propagation bas ek baar is brigade se aage ki taraf paani ka bahna hai.
Flashcards
Ek layer ke forward pass mein kaun se do operations hote hain?
Layers mein nonlinear activation kyun zaroori hai?
inputs aur units wali layer ke liye ki shape kya hogi?
Bias term geometrically kya karta hai?
Softmax mein exponentials kyun use karte hain?
Pre-activation kya hai?
Batch forward prop mein bias broadcast kyun hoti hai?
Classifier ke output ke liye kaunsi activation typical hai aur regressor ke liye kaunsi?
Batched matrix multiplies per-sample loops se zyada prefer kyun ki jaati hain?
Connections
- Activation functions — nonlinearities jo forward prop ko expressive banati hain.
- Backpropagation — forward prop se cached reuse karke gradients compute karta hai.
- Matrix multiplication — har layer ka computational engine.
- Softmax and cross-entropy loss — output activation + prediction loss kaise banta hai.
- Universal approximation theorem — kyun ek nonlinear hidden layer bhi bahut badi power deti hai.
- Vanishing and exploding gradients — yahan ki gayi activation choices ka downstream consequence.