0Pricing
Deep Learning Academy · Lesson

Gradients Point Uphill — So Step the Other Way

Using the slope to improve weights.

Gradients Point Uphill — So Step the Other Way is a free Deep Learning Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Deep Learning Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Reading the Slope

To walk downhill you first need to know which way is down. The gradient is the tool that tells you the slope of the loss at your current spot.

Gradient Points Uphill

Here is the surprise: the gradient points in the direction where loss increases fastest. It shows you the steepest way up, not down.

So Step the Other Way

Since the gradient aims uphill, you move in the opposite direction to go down. Subtracting the gradient takes you toward lower loss.

w = w - grad

The Update Rule

This one line is the heart of training. You scale the gradient by a small step size, then subtract it from each weight. Repeat and loss drops.

w = w - lr * grad

Gradient Is a Vector

With many weights, the gradient is a whole vector: one slope per weight. Each weight gets nudged by its own piece of that vector.

Magnitude Means Steepness

A large gradient value means the loss is very steep in that direction, so that weight needs a bigger correction. Small values mean you are nearly flat there.

Where Gradient Is Zero

At the very bottom of a valley the slope flattens and the gradient becomes zero. With nothing to subtract, the weights stop moving. You have converged.

One Step at a Time

You almost never reach the bottom in one jump. Each step only improves things a little, so descent is a long series of tiny downhill moves.

Following the Negative Gradient

The path you trace by always heading along the negative gradient is the route of steepest descent. It is the greedy shortcut toward lower loss.

step = -grad

Why Subtraction Works

Subtracting moves you against the increase, so loss must fall for a small enough step. That simple sign flip is what turns a slope into progress.

Toward Automatic Gradients

You will rarely compute these slopes by hand. PyTorch's autograd finds the gradient for you, but the rule stays the same: subtract it to descend.

Quick Check

Which direction does the gradient point?

Recap

The gradient points uphill toward higher loss, so you subtract a scaled version of it to step down. Repeat that update and the model rolls toward the valley. ⬇️

Frequently asked questions

Is the “Gradients Point Uphill — So Step the Other Way” lesson free?

Yes — the full text of “Gradients Point Uphill — So Step the Other Way” is free to read here on the web, and the Deep Learning Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Deep Learning Academy course, upgrade to CoddyKit PRO.

What will I learn in “Gradients Point Uphill — So Step the Other Way”?

Using the slope to improve weights. You practise Deep Learning Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Deep Learning Academy?

No prior experience is required. Deep Learning Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Gradients Point Uphill — So Step the Other Way” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Deep Learning Academy lesson?

Yes. Every Deep Learning Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Loss as a Landscape to Descend
  2. Gradients Point Uphill — So Step the Other Way
  3. Learning Rate: Too Big, Too Small, Just Right
  4. Minimize a Function by Hand in Python
← Back to Deep Learning Academy