Chip Foundry Services Request Assessment

Gradient Accumulation Steps

Gradient accumulation steps let a training run simulate a larger effective batch size than would otherwise fit in available memory by running several smaller forward-and-backward passes, accumulating their gradients, and only applying a single optimizer update after a chosen number of accumulation steps. Setting the number of accumulation steps is a direct tradeoff between memory usage and wall-clock training speed: more accumulation steps let a larger effective batch size fit within fixed memory, but also proportionally increase the wall-clock time needed to complete each effective optimizer update.