3.1.3 · HinglishNeural Network Fundamentals

Forward propagation computation

1,715 words8 min readRead in English

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.

Figure — Forward propagation computation

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-activationKyun? Inputs ko weights + bias se combine karo:

Layer 1 activationKyun? ReLU apply karo (negatives ko 0 pe clip karo):

Layer 2Kyun? 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?
Ek linear step , phir ek nonlinear activation .
Layers mein nonlinear activation kyun zaroori hai?
Warna stacked linear layers ek single linear map mein collapse ho jaati hain, isliye depth koi expressive power nahi add karti.
inputs aur units wali layer ke liye ki shape kya hogi?
(output rows × input columns), taaki ek -vector de.
Bias term geometrically kya karta hai?
Yeh pre-activation ko shift karta hai, taaki ek neuron inputs zero hone par bhi fire kar sake (decision boundary ka origin se guzarna zaroori nahi).
Softmax mein exponentials kyun use karte hain?
Ye positive aur monotonic hote hain, isliye bade logits → badi probabilities; unka sum se divide karna outputs ko ek valid distribution banata hai jiska sum 1 ho.
Pre-activation kya hai?
Weighted sum plus bias, , activation apply karne se pehle.
Batch forward prop mein bias broadcast kyun hoti hai?
Wohi bias ke saare example-columns par apply hoti hai.
Classifier ke output ke liye kaunsi activation typical hai aur regressor ke liye kaunsi?
Multi-class classification ke liye softmax; regression ke liye identity (linear).
Batched matrix multiplies per-sample loops se zyada prefer kyun ki jaati hain?
Ek bada matmul GPU/BLAS hardware ko bahut saare chhote matmuls se kahin zyada efficiently use karta hai.

Connections

Concept Map

feeds

mix signals

shifts boundary

bent through

breaks linear collapse

becomes input to

chained L times

final layer output

rows = neuron weights

enables learning of

lets net approximate

Input x

Pre-activation z = Wx + b

Weights W

Bias b

Activation a = phi z

Nonlinearity phi

Next layer

Prediction y-hat

Row j dot input = z_j

Backprop knob tuning

Complex curved functions