Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is 'mini-batch' in deep learning?

I'm taking the fast-ai course, and in "Lesson 2 - SGD" it says:

Mini-batch: a random bunch of points that you use to update your weights

And it also says that gradient descent uses mini-batches.

What is a mini-batch? What's the difference between a mini-batch and a regular batch?

like image 652
Luis Anaya Avatar asked Mar 20 '26 18:03

Luis Anaya


1 Answers

Both are approaches to gradient descent. But in a batch gradient descent you process the entire training set in one iteration. Whereas, in a mini-batch gradient descent you process a small subset of the training set in each iteration.

Also compare stochastic gradient descent, where you process a single example from the training set in each iteration.

Another way to look at it: they are all examples of the same approach to gradient descent with a batch size of m and a training set of size n. For stochastic gradient descent, m=1. For batch gradient descent, m = n. For mini-batch, m=b and b < n, typically b is small compared to n.

Mini-batch adds the question of determining the right size for b, but finding the right b may greatly improve your results.

like image 52
majid ghafouri Avatar answered Mar 24 '26 09:03

majid ghafouri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!