• About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us
TechTrendFeed
  • Home
  • Tech News
  • Cybersecurity
  • Software
  • Gaming
  • Machine Learning
  • Smart Home & IoT
No Result
View All Result
  • Home
  • Tech News
  • Cybersecurity
  • Software
  • Gaming
  • Machine Learning
  • Smart Home & IoT
No Result
View All Result
TechTrendFeed
No Result
View All Result

Backpropagation Defined for Newcomers (Half 1): Constructing the Instinct

Admin by Admin
July 19, 2026
Home Machine Learning
Share on FacebookShare on Twitter


to know backpropagation?

If you happen to’re making an attempt to know how trendy AI techniques like giant language fashions (LLMs) are skilled, backpropagation is among the most necessary ideas to know.

However should you ask me how I felt once I encountered it, I used to be utterly misplaced by wanting on the math equations. It felt like a psychological block for me.

I noticed and needed to start out from scratch and construct my understanding one step at a time.

That journey started with my earlier article, the place we constructed a neural community from scratch utilizing a easy dataset and understood the way it makes predictions.

The weblog acquired an important response. Thanks for that!

Now, let’s proceed with the identical method. We’ll break down backpropagation step-by-step, protecting it as easy and intuitive as earlier than.

Earlier than we start, I simply wish to say one factor. We’ll take this one step at a time.

Matters like backpropagation can really feel overwhelming at first, however as soon as we construct a robust basis, all the pieces else turns into a lot simpler to know.

So, let’s get began.


Welcome again!

Let’s proceed our studying journey via deep studying.

We have already got a fundamental understanding of neural networks, which we explored utilizing a easy dataset within the earlier weblog.

Now, let’s first recall what we discovered within the earlier weblog on neural networks.

Fast Recap

We thought of this straightforward dataset.

Picture by Creator

After plotting the info, it regarded like this:

Picture by Creator

We noticed {that a} single line was not sufficient to suit it. So, we determined to resolve it utilizing neural networks.

Subsequent, we obtained to know in regards to the equation of a single neuron, and after that, we discovered in regards to the completely different layers in a neural community.

For simplicity, we thought of one hidden layer with two hidden neurons.

Subsequent, we noticed how the 2 hidden neurons produced two completely different linear transformations, after which we needed to mix them within the output layer.

Nonetheless, we discovered that combining two strains produced one other line, not the curve that would match the info.

That is the place we realized the importance of activation features, as they introduce non-linearity into the mannequin.

So, we handed the outputs from the hidden neurons via the activation operate (ReLU) after which mixed them within the output layer.

In different phrases, we took the linear mixture of the outputs from the activation operate within the output layer, and at last, we obtained the curve.

Picture by Creator

Within the earlier weblog we constructed the neural community structure and noticed the way it makes predictions via ahead propagation.

Picture by Creator

Earlier than we learn the way backpropagation works, let’s first take a look at the values produced at every layer in the course of the ahead cross which we mentioned in earlier weblog.

We’ll use these values all through the weblog to know how the community learns by updating its parameters.

Picture by Creator

Why Does the Community Have to Study?

After we take a look at the ultimate curve produced by our neural community, we are able to see that it’s not a great match.

For instance, when the hours studied (x) is 1, the precise examination rating is 55, however our neural community predicts it as 28, which is a large distinction.

Now, we have to make our neural community carry out higher, which suggests it ought to predict values which might be a lot nearer to the precise examination scores.

To do this, the neural community must study. By studying, we imply determining which parameters needs to be elevated and which needs to be decreased to cut back the loss.


Studying from a Acquainted Instance

Now, how can we do that?

At this level, we don’t know the way to try this.

Let’s do one factor. Let’s proceed with what we already know.

However what will we already know?

We have already got an concept about easy linear regression, how the loss is calculated, and the way the bowl curve seems.

Perhaps we are able to study one thing from it.

In easy linear regression, we have to discover the optimum values for β0 (intercept) and β1 (slope).

After all, we have already got formulation, however we additionally derived them ourselves.

