Notes · October 2026 · 4 min read
Why random reshuffling beats SGD
Everyone shuffles the data once per epoch instead of sampling it with replacement, and for years nobody could prove it helps. It does: for strongly convex problems the rate goes from 1/k to 1/k² in the number of epochs. Here is where the extra factor comes from.
Why random reshuffling beats stochastic gradient descent (Math. Program., 2021)
Convergence rate of incremental gradient and incremental Newton methods (SIAM J. Optim., 2019)
Randomness and permutations in coordinate descent methods (Math. Program., 2020)
Stochastic gradient descent, as analyzed, picks a component function at random at every step. Stochastic gradient descent, as implemented, does nothing of the kind: it shuffles the training set once, sweeps through it in that order, and shuffles again. The sampling is without replacement, in epochs. The practice is universal, the folklore says it is faster, and until recently the theory had nothing to say about it, because the samples within an epoch are not independent and the usual martingale arguments fall apart.
The theory now says the folklore is right, and says by how much.
Two rates
Consider a finite sum with strongly convex and the smooth, and a diminishing stepsize held fixed during epoch . For SGD with replacement — independent indices at every step — the best possible rate is
a lower bound for stochastic approximation that no stepsize schedule can beat. For random reshuffling — a fresh uniformly random permutation at every epoch — the rate is
which approaches as . Not a better constant: a better exponent. On a log–log plot of error against epochs, SGD is a line of slope that it cannot leave, and reshuffling is a line of slope .
Where the factor comes from
The mechanism is visible in a single epoch. Write the full gradient at the start of epoch as . With replacement, the sampled gradients add up to only on average; the sum has a fluctuation of order times the gradient noise, and the epoch's total step is off by a term of order . That error is paid at every epoch, it never cancels, and summing it is what pins SGD to .
Under reshuffling, every component appears exactly once in the epoch, so the first-order sum is exactly. The sampling noise cancels within the epoch. What remains is the fact that the gradients were evaluated at points that drift during the epoch rather than at itself, and that error is of order — one order smaller. Measured directly, the error of one epoch's step decays like with replacement and like under reshuffling; squaring the per-epoch error is what squares the rate.
The second-order error is where the analysis earns its keep. It is not independent across epochs, and its expectation over the permutation is not zero. The proof decouples it into a term that is independent across epochs and a term dominated by , and then controls the whole sequence with a law of large numbers, which gives the rate with probability one rather than only in expectation. A fixed cyclic order already removes the within-epoch sampling noise — that alone takes the incremental gradient method out of the regime — but the randomness of the permutation is what makes the remaining error average out from epoch to epoch, and on well-conditioned problems the reshuffling curve is steeper still than the theorem's .
Sampling with replacement pays for its noise at every step; reshuffling pays once per epoch, at second order — and that squares the rate.
The same question — does the order of visiting matter, and does randomizing it help — has a parallel answer for coordinate descent, where a fixed cyclic order can provably beat random sampling on some problems and random permutations beat both on others.
Try it yourself
The reshuffling playground runs the experiment above with sliders for the number of components, the stepsize exponent and the amount of noise at the optimum. The reference slopes move with — against — so the squaring is visible as a change of slope rather than a change of constant, and a second chart measures the error of one epoch's step directly, which is where the cancellation lives.
The theorems, with their constants and the probability-one statements, are in the companion papers: the reshuffling analysis itself, the convergence rates of the incremental gradient and incremental Newton methods under a fixed order, and the coordinate-descent counterpart.
Comments and corrections are welcome by email. More notes on the notes index, or subscribe via RSS.