Periodic-Gradient Adam Guard
Implementation & benchmark of arXiv:2607.03519 — On the Convergence of Adam, Revisited
Source paper: On the Convergence of Adam, Revisited arXiv:2607.03519 ⓘ · analyzed Aug 30, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Use the paper's three-periodic linear-gradient construction as a cheap online detector for Adam's failure mode. When recent gradients exhibit the pattern \((c,-1,-1)\), with \(c>2\), and the adaptive update repeatedly moves in a harmful direction, freeze Adam's normalization and use a short SGD or AMSGrad fallback before returning to Adam.
Formulas
Mathematical statement
The paper considers online linear losses \(f_t(x)=s_t x\) on the projected domain \([-1,1]\), where the slope sequence is three-periodic, \(s_{3k+1}=c\) and \(s_{3k+2}=s_{3k+3}=-1\), with \(c\) slightly larger than \(2\). The regret is \(R_T=\sum_{t=1}^T f_t(x_t)-\min_{x\in[-1,1]}\sum_{t=1}^T f_t(x)\), and the paper shows that projected Adam can have \(R_T/T\) bounded away from zero for arbitrary \(\beta_1,\beta_2\in[0,1)\). For a neural-network parameter block with gradient vector \(g_t\), implement the scalar analogue through the normalized Adam update \(m_t=\beta_1m_{t-1}+(1-\beta_1)g_t\), \(v_t=\beta_2v_{t-1}+(1-\beta_2)g_t^2\), \(u_t=m_t/(\sqrt{v_t}+\epsilon)\), and \(\theta_{t+1}=\Pi_{[-B,B]}(\theta_t-\eta u_t)\). The detector estimates whether recent gradients have the same ordering by normalized cosine similarities: a large positive first gradient followed by two gradients of opposite sign, with \(\hat c=\|g_{t-2}\|_2/(\|g_{t-1}\|_2+\delta)>2\), is the multidimensional proxy for the paper's slope sequence.
Implementation notes
Integrate this at the optimizer step, not inside the model. Maintain the last three minibatch gradients for each selected parameter group, preferably the final transformer block and embeddings first. At step t, compute the usual Adam moments and candidate update. Normalize each stored gradient by its RMS norm, then evaluate the guard predicate: the newest three gradients must have alternating directional signs, the first-to-second norm ratio must exceed 2, and both cosine tests must exceed a threshold such as rho=0.8 in magnitude. If the predicate is false, apply the normal AdamW update. If it is true, increment a counter; after two detections within a 16-step window, use a fallback for H=8 steps: either SGD with momentum 0.9 and learning rate eta_sgd equal to eta_adam times the running RMS of the Adam step, or AMSGrad with v_hat_t=max(v_hat_{t-1},v_t). Then reset the counter and return to Adam. Pseudocode is: store g[t]; compute m,v,u; detect guard; if triggered set mode=FALLBACK and mode_steps=H; if mode==FALLBACK set q=0.9q+0.1g and delta=eta_sgd*q, else delta=eta*u; apply decoupled weight decay and parameter update. The mathematical quantities directly used are the periodic slope pattern, projected update, and regret definition; the cosine and norm thresholds are empirical detector parameters. First test on a 1D projected toy problem with exact slopes (c,-1,-1), then on CIFAR-10 ResNet-18 and a 125M-parameter language model using AdamW as baseline. Measure average loss, gradient norm oscillation, boundary-hit frequency, and validation accuracy at equal optimizer steps and FLOPs. Success means eliminating the toy nonzero-regret plateau and producing lower training-loss variance or better validation loss on deliberately shuffled-versus-periodic minibatch orders, without degrading ordinary IID training by more than 0.2 percent.
Verification
This idea has not been verified yet.
Verification happens in two stages: Stage 1 — a mechanism check on a toy system confirms the claimed mathematical phenomenon reproduces; Stage 2 — a benchmark implements the idea on a real (small) neural network task and compares it against a tuned baseline over 8 paired seeds with a permutation test.
Artifacts
Artifacts unavailable.