What we did was plot a graph with three axes. One axis represented (β0), the second represented (β1), and the third represented the loss.

We plotted the loss values for various (β0) and (β1) values and noticed a bowl-shaped curve.

We then understood that the minimal loss happens on the backside of the curve, the place the slope of the loss floor turns into zero.

Picture by Creator

To seek out that time, we used partial differentiation and finally solved the ensuing equations to acquire the formulation.

In easy linear regression, we are able to use completely different loss features such because the Sum of Squared Errors (SSE), Imply Squared Error (MSE), or different appropriate loss features relying on the issue.

Right here, we’ll contemplate the Imply Squared Error (MSE) as our loss operate.

For easy linear regression, the loss operate is

[
L(beta_0,beta_1)=frac{1}{n}sum_{i=1}^{n}left(y_i-hat{y}_iright)^2
]

the place

[
hat{y}_i=beta_0+beta_1x_i.
]

Discover that the loss relies upon solely on two parameters, [beta_0] and [beta_1]

Now we have to search out the values of [beta_0] and [beta_1] that decrease this loss.

Now, let’s take a look at our neural community.

Since our present drawback is a non-linear regression drawback, we are able to proceed utilizing the identical Imply Squared Error (MSE).

The loss operate can now be written as

[
L(w_1,w_2,w_3,w_4,b_1,b_2,b_3)
=
frac{1}{n}
sum_{i=1}^{n}
left(y_i-hat{y}_iright)^2.
]

Nonetheless, in contrast to easy linear regression, our prediction is now not given by

[
hat{y}=beta_0+beta_1x.
]

As an alternative, it’s produced by the complete neural community.

For our neural community,

[
hat{y}_i
=
w_3,mathrm{ReLU}(w_1x_i+b_1)
+
w_4,mathrm{ReLU}(w_2x_i+b_2)
+
b_3.
]

Consequently, the loss now not is dependent upon simply two parameters. It now is dependent upon all seven parameters of the neural community, that are [w_1,w_2,w_3,w_4,b_1,b_2,b_3]

Similar to in easy linear regression, our purpose continues to be the identical: discover the values of those parameters that decrease the loss.

To realize that, we have to perceive how the loss modifications after we change every parameter individually whereas protecting the remaining parameters fastened.

In different phrases, we have to compute partial derivatives equivalent to

[
frac{partial L}{partial w_1},
quad
frac{partial L}{partial w_2},
quad
frac{partial L}{partial w_3},
quad
ldots,
quad
frac{partial L}{partial b_3}.
]

These partial derivatives inform us how delicate the loss is to every parameter and assist us decide whether or not that parameter needs to be elevated or decreased to cut back the loss.


Setting the Purpose

In easy linear regression, after we plot the loss values for various combos of the slope and intercept, we get a bowl-shaped curve in three-dimensional house.

For our neural community, nonetheless, we can’t visualize the loss floor in the identical means as a result of it now exists in eight-dimensional house.

Although we are able to’t visualize it, our goal stays the identical which is to search out the parameter values that decrease the loss.


Time to Perceive Chain Rule

Now, primarily based on what we already know from easy linear regression, we discovered a method to proceed additional, which is to compute the partial derivatives of the loss with respect to every parameter.

The parameters are

[w_1,w_2,w_3,w_4,b_1,b_2,b_3]

However earlier than we proceed, there’s one necessary idea that we have to perceive, and that’s the chain rule as a result of it’s the basis of all the pieces we’re going to do subsequent.

The chain rule is used every time one amount is dependent upon one other amount, which in flip is dependent upon one other amount.

Let’s perceive this with a easy instance.

Suppose

[
y=x^2
]

and

[
z=y^3
]

Now, we wish to discover

[
frac{dz}{dx}
]

First, let’s discover this spinoff utilizing classical differentiation.

Discover that [z] is written by way of [y] not [x] Since we wish the spinoff with respect to [x] we are able to first remove the intermediate variable by substituting [y=x^2] into the equation for [z]

Substituting,

[
z=(x^2)^3=x^6
]

