PROGRAM ZERO 18-month live AI, LLM & full-stack programme · ₹17,999 for all 18 months · Starts 9 January 2027
Explore Program Zero →
Careers Ninza — business and startup leadership training
JOIN ZERO NINZA KIDS
JOIN ZERO NINZA KIDS
See all programs → Free live masterclass → Guides & articles → Newsletter →
Careers Ninza
DATA SCIENCE 9 min read · Updated 13 October 2026

Gradient descent explained simply: how machines actually learn

Almost every machine learning model learns with gradient descent. What it is, how the learning rate and batches work, why optimisers such as Adam help, and what goes wrong, explained without heavy maths.

CN
Careers Ninza data faculty
Careers Ninza · Kolkata, India
Learn this live in Program Zero

Gradient descent is the method most machine learning models use to learn. The model measures how wrong it is with a loss function, calculates which direction to change each parameter to reduce that loss, the gradient, and takes a small step in that direction. Repeating this thousands of times gradually finds parameters that make good predictions.

From a simple price-prediction model to the largest language models, the same idea does the learning. Understanding it helps you debug training, choose settings sensibly and follow what is happening when a model refuses to improve.

What is the intuition behind gradient descent?

Imagine standing on a hillside in thick fog, trying to reach the valley floor. You cannot see the bottom, but you can feel which way the ground slopes under your feet. So you take a small step downhill, feel again, and repeat. The height of the hill is the loss, your position is the model’s parameters, and the slope under your feet is the gradient.

What is a loss function?

A loss function turns “how wrong is the model” into a single number. For predicting prices, a common loss is mean squared error: the average squared difference between predicted and actual prices. For classification, cross-entropy loss measures how much probability the model gave to the correct answer. Lower loss means better predictions on the training data.

What is the learning rate?

The learning rate is the size of each step. Too large, and the model overshoots the valley and bounces around or diverges. Too small, and training crawls or gets stuck. Choosing it well is one of the most important practical decisions in training, and schedules that start larger and shrink over time are common.

Learning rateWhat happensWhat you see
Too highSteps overshoot the minimumLoss jumps around or explodes
Too lowProgress is painfully slowLoss barely moves
About rightSteady progressLoss falls smoothly, then levels off

What are batch, stochastic and mini-batch gradient descent?

—Batch gradient descent uses all training examples for every step: accurate but slow on large data.
—Stochastic gradient descent (SGD) uses one example per step: fast but noisy.
—Mini-batch gradient descent uses small groups, such as 32 or 256 examples: the practical standard, and the reason GPUs process data in batches.

Why do optimisers such as Adam help?

Plain gradient descent uses the same step size for every parameter. Optimisers such as momentum remember previous steps to roll through small bumps, and Adam adapts the step size for each parameter based on the history of its gradients. Adam and its variants are the default choice for training most neural networks, including language models.

How does this connect to backpropagation?

In a neural network with millions of parameters, you need the gradient for every one. Backpropagation computes them efficiently using the chain rule, working backwards from the loss. Gradient descent then uses those gradients to update the weights. Frameworks such as PyTorch do the calculus automatically. Our guide to neural networks for beginners explains the full training loop.

What goes wrong during training?

—Exploding gradients: huge updates that make the loss shoot up; gradient clipping helps.
—Vanishing gradients: tiny updates in deep networks so early layers stop learning; better activations and normalisation help.
—Local minima and plateaus: flat regions where progress stalls; momentum and good learning rate schedules help.
—Overfitting: loss falls on training data but not on new data; see our guide to overfitting and the bias-variance trade-off.

Always plot the training and validation loss curves. Most training problems, from a bad learning rate to overfitting, are visible in those two lines within minutes.

What does gradient descent look like in code?

w = 0.0                       # one parameter, starting guess
learning_rate = 0.01
for step in range(1000):
    prediction = w * x
    loss = ((prediction - y) ** 2).mean()
    gradient = (2 * (prediction - y) * x).mean()
    w = w - learning_rate * gradient   # step downhill

Real models do the same thing with millions or billions of parameters at once, which is why GPUs and good frameworks matter.

How do you choose a good learning rate in practice?

Start with a commonly used default for your optimiser, run a short training job, and watch the loss. If it explodes, lower the rate; if it barely moves, raise it. A learning rate range test, where you increase the rate gradually over a short run and see where loss falls fastest, is a quick way to find a sensible starting point. Warm-up, starting small for the first steps, helps large models train stably.

