1. Home
  2. 3Blue1Brown

Nov 2, 2017

How backpropagation teaches neural networks from their mistakes

12 min → 1:14

Overview

The 3Blue1Brown host explains backpropagation intuitively, walking through how neural networks use cost functions, gradient descent, and mini-batches of data to adjust weights and biases backward from the output layer.

3 things to know

Backpropagation

The central algorithm for training neural networks.

More

It efficiently calculates the gradient of the cost function, which indicates how to adjust each weight and bias to reduce the network's error.

▶ Watch at 2:05

Intuitive Walkthrough

The video explains that for a single training example, backpropagation determines how each neuron in the preceding layer should change its activation to correct the output error.

More

This chain of desired changes is propagated backward through the entire network.

▶ Watch at 6:05

Proportional Adjustments

The desired adjustments to weights and biases are proportional to their impact.

More

For example, weights connected to highly active neurons have a greater influence and will be adjusted more significantly, which is analogous to the Hebbian theory principle: "neurons that fire together, wire together."

Also in this episode

Stochastic Gradient Descent (SGD)

A computationally efficient method for training.

More

Instead of calculating the gradient over the entire dataset for each step, SGD uses small, random subsets of data called "mini-batches" to approximate the gradient and update the network more frequently.

▶ Watch at 10:17

Gradient Descent

An optimization algorithm that minimizes the cost function by repeatedly adjusting the network's parameters (weights and biases) in the direction opposite to the gradient.

Cost Function

A measure of the network's error.

More

It is calculated by taking the sum of the squared differences between the network's output and the desired output, averaged over all training examples.

Quotes

“It's a little more like a drunk man stumbling aimlessly down a hill, but taking quick steps, rather than a carefully calculating man determining the exact downhill direction of each step.”

▶ Watch at 10:17

“The magnitude of each component here is telling you how sensitive the cost function is to each weight and bias.”

▶ Watch at 2:05

“'Neurons that fire together wire together.'”

▶ Watch at 6:05

Full summary

Episode Overview

  • This video provides an intuitive, high-level explanation of backpropagation, the core algorithm that allows neural networks to learn from data.
  • It recaps the foundational concepts of cost functions and gradient descent, which aim to find the weights and biases that minimize a network's errors.
  • The episode visually walks through how a single training example creates a "wish list" of adjustments for the network's weights and biases, propagating these desired changes backward from the output layer.
  • It introduces Stochastic Gradient Descent (SGD), a practical optimization where the network learns from small "mini-batches" of data rather than the entire dataset at once.

Key Concepts

  • Backpropagation: The central algorithm for training neural networks. It efficiently calculates the gradient of the cost function, which indicates how to adjust each weight and bias to reduce the network's error.
  • Gradient Descent: An optimization algorithm that minimizes the cost function by repeatedly adjusting the network's parameters (weights and biases) in the direction opposite to the gradient.
  • Cost Function: A measure of the network's error. It is calculated by taking the sum of the squared differences between the network's output and the desired output, averaged over all training examples.
  • Intuitive Walkthrough: The video explains that for a single training example, backpropagation determines how each neuron in the preceding layer should change its activation to correct the output error. This chain of desired changes is propagated backward through the entire network.
  • Proportional Adjustments: The desired adjustments to weights and biases are proportional to their impact. For example, weights connected to highly active neurons have a greater influence and will be adjusted more significantly, which is analogous to the Hebbian theory principle: "neurons that fire together, wire together."
  • Stochastic Gradient Descent (SGD): A computationally efficient method for training. Instead of calculating the gradient over the entire dataset for each step, SGD uses small, random subsets of data called "mini-batches" to approximate the gradient and update the network more frequently.

Quotes

  • At 02:05 - "The magnitude of each component here is telling you how sensitive the cost function is to each weight and bias." - Explaining that the gradient vector's components indicate the relative importance of each parameter in reducing the overall error.
  • At 06:05 - "'Neurons that fire together wire together.'" - Using a famous phrase from neuroscience as a loose analogy to explain how backpropagation strengthens the connections (weights) between neurons that are co-active in producing a desired result.
  • At 10:17 - "It's a little more like a drunk man stumbling aimlessly down a hill, but taking quick steps, rather than a carefully calculating man determining the exact downhill direction of each step." - Describing the practical, faster, yet less precise path of Stochastic Gradient Descent compared to traditional gradient descent.

Takeaways

  • Backpropagation works by calculating the error at the output and propagating it backward through the network to determine how much each weight and bias contributed to that error.
  • The goal of training is to minimize a cost function by repeatedly nudging all weights and biases in the direction that most rapidly reduces the cost, a direction given by the negative gradient.
  • The amount a weight is adjusted depends on the activation of the neuron it comes from; connections from more active neurons have a greater influence on learning.
  • For efficiency, networks are trained using Stochastic Gradient Descent, which approximates the overall gradient by averaging the desired changes from small, random "mini-batches" of training data.

Watch the full episode 12 min

Read along with the audio summary

How does a neural network learn from data by working backward through its own mistakes? That is the core question explored in this video episode, which came out on November 2, 2017.

Backpropagation is the central algorithm that trains neural networks to reduce errors. The size of each component in a mathematical vector called the gradient tells you how sensitive the network's overall error is to each individual weight and bias.

Those adjustments rely on gradient descent, an optimization algorithm that shrinks error by going in the opposite direction. Gradient descent resolves this by repeatedly nudging the network's weights and biases in the direction opposite to the gradient to minimize error.

Measuring that error requires a cost function. The cost function calculates this by taking the sum of the squared differences between the network's actual output and the desired output, averaged over all training examples.

An intuitive walkthrough shows how a single training example creates a wish list of changes. Backpropagation determines how each neuron in the preceding layer should change its activation to fix the output error, sending a chain of desired changes backward through the entire network.

These backward changes lead to proportional adjustments where the most active neurons get the biggest updates. Weights connected to highly active neurons have a greater influence and get adjusted more significantly, much like the Hebbian theory principle from neuroscience that neurons that fire together, wire together.

Stochastic gradient descent speeds up training by learning from small, random batches of data. Instead, stochastic gradient descent uses small, random subsets of data called mini batches to approximate the gradient and update the network more frequently.

Training a neural network means propagating output errors backward to nudge weights and biases down the negative gradient, giving the biggest adjustments to the most active connections. With stochastic gradient descent, it is a little more like a drunk man stumbling aimlessly down a hill, but taking quick steps, rather than a carefully calculating man determining the exact downhill direction of each step.

More from 3Blue1Brown

Related Episodes