Member-only story

What you need to know about batch sizes for your neural network

Santiago Valdarrama
4 min readApr 16, 2021

--

How many balls in a basket? — the best, tangentially related image I found.

The number of examples to train a neural network is an essential way to influence the training process.

In machine learning jargon, we call this the “batch size.” A batch is nothing else than a group of examples packed together in an array-like structure.

Let’s talk about how things work.

First, a little bit of context

We can’t talk shop without focusing for a quick second on how the training process works. Here is a rough summary that should be enough for our purposes:

  1. We take a batch of examples from the training dataset.
  2. We run that batch through the model to compute a result.
  3. We find how far away that result is from where it needs to be.
  4. We adjust the model’s parameters by a specific amount.
  5. We repeat the process for as many iterations as required.

The number of examples we are using to create that batch is the first decision we are making. It’s a critical choice that will impact how the process works.

We have three possible options to pick from:

  1. We can use the entire training dataset to create one single, long-ass batch 🙈.

--

--

Santiago Valdarrama
Santiago Valdarrama

Written by Santiago Valdarrama

I build machine learning systems until 5 pm. Then I come here and tell you stories about them.

No responses yet