Now the expression relies upon solely on [x] so we are able to differentiate it immediately.

Utilizing the ability rule,

[
frac{dz}{dx}
=
frac{d}{dx}(x^6)
=
6x^5
]

This methodology could be straightforward for easy issues like this one as a result of we are able to simply substitute one expression into one other.

Nonetheless, think about a a lot greater expression with a number of intermediate variables.

Rewriting the complete equation earlier than differentiating would turn out to be troublesome and there’s a larger probability for errors.

As an alternative of mixing all the pieces right into a single expression first, we now have a way more systematic method known as the chain rule.

As an alternative of eliminating the intermediate variables, with the chain rule we are able to work via them one step at a time.

Let’s see how we are able to implement chain rule.

We already know that, [frac{dz}{dx}] tells us how a lot [z] modifications after we make a really small change in [x]

Right here [z] doesn’t rely immediately on [x]

As an alternative, the connection seems like this:

[
x rightarrow y rightarrow z.
]

Which means that every time [x] modifications, it first modifications [y] and that change in [y] then modifications [z]

Now as a substitute of making an attempt to distinguish all the pieces directly, the chain rule tells us to interrupt the issue into smaller items.

[
frac{dz}{dx}=frac{dz}{dy}timesfrac{dy}{dx}
]

Now let’s calculate every half individually.

Since

[
z=y^3,
]

we get

[
frac{dz}{dy}=3y^2.
]

Equally, since

[
y=x^2,
]

we get

[
frac{dy}{dx}=2x.
]

Multiplying these collectively,

[
frac{dz}{dx}=3y^2times2x.
]

Lastly, we all know that

[
y=x^2,
]

so we substitute it again into the equation.

[
frac{dz}{dx}=3(x^2)^2times2x=6x^5.
]

The necessary factor we are able to observe right here is that we by no means differentiated the complete expression at a time.

As an alternative, we broke it into smaller derivatives, solved them one after the other, after which multiplied them collectively.

We’ll use precisely the identical concept in our neural community.

The one distinction is that the chain is now a bit of longer.


Fixing step-by-step utilizing Classical Differentiation Technique

Now that we perceive the chain rule, let’s proceed to calculate the partial derivatives with respect to every parameter.

Till now, we used particular values for the weights and biases to know how the ahead cross works. Nonetheless, our goal is to study these values from the info.

So, as a substitute of utilizing fastened values, let’s characterize them utilizing parameters first.

The output of our neural community is given by

[
hat{y}=w_3a_1+w_4a_2+b_3
]

the place

[
a_1=mathrm{ReLU}(z_1)
]
[
z_1=w_1x+b_1
]

and

[
a_2=mathrm{ReLU}(z_2)
]
[
z_2=w_2x+b_2
]

Utilizing this output, we are able to calculate the Imply Squared Error (MSE), which is the loss operate of our neural community.

The final MSE equation is

[
L(w_1,w_2,w_3,w_4,b_1,b_2,b_3)=frac{1}{n}sum_{i=1}^{n}(y_i-hat{y}_i)^2
]

Now, let’s substitute the prediction equation into the loss operate.

[
L(w_1,w_2,w_3,w_4,b_1,b_2,b_3)=frac{1}{n}sum_{i=1}^{n}left(y_i-left(w_3a_{1i}+w_4a_{2i}+b_3right)right)^2
]

Since

[
a_{1i}=mathrm{ReLU}(w_1x_i+b_1)
]

and

[
a_{2i}=mathrm{ReLU}(w_2x_i+b_2)
]

the entire loss operate turns into

[
L(w_1,w_2,w_3,w_4,b_1,b_2,b_3)=frac{1}{n}sum_{i=1}^{n}left(y_i-left(w_3mathrm{ReLU}(w_1x_i+b_1)+w_4mathrm{ReLU}(w_2x_i+b_2)+b_3right)right)^2
]

Now, let’s begin discovering the partial spinoff with respect to any one of many parameters, let’s start with

[w_1]

So, we now have to calculate

