Every Block at Its Own Edge: A Feedback Law for Blockwise Step Sizes in Transformers

Neural networks trained with gradient descent tend to settle where the step size is just barely too large for the local curvature. This regime is called the edge of stability: the loss surface's sharpest direction becomes as steep as the step size allows, and training oscillates slightly while still making progress. Transformers make this picture uneven. Different kinds of parameters, such as embeddings, attention projections, feed-forward weights and normalization gains, have curvatures that differ by large factors. A single global learning rate therefore puts the sharpest block (normalization) at its edge and leaves the flatter blocks far below theirs, moving slowly and missing the flatness-seeking pressure that oscillation at the edge provides. A fixed set of hand-tuned per-block learning-rate multipliers roughly doubles pre-training speed. Those multipliers are a static snapshot, though, and nobody knows what law they approximate.

This note proposes that law and a cheap controller that enforces it. The claim is that each parameter block should take steps that land at its own edge of stability, measured by an optimizer-agnostic ratio between the curvature a block's step encounters and the first-order decrease it buys. The ratio can be estimated almost for free from a gradient difference every few steps. Feedback on this one quantity should reproduce the hand-tuned multipliers when conditions match, adapt when architecture or schedule changes, and replace four tuned ratios with one target value. A second, sharper question rides on the same instrument. Prior work shows that noise injected into the weights also lowers the curvature a model can tolerate. Is per-block noise just a disguised per-block learning rate, or does it buy flatness that step size cannot?

Core Claim

Write $\Delta_b$ for the update applied to parameter block $b$ at step $t$, $g_b$ for that block's gradient, and $H$ for the loss Hessian. Along that step, a local quadratic model predicts a loss change of $g_b^\top \Delta_b + \tfrac12 \Delta_b^\top H \Delta_b$. Define the block's stability ratio

$$ r_b = \frac{\Delta_b^\top H \Delta_b}{2\,(-g_b^\top \Delta_b)} . $$

When $r_b = 1/2$, the step is the greedy minimizer along its own direction. When $r_b = 1$, the step overshoots to exactly the same loss level, which is the edge. When $r_b > 1$, the step increases loss along that direction. For plain gradient descent this reduces to $\eta\lambda/2$ along the step direction, the classical threshold. For Adam it automatically accounts for the preconditioner, because it is computed on the actual update. The curvature term is estimated by a secant on the same mini-batch, $\Delta_b^\top (g_b(\theta_{t+1}) - g_b(\theta_t))$, at a cost of one extra gradient every $K$ steps.

The hypothesis has two parts. First, the multipliers 10, 8, 6, 4 for embeddings, query-key, feed-forward and value-output relative to normalization, from The Sharpness Disparity Principle in Transformers, work because they roughly equalize $r_b$ across blocks near a common value. Second, a multiplicative controller $\eta_b \leftarrow \eta_b\,(r^*/\hat r_b)^{\alpha}$, applied with smoothing and clipping, matches or beats the static ratios and transfers to settings where they were never tuned.

How This Relates to Prior Work

Two papers motivate the proposal. The sharpness disparity paper measured the per-block curvature ordering with diagonal Fisher estimates, showed it appears within about 2% of training and persists, and fixed the multipliers by grid search. It explicitly leaves the adaptive law open; our controller is a candidate for that law. Stepping on the Edge: Curvature Aware Learning Rate Tuners showed that greedy step-size tuners stall while a tuner targeting the edge ($\sigma \approx 2$) does not. Its tuner is global and costs about 3× per iteration through forward-mode Jacobian-vector products. We take its target (our $r^*=1$ corresponds to its $\sigma=2$) but apply it per block with a secant estimate that should cost roughly $1+1/K$.

Two papers supply the theory of why the edge matters. Gradient Descent on Neural Networks Typically Occurs at the Edge of Stability documents curvature rising until it meets the step-size limit. Understanding Gradient Descent on the Edge of Stability proves that, in simplified settings, oscillation at the edge drives motion along the set of minimizers toward lower sharpness. Understanding the Generalization Benefit of Normalization Layers: Sharpness Reduction ties this to weight decay in normalized networks and shows test accuracy on CIFAR-10 climbing from about 69% to 84% after training accuracy saturates. Together these predict that blocks held far below their edge lose not only speed but also implicit flattening, and this is testable with our instrument.

Two papers supply the smoothing lever and constrain it. Variational Learning Finds Flatter Solutions at the Edge of Stability shows that weight noise multiplies the stability threshold by a factor $VF<1$, but it applies noise uniformly across blocks. Revisiting Random Weight Perturbation shows that uniform noise must be about 100× larger than SAM's perturbation to smooth comparably, and that this destabilizes training unless the noise is adapted and the objective anchored. Both results warn that naive noise injection fails. They also leave open whether noise placed per block does anything a per-block step size cannot.

Improving Generalization and Convergence by Enhancing Implicit Regularization (IRE) is the closest method. It boosts updates along the flattest coordinates found by a diagonal Hessian estimate. It works per coordinate rather than per block, has two tuned knobs ($\kappa$, $\gamma$), and does not reference the stability threshold. Our controller instead regulates a measured distance to the edge. SimpleGPT suppresses curvature growth architecturally by placing a normalization after every linear projection. We use it as a stress test: if blocks never approach their edges, the controller should respond by raising step sizes, and we can check whether the flatness-seeking phase survives.

Research Program

