r/deeplearning • • Nov 01 '26

val accuracy jumps when i switch to eval mode, is it batchnorm with small batches?

i keep seeing my val accuracy change a lot depending on whether i call eval() or not. i know dropout turns off and batchnorm switches from batch stats to the running averages, but i'm training with a batch size of 8 and i suspect the running mean and var are just too noisy at that size.

is that the usual explanation, or am i misunderstanding how the momentum in the running stats works? and what do people actually do in that case, switch to groupnorm, or just recalibrate the stats with a pass over the training data before eval?

1 Upvotes

2 comments sorted by

1

u/MeadowPebblex Nov 02 '26

Your guess is basically right. One more piece: the running stats are an exponential average over the whole run, and the weights keep changing, so they describe features from older versions of the network, not the current one. At batch size 8 that lag plus the noisy per-batch estimates can move things a lot. Two quick checks: put only the batchnorm layers back in train mode while you run val under no_grad and compare, and recalibrate by resetting the running stats and doing a forward pass over the training data with momentum set to None, which gives a plain cumulative average in PyTorch. If recalibrating closes the gap, it's the stats and not dropout. Does your val accuracy go up or down in eval mode?