[
frac{partial}{partial w_1}left[frac{1}{n}sum_{i=1}^{n}left(y_i-left(w_3,mathrm{ReLU}(w_1x_i+b_1)+w_4,mathrm{ReLU}(w_2x_i+b_2)+b_3right)right)^2right]
]

This equation appears troublesome to resolve. How can we discover the partial spinoff with respect to

[w_1]

from such a big equation?

Let’s proceed utilizing the identical concepts from differentiation that we already know.

As an alternative of differentiating all the pieces directly, we’ll simplify the issue step-by-step.

We wish to compute

[
frac{partial L}{partial w_1}
]

Substitute the loss operate into the spinoff.

[
frac{partial L}{partial w_1}
=
frac{partial}{partial w_1}
left(
frac{1}{n}
sum_{i=1}^{n}
(y_i-hat{y}_i)^2
right)
]

Discover that we don’t substitute the total expression for

[hat{y}_i]

but. We’ll try this solely when it turns into needed.

As [frac{1}{n}] is a continuing, we all know that it may be moved outdoors the spinoff.

[
frac{partial L}{partial w_1}
=
frac{1}{n}
frac{partial}{partial w_1}
left(
sum_{i=1}^{n}
(y_i-hat{y}_i)^2
right)
]

The summation can also be linear, so the spinoff can cross via it.

What will we imply by that?

It means in summation we add many phrases collectively and we are able to differentiate every time period individually after which add the derivatives.

[
frac{partial L}{partial w_1}
=
frac{1}{n}
sum_{i=1}^{n}
frac{partial}{partial w_1}
left(
(y_i-hat{y}_i)^2
right)
]

Now Differentiate the Sq.

Let

[
A=y_i-hat{y}_i
]

Then

[
frac{partial L}{partial w_1}
=
frac{1}{n}
sum_{i=1}^{n}
frac{partial}{partial w_1}(A^2)
]

Utilizing the ability rule,

[
frac{partial}{partial w_1}(A^2)
=
2A
frac{partial A}{partial w_1}
]

Substitute this into the earlier equation.

[
frac{partial L}{partial w_1}
=
frac{2}{n}
sum_{i=1}^{n}
A
frac{partial A}{partial w_1}
]

Substitute [A] with [y_i-hat{y}_i].

[
frac{partial L}{partial w_1}
=
frac{2}{n}
sum_{i=1}^{n}
(y_i-hat{y}_i)
frac{partial}{partial w_1}
(y_i-hat{y}_i)
]

Differentiate the Expression Inside

We all know that the true goal (precise statement) [y_i] is a continuing,

[
frac{partial y_i}{partial w_1}=0
]

Subsequently,

[
frac{partial}{partial w_1}
(y_i-hat{y}_i)
=
-frac{partialhat{y}_i}{partial w_1}
]

Substitute this again.

[
frac{partial L}{partial w_1}
=
-frac{2}{n}
sum_{i=1}^{n}
(y_i-hat{y}_i)
frac{partialhat{y}_i}{partial w_1}
]

Now Differentiating the Prediction [frac{partialhat{y}_i}{partial w_1}
]

We all know that from the output layer in our neural community

[
hat{y}_i
=
w_3a_{1i}
+
w_4a_{2i}
+
b_3
]

Substitute the equations of hidden neuron activation features.

[
hat{y}_i
=
w_3mathrm{ReLU}(w_1x_i+b_1)
+
w_4mathrm{ReLU}(w_2x_i+b_2)
+
b_3
]

Differentiate with respect to [w_1]

[
frac{partialhat{y}_i}{partial w_1}
=
frac{partial}{partial w_1}
left(
w_3mathrm{ReLU}(w_1x_i+b_1)
+
w_4mathrm{ReLU}(w_2x_i+b_2)
+
b_3
right)
]

Differentiating every time period individually.

As [w_3] is fixed,

[
frac{partial}{partial w_1}
left(
w_3mathrm{ReLU}(w_1x_i+b_1)
right)
=
w_3
frac{partial}{partial w_1}
mathrm{ReLU}(w_1x_i+b_1)
]