The first stage is diagnostic and needs no new optimizer. We train LLaMA-style decoders of 125M and 350M parameters on OpenWebText under global AdamW and under the published static multipliers, logging $\hat r_b$ for every block type. We validate the secant estimator against exact per-block Hessian-vector products on the smaller model. The first falsifiable prediction is that under global AdamW, normalization blocks sit near $r\approx 1$ while embeddings sit far below, and that the static multipliers compress this spread. If the multipliers leave $r_b$ spread just as widely, the edge-matching explanation is wrong and the program stops here.

The second stage builds the controller. It has one target $r^*$ swept over $\{0.5, 0.75, 1, 1.25\}$, a gain $\alpha$, an exponential moving average of $\hat r_b$, and a measurement interval $K=10$, the same cadence as IRE's 1.1× overhead. The controller runs on top of the usual warmup and cosine decay, which set the global scale; it only redistributes step size across blocks. Two questions are treated as results in their own right: whether the learned multipliers drift over training, and whether they recover the 10/8/6/4 ordering.

The third stage separates noise from step size. With the controller fixed, we add per-block Gaussian weight noise of variance $\sigma_b^2$ chosen to lower each block's measured sharpness by a target amount. We compare this against simply raising $r^*$ for that block until the same measured sharpness is reached. This matched-sharpness comparison is the only fair test of whether noise contributes anything beyond its effect on the threshold.

Baselines

The naive reference is AdamW with a single learning rate, linear warmup and cosine decay, with that learning rate tuned on the same grid budget we give our controller's $r^*$ and $\alpha$. Beating it is necessary but uninformative.

The strongest existing method is static blockwise learning rates from the sharpness disparity paper, which reports a 1.92× speedup (nearly 2×) for LLaMA 1.1B on OpenWebText. We run their exact ratios on our models, data and token budget, and we also give them a fresh grid search of equal size to our tuning budget, so that our advantage cannot come from a better-tuned global scale. Beating it means one of two things. Either we match its final validation loss in the in-distribution setting with no ratio tuning, or we strictly beat it when its ratios are transferred unchanged to a shifted setting such as SimpleNorm, doubled depth, or a different warmup length.

IRE is the second strong competitor, with a reported 2.1× speedup on LLaMA pre-training, where 50k steps matched AdamW's loss at 100k. We run it with its published $K=10$ and tune $\kappa,\gamma$ on the same budget. Since IRE and our controller act on different granularities, we also test them combined.

A global edge-targeting tuner in the spirit of CDAT is the ablation that isolates per-block control. It uses the same secant ratio pooled over all parameters and the same $r^*$. If it matches the blockwise controller, the blockwise structure is not doing the work. The file contains no reported pre-training number for CDAT on these corpora.

For the noise stage, uniform variational noise as in the variational learning paper is the reference. No reported result was found on Lacuna for its BERT-mini SST-2 accuracy, so we compare on our own runs. On the vision side, m-ARWP reports 78.04% top-1 for ResNet-50 on ImageNet against SAM's 77.15%. Our generalization check is smaller, so we cite that number only to anchor which adaptive-noise method is strongest, and we rerun it on ViT CIFAR-100 ourselves.

Why not just…?

Why not just tune blockwise multipliers by grid search, as the disparity paper did? This is the main threat, and in the setting where those ratios were tuned we expect them to be roughly as good as our controller. The proposal's value claim is transfer and interpretation. Four ratios need a four-dimensional search every time the architecture or schedule changes, and the paper itself notes they do not adapt as curvature evolves. The transfer experiments settle this. If the 10/8/6/4 ratios stay within noise of the controller on SimpleNorm and at doubled depth, then the static ratios are already close to the law, and we will report the controller mainly as an explanation.

Why not just use a global edge-of-stability tuner like CDAT? A global step size is capped by the sharpest block, which is exactly the bottleneck the disparity principle identifies. The global-ratio ablation tests this directly. Our secant estimator also removes the roughly 3× overhead that CDAT reports.

Why not just rely on Adam, which already scales each coordinate? Adam normalizes gradient magnitudes, not curvature, and the disparity paper measured the block hierarchy under AdamW-style training. Our stage-one logs of $r_b$ under plain AdamW will show directly whether Adam already equalizes the blocks. If it does, the proposal is refuted.

Why not just add weight noise everywhere, or use SAM? Uniform noise is known to need destabilizing magnitudes. SAM doubles gradient cost per step and, per μP², collapses to last-layer regularization at width unless perturbations are rescaled per layer. Both lack a per-block target. We include uniform noise in the noise stage, and we expect matched-sharpness step-size control to equal it at lower cost unless noise has a genuinely separate effect.

Decisive Experiments

Pre-training runs use 125M, 350M and 1.1B decoders on OpenWebText, plus C4 and MiniPile for robustness. We report tokens to reach a fixed validation loss, final validation loss, wall-clock overhead, and zero-shot ARC, PIQA, HellaSwag and WinoGrande at the end. The transfer tests apply all methods, unretuned, to SimpleNorm and to a 2× deeper variant.

Three outcomes decide the program. The first is whether static multipliers measurably equalize $\hat r_b$, which tests the explanation. The second is whether the single-target controller matches static ratios in-distribution and beats them under transfer, which tests the method. The third is whether per-block noise at matched measured sharpness improves held-out loss on language models or held-out accuracy on ViT CIFAR-100 over pure step-size control, which tests whether smoothing and curvature control are distinct levers. A null result on the third is informative: it would mean variational smoothing's benefit at the edge is entirely explained by the threshold shift. A final check on SimpleNorm asks whether blocks still reach $r_b\approx 1$ late in training and whether sharpness keeps falling after loss plateaus. This addresses the open tension over whether aggressive architectural smoothing switches off the flatness-seeking phase.