Apply an outer momentum step after local SGD rounds
Why it matters Low-communication training across data centres uses local steps with an outer Nesterov optimizer to cut synchronisation by hundreds of times.
Local SGD lets each worker take many steps alone and then synchronises rarely. The outer step treats the average change of the workers as a pseudo-gradient and applies an outer optimizer, here SGD with Nesterov momentum.
Write outer_step(theta, workers, m, lr, mu). theta is the global parameter vector at the start of the round, workers is (W, n) with each worker's parameters at the end of the round, m is the outer momentum buffer. Pseudo-gradient delta = theta - mean(workers). Update m_new = mu * m + delta, then theta_new = theta - lr * (delta + mu * m_new). Return (theta_new, m_new). With lr 1 and mu 0 this is plain averaging.
def outer_step(theta, workers, m, lr, mu)Example
theta [1, 1], workers [[0, 2], [0, 0]], m [0, 0], lr 1, mu 0 gives theta_new [0, 1] and m_new [1, 0].
Understand the idea
Local SGD is like a team of explorers who each wander for an hour, then meet and agree to move the base camp toward where they went on average. The outer optimizer decides how far to move and can add momentum so the camp keeps drifting in a consistent direction across meetings. Worked example: theta = [1, 1]. Workers ended at [0, 2] and [0, 0], average [0, 1]. delta = theta - average = [1, 0]. With lr 1 and no momentum, theta_new = [1, 1] - [1, 0] = [0, 1], exactly the average. Rule: delta = theta - mean(workers); m = mu m + delta; theta = theta - lr (delta + mu m). Because workers only synchronise once per round, communication drops by the number of local steps, which matters when GPUs are in different buildings or regions.