The second time period accommodates solely [w_2] so

[
frac{partial}{partial w_1}
left(
w_4mathrm{ReLU}(w_2x_i+b_2)
right)
=0
]

Additionally,

[
frac{partial b_3}{partial w_1}=0
]

Therefore,

[
frac{partialhat{y}_i}{partial w_1}
=
w_3
frac{partial}{partial w_1}
mathrm{ReLU}(w_1x_i+b_1)
]

Differentiate the ReLU Expression

Let

[
u=w_1x_i+b_1
]

Then

[
mathrm{ReLU}(w_1x_i+b_1)
=
mathrm{ReLU}(u)
]

Now Differentiating

[
u=w_1x_i+b_1
]

with respect to [w_1]

[
frac{du}{dw_1}=x_i
]

Now differentiate the activation.

[
frac{d,mathrm{ReLU}(u)}{du}
=
mathrm{ReLU}'(u)
]

Right here we use the chain rule,

[
frac{partial}{partial w_1}
mathrm{ReLU}(w_1x_i+b_1)
=
mathrm{ReLU}'(u)
frac{du}{dw_1}
]

Substituting [frac{du}{dw_1}=x_i]

[
frac{partial}{partial w_1}
mathrm{ReLU}(w_1x_i+b_1)
=
mathrm{ReLU}'(u)x_i
]

Changing [u]

[
frac{partial}{partial w_1}
mathrm{ReLU}(w_1x_i+b_1)
=
mathrm{ReLU}'(w_1x_i+b_1)x_i
]

This ReLU derivation would possibly get complicated, let’s decelerate and see what we really did right here.

We all know that the ReLU activation doesn’t depend upon w1w_1 immediately.

It is dependent upon the worth of w1xi+b1w_1x_i+b_1​.

On the similar time, the expression w1xi+b1w_1x_i+b_1​ is dependent upon w1w_1​.

So when w1w_1 modifications, it first modifications w1xi+b1w_1x_i+b_1, which in flip modifications the output of the ReLU.

That is precisely the form of state of affairs the place we use the chain rule.

So to search out how the ReLU modifications with respect to w1w_1​, we first discover how w1xi+b1w_1x_i+b_1 modifications with respect to w1w_1, after which how the ReLU modifications with respect to w1xi+b1w_1x_i+b_1​.

Lastly, we mix these two outcomes utilizing the chain rule.


Now Substitute Again

Earlier, we discovered

[
frac{partial L}{partial w_1}
=
-frac{2}{n}
sum_{i=1}^{n}
(y_i-hat{y}_i)
frac{partialhat{y}_i}{partial w_1}
]

We additionally calculated

[
frac{partialhat{y}_i}{partial w_1}
=
w_3
mathrm{ReLU}'(w_1x_i+b_1)
x_i
]

Substitute this into the earlier equation.

[
frac{partial L}{partial w_1}
=
-frac{2}{n}
sum_{i=1}^{n}
(y_i-hat{y}_i)
w_3
mathrm{ReLU}'(w_1x_i+b_1)
x_i
]

Remaining end result

Now we have derived

[
frac{partial L}{partial w_1}
=
-frac{2}{n}
sum_{i=1}^{n}
(y_i-hat{y}_i)
w_3
mathrm{ReLU}'(w_1x_i+b_1)
x_i
]

This tells us precisely how the loss modifications when the load

[w_1]

modifications.

At first, this equation might look obscure, however it’s really fairly easy.

Because it tells us how the overall loss modifications after we make a really small change to the load w1​, this worth known as the gradient, and it’s precisely what gradient descent makes use of to replace the load.

To calculate this gradient, the equation considers each coaching instance within the dataset.

For every coaching instance:

[(y_i-hat{y}_i)] tells us how far the prediction is from the precise worth.

[w_3] tells us how a lot the primary hidden neuron contributes to the ultimate prediction.

