Learn AI Math

Gradient Accumulation

What is Gradient Accumulation?

In one sentence: Gradient accumulation adds up gradients over several small batches before updating the model, to act like one big batch.

Sometimes a big batch does not fit in GPU memory. So the model processes a few small batches, saves up their gradients, and then makes one update. The result is almost the same as using a big batch.

What does Gradient Accumulation look like?

Four batches of 8 examples with gradient accumulation act like one batch of 32.

Why does Gradient Accumulation matter?

It lets people train with large effective batches on smaller hardware.

Last updated · Fact-checked by The AI Math

Linking to this page from a lesson or article?

Like this explanation? Get one every week.

The AI Math newsletter turns confusing AI news into plain English. No hype, no jargon walls.