Does gradient descent find the best possible model?

Not necessarily the single best one, but usually a good one. For simple models such as linear regression, the loss surface has one bowl-shaped minimum and gradient descent finds it. For neural networks, the surface is complicated, but in practice the many good solutions found by gradient descent generalise well, especially with sensible regularisation and enough data.

How much maths do you need?

Derivatives, partial derivatives and the chain rule, plus comfort with vectors and matrices. You do not need to derive every formula by hand, but you should understand what a gradient means. Our guide on how much maths machine learning needs covers this by role. Program Zero teaches gradients and optimisation in its maths for machine learning track, then applies them in deep learning, including backpropagation from scratch.

Program Zero runs live online, so you can learn this from anywhere in India: metros such as Kolkata, Bengaluru, Mumbai, Delhi NCR and Hyderabad, growing cities such as Pune, Ahmedabad, Jaipur and Lucknow, and smaller towns such as Asansol, Durgapur, Siliguri and Guwahati. Every learner joins the same evening classes, at the same fee.

Want to learn this live, with mentors?

Program Zero is Careers Ninza’s 18-month live programme in AI, LLMs and full-stack development: classes Monday to Friday, 9:00–10:30 PM IST, all recorded, Saturday projects and Sunday doubt sessions. ₹17,999 for all 18 months; the batch starts 9 January 2027.

PROGRAM ZERO · 18-MONTH LIVE PROGRAMME
Program Zero: AI, LLM & Full-Stack Developer Programme

Learn AI, large language models and full-stack development live with mentors: from your first line of code to building and deploying your own language model.

₹17,999 for all 18 monthsStarts 9 January 2027Mon–Fri, 9:00–10:30 PM ISTEvery class recorded

Frequently asked questions

What is gradient descent in simple words?+

Gradient descent is how most machine learning models learn. The model measures its error with a loss function, works out which direction to change each parameter to reduce that error, and takes a small step in that direction, repeating until the error stops improving.

What is the learning rate in machine learning?+

The learning rate is the size of each gradient descent step. If it is too high, training becomes unstable; if too low, training is very slow. Many training setups start with a larger rate and reduce it over time.

What is the difference between SGD and gradient descent?+

Standard batch gradient descent uses all training examples for each update, while stochastic gradient descent uses one example at a time. In practice, mini-batch gradient descent, using small groups of examples, is the standard compromise.

What is the Adam optimizer?+

Adam is an optimisation algorithm that adapts the step size for each parameter based on the history of its gradients, combining ideas from momentum and adaptive learning rates. It is the default choice for training most neural networks.

How are backpropagation and gradient descent related?+

Backpropagation calculates the gradient of the loss with respect to every parameter using the chain rule. Gradient descent then uses those gradients to update the parameters. Training a neural network uses both, repeatedly.

What are vanishing and exploding gradients?+

In deep networks, gradients can become extremely small, so early layers stop learning, or extremely large, so training becomes unstable. Better activation functions, normalisation, careful initialisation and gradient clipping help prevent both.

Do I need calculus for gradient descent?+

You need to understand derivatives, partial derivatives and the chain rule conceptually. Frameworks such as PyTorch calculate gradients automatically, but understanding what they mean helps you debug and tune training.

Where can I learn machine learning maths and gradient descent in India?+

Program Zero by Careers Ninza teaches calculus, gradients and optimisation in its maths track and applies them in deep learning, including backpropagation from scratch, within an 18-month live programme for Rs 17,999.

Related reading

DATA SCIENCE Machine Learning Course Syllabus: What a Good ML Course Should Cover A module-by-module guide to a strong machine learning syllabus, from Python and maths to model evaluation, deep learning and deployment, and the red flags that show a course is too shallow. 10 min read DATA SCIENCE Neural Networks Explained for Beginners: How Deep Learning Works What a neural network actually is, how neurons, layers and weights work, how networks learn through backpropagation, and how CNNs, RNNs and transformers differ, explained in plain English. 10 min read DATA SCIENCE PyTorch vs TensorFlow in 2027: Which Should You Learn First? Both frameworks can build any modern model. How they differ in style, ecosystem and use, why PyTorch dominates research and LLM work, where TensorFlow and Keras still fit, and what to learn first. 9 min read

We teach this, live

Every article here comes from something we teach. Sit in on a free masterclass and judge the mentors yourself.