[mathrm{ReLU}'(w_1x_i+b_1)] tells us whether or not the change in [w_1] can cross via the ReLU activation.

[x_i] tells us how a lot a small change in [w_1] impacts the neuron’s enter.

Every coaching instance contributes its personal gradient primarily based on these portions.

We add all of those particular person contributions collectively, and since we’re utilizing the Imply Squared Error (MSE) loss operate, dividing by nn provides the typical gradient throughout the complete dataset.

This common gradient tells us how w1w_1 needs to be adjusted to cut back the general loss, reasonably than simply the error for a single coaching instance.

Conclusion

If you happen to bear in mind our dialogue on Easy Linear Regression, we calculated the partial derivatives with respect to solely two parameters.

On this weblog, we now have efficiently derived

[frac{partial L}{partial w_1}]

Though the derivation was lengthy, We used the identical concepts from calculus that we already knew in each step.

We merely utilized differentiation step-by-step and used the chain rule wherever it was required.

Now, our neural community nonetheless has six extra parameters, and every of them has its personal partial spinoff.

So, what do you suppose?

Do we have to repeat this whole course of for each weight and bias?

Happily, no.

As neural networks turn out to be bigger, manually deriving each gradient would shortly turn out to be arduous and inefficient.

There needs to be a greater means.

The excellent news is that we don’t want any new arithmetic.

We merely want a greater method to manage these calculations.

Every little thing continues to be constructed on the identical chain rule we’ve been utilizing all through this text.

Within the subsequent half, we’ll see how the chain rule could be utilized effectively throughout the complete neural community, main us to probably the most necessary algorithms in deep studying: backpropagation.


I hope you discovered one thing from this text. If you happen to’re nonetheless confused about neural networks or wish to revisit the fundamentals, you’ll be able to all the time learn my earlier article right here.

If you happen to discovered this useful, be at liberty to share it with individuals who may have it.

In case you will have any doubts or ideas, you’ll be able to touch upon LinkedIn.

“It doesn’t matter how slowly you go so long as you don’t cease.”
— Confucius

Thanks for studying, and I’ll see you in Half 2!

Tags: backpropagationBeginnersBuildingExplainedIntuitionPart
Admin

Admin

Next Post
Easy methods to Disable Music Movies in Spotify

Easy methods to Disable Music Movies in Spotify

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Trending.

Ideas on Streaming Companies: 2024 Version

Ideas on Streaming Companies: 2024 Version

June 16, 2025
Javice discovered responsible of defrauding JPMorgan in $175M startup buy

Javice discovered responsible of defrauding JPMorgan in $175M startup buy

March 29, 2025
Supplier of covert surveillance app spills passwords for 62,000 customers

Supplier of covert surveillance app spills passwords for 62,000 customers

July 7, 2025
AI Journey Chatbot Options for Hospitality & Excursions

AI Journey Chatbot Options for Hospitality & Excursions

September 23, 2025
Kash Patel’s clothes model web site shut down after studies it was hacked

Kash Patel’s clothes model web site shut down after studies it was hacked

May 22, 2026

TechTrendFeed

Welcome to TechTrendFeed, your go-to source for the latest news and insights from the world of technology. Our mission is to bring you the most relevant and up-to-date information on everything tech-related, from machine learning and artificial intelligence to cybersecurity, gaming, and the exciting world of smart home technology and IoT.

Categories

  • Cybersecurity
  • Gaming
  • Machine Learning
  • Smart Home & IoT
  • Software
  • Tech News

Recent News

FakeGit Marketing campaign Makes use of 7,600 GitHub Repositories to Unfold SmartLoader Malware

FakeGit Marketing campaign Makes use of 7,600 GitHub Repositories to Unfold SmartLoader Malware

July 20, 2026
A Room-by-Room Information – Chefio

A Room-by-Room Information – Chefio

July 20, 2026
  • About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us

© 2025 https://techtrendfeed.com/ - All Rights Reserved

No Result
View All Result
  • Home
  • Tech News
  • Cybersecurity
  • Software
  • Gaming
  • Machine Learning
  • Smart Home & IoT

© 2025 https://techtrendfeed.com/ - All Rights Reserved