GRPO-Guided Controllers for Hyperparameter Sweeps

Training a neural network has a few knobs that have to be set before the run starts. Three words are needed before the knobs make sense. The loss is one number that says how wrong the model's guesses are on a batch of data, and training is the business of pushing it down. The gradient is a list with one entry per weight, saying which way to nudge that weight to lower the loss a little. The optimiser is the rule that turns the gradient into an actual change in the weights.

The learning rate is how big a step the optimiser takes on each update. Weight decay is how hard the weights are pulled back toward zero, which keeps them from growing without limit. Warmup is the short period at the start of a run where the learning rate ramps up from zero. A sweep is running training several times with different settings for these and keeping the best run. Every new model or dataset starts with the same chore, sweep, pick the best run and throw the rest away.

namewhat it is
nanochatA small open codebase for training GPT-style models end to end. We use it for the model, the data and the hand-tuned defaults.
AdamWThe standard optimiser for transformers. It adapts the step size for each weight and applies weight decay separately.
MuonA newer optimiser for weight matrices that reshapes each update so all of its directions get a similar step size. We use it for the matrices and AdamW for the embeddings.
schedule-freeA family of optimisers from Defazio and others that removes the learning rate schedule by averaging the weights over the run. It still needs a learning rate and a weight decay chosen.
ASHAAsynchronous successive halving, a sweep method that starts many runs and stops the worst ones early.
GRPOGroup-relative policy optimisation, a reinforcement learning method that scores each attempt against a group of other attempts from the same situation instead of learning a separate network to predict the score.
PPOProximal policy optimisation, the standard reinforcement learning update that limits how far one update can move the policy.

An ASHA sweep, which starts many runs and stops the bad ones early, costs about six full training runs. The schedule-free sweep we compare against took eight. The whole thing is repeated for the next architecture or the next corpus, because nothing learned in one sweep carries to the next.

A learning rate schedule is the planned curve of the learning rate across the run, warmup included, so the step size is decided in advance for every moment of training. Schedule-free optimisers remove that curve by averaging the weights over the run instead. They still need their top-level settings chosen, and they do not learn from past runs either.

JEL is a small policy network, a neural network whose output is a decision rather than a prediction. It watches a training run and adjusts the learning rate and weight decay as it goes, by multiplying whatever the base optimiser would have used. It is trained once with reinforcement learning, which means it learns from a reward signal by trial and error, across a few hundred short training runs. After that it is reused.

We measure the trained model by validation bits per byte, the average number of bits the model needs to encode each byte of held-out text, so lower is better. Held-out text is text kept out of training so the score says how the model does on what it has not seen. A parameter is one learned number in the model, and the transformer here has 73 million of them. On that model JEL beats the best of an eight-run schedule-free sweep by 2.5% in bits per byte. It lands within 8.4% of a hand-tuned upper bound.

Training the controller cost the equivalent of 5.6 training runs, which is less than the sweep it replaces. The surprising part is how little it needs to see.

The reinforcement learning setup

A reinforcement learning problem needs episodes, states, actions and rewards. An episode is one attempt from start to finish, the state is what the controller gets to see, the action is what it does, and the reward is the score it gets back. Here an episode is one training run from random initialisation to TT steps.

Every Δ=50\Delta = 50 steps the controller reads a state sts_t and emits two real numbers as its action, at=[αt,βt]∈R2a_t = [\alpha_t, \beta_t] \in \mathbb{R}^{2}. The base optimiser then runs the next 50 steps with its two hyperparameters scaled by numbers derived from that action. The base optimiser is not replaced. It keeps its update rule, its momentum and its schedule, and the controller only multiplies two of its knobs. Momentum is the optimiser's running average of past gradients, which smooths the direction each step is taken in.

That is what makes the thing safe to bolt on. A controller that outputs the learning rate directly has to learn what a sensible learning rate is from scratch. A controller that outputs a multiplier starts from the base optimiser's answer and learns a correction to it.

A bit of maths now, none of it deep. The raw action is a real number, and a multiplier has to be positive. It should also treat halving and doubling as symmetric moves. So the action is squashed and then exponentiated,

lr_scalet=exp⁡ ⁣(λtanh⁡αt),wd_scalet=exp⁡ ⁣(λtanh⁡βt),λ=log⁡100, \text{lr\_scale}_t = \exp\!\left(\lambda \tanh \alpha_t\right), \qquad \text{wd\_scale}_t = \exp\!\left(\lambda \tanh \beta_t\right), \qquad \lambda = \log 100,

and the hyperparameters for the next 50 steps are lrt=lrbase(t)⋅lr_scalet\text{lr}_t = \text{lr}_{\text{base}}(t) \cdot \text{lr\_scale}_t, and likewise for weight decay.

Read the mapping from the inside out. The tanh is a squashing function that takes any real number to a value strictly between −1-1 and 11, so the policy cannot ask for something absurd however far it wanders. Multiplying by λ=log⁡100\lambda = \log 100 stretches that to (−log⁡100,log⁡100)(-\log 100, \log 100). The exponential then turns it into a multiplier between 0.01 and 100.

Geometrically the action lives on a log scale. An action of α\alpha multiplies by some cc and an action of −α-\alpha divides by the same cc. Zero is the identity, and a step of fixed size in α\alpha is the same relative change whether the base learning rate is large or small. That is the sense in which the controller does not care about units, and it is why the same policy can be reused on a different base without re-learning them.

A hundred-fold range was enough to reach good settings from a base we set poor on purpose, without instability. Expanding the action to four dimensions, with separate multipliers per optimiser, made the final model worse.

the loop, once every fifty stepsthe controller sees only t/T and writes two multipliers on top of the base optimisertrainingmodel + AdamW/Muonstates = t / Tpolicy πθ2 × 64 MLPrewardL(t−1) − L(t) on probesmultipliersexp(λ tanh a)lr ← lr · e^{λ tanh α}, wd ← wd · e^{λ tanh β}λ = log 100, so each lies in [0.01, 100]the reward goes back into the policy as a policy-gradient update with a group baseline per step
Every 50 steps the policy reads how far through the run training is, outputs two numbers, and the base optimiser runs the next 50 steps with its learning rate and weight decay multiplied by them. The reward is the drop in loss on four fixed probe batches. Nothing else about the optimiser changes.

The state is one number,

st=tT, s_t = \frac{t}{T},

the fraction of the run completed. Nothing else. We tried gradient norms, which measure how large the gradient is as one number, loss histories and momentum statistics, and every one of them made the final model worse.

A policy that sees only the clock can only learn a schedule, a function from progress to multiplier. That is the right amount of expressiveness for 400 episodes of experience. A policy that also sees the loss or the gradient norm can react to them, and with this little data it can also fit their noise.

There is a second argument from what the reward already carries. The reward measures how much the loss fell over the last 50 steps. So information about how well optimisation is going reaches the policy through the reward without the policy needing to observe it as a state.

The reward at decision point tt is

rt=(Lt−1−Lt)−λg gt−λs∥tanh⁡at−tanh⁡at−1∥2, r_t = \left(L_{t-1} - L_t\right) - \lambda_g\, g_t - \lambda_s \left\|\tanh a_t - \tanh a_{t-1}\right\|^{2},

with LtL_t the average loss on a fixed probe set, gtg_t the gradient norm and λg,λs\lambda_g, \lambda_s penalty weights. The first term pays the controller for the loss it removed over its 50 steps. The second would punish large gradients and the third would punish jerky changes in the action. Both ended up at zero. Loss improvement alone was the signal, and adding either penalty hurt.

The probe set is four batches drawn from the training split by a separate iterator. So it is the same four batches at every decision point of every episode, not whatever is being trained on at that moment. The real validation set is never read during meta-training, which is our name for the outer loop that trains the controller. That matters because the controller is being optimised against this number across hundreds of episodes, and whatever it is optimised against stops being a fair measure of how well the model generalises.

Returns and baselines

A policy gradient method adjusts the policy in the direction that makes rewarded actions more likely, and to do that it needs to assign credit to each action. The return from decision tt is the discounted sum of rewards from there to the end of the episode,

Rt=∑t′=tTγt′−trt′,γ=0.99. R_t = \sum_{t' = t}^{T} \gamma^{t' - t} r_{t'}, \qquad \gamma = 0.99.

The discount γ\gamma shrinks rewards that arrive later, so a reward nn decisions ahead counts γn\gamma^{n} as much.

With both penalties at zero each reward is a difference of consecutive probe losses, and a sum of consecutive differences telescopes. Each loss is added once and subtracted once, and only the two ends survive. Ignoring the discount, Rt=Lt−1−LTR_t = L_{t-1} - L_T, the probe loss at the moment of the decision minus the probe loss at the end of the run. With γ=0.99\gamma = 0.99 and a dozen decisions per episode the discount barely bites, so the return is close to that.

The controller is credited, at every decision, for how far the loss eventually falls from where it stood. That is the right thing to be credited for. A learning rate that makes the next 50 steps look good and the last 300 look bad should not be rewarded, and under this return it is not.

Raw returns make a poor learning signal because they are dominated by things the action did not cause. Early decisions have large returns simply because there is more loss left to shed, and late ones have small returns for the opposite reason. A baseline fixes that. Subtracting any quantity that does not depend on the action leaves the expected gradient unchanged and removes the shared part of the variance, which is the spread in the returns that every action sees alike.

Classic actor-critic methods learn a second network, the critic, to predict the expected return and use it as that baseline. GRPO uses a group of samples from the same state instead, and that is the tool used here. Eight episodes run in parallel per update, one on each of eight GPUs, the graphics processors that do the training arithmetic. Because they are all at the same step-in-episode at the same moment, the eight returns at step kk are eight samples from the same state. Their mean is the baseline for that step,

bk=1∣Gk∣∑i∈GkRi(k),At=Rt−bk(t), b_k = \frac{1}{|G_k|}\sum_{i \in G_k} R_i^{(k)}, \qquad A_t = R_t - b_{k(t)},

where GkG_k is the set of all samples at step-in-episode kk across the eight episodes. The advantage AtA_t is how much better this episode's decision at step kk turned out than the group's at the same step. An action that beat the group is pushed up, one that lost is pushed down, and the overall level of the return, which the action did not control, cancels.

group-relative advantage at one step-in-episodeeight episodes per update · the baseline at step k is the mean return of the eight at step kstep-in-episode k = 1 of 12b_k = 1.99-0.42+0.14+0.36-0.17-0.46-0.01+0.18+0.39A_t = R_t − b_k · bars above the line push their actions up, bars below push them downstep-in-episode k = 2 of 12b_k = 1.92-0.46-0.49+0.21+0.13+0.50+0.31-0.07-0.13A_t = R_t − b_k · bars above the line push their actions up, bars below push them downstep-in-episode k = 3 of 12b_k = 1.77+0.89-0.11-0.28-0.41+0.03+0.04-0.13-0.03A_t = R_t − b_k · bars above the line push their actions up, bars below push them downstep-in-episode k = 4 of 12b_k = 1.62+0.11+0.26+0.40+0.09-0.61+0.26-0.48-0.04A_t = R_t − b_k · bars above the line push their actions up, bars below push them downstep-in-episode k = 5 of 12b_k = 1.55-0.55-0.03-0.30+0.04+1.12-0.05+0.26-0.50A_t = R_t − b_k · bars above the line push their actions up, bars below push them downstep-in-episode k = 6 of 12b_k = 1.38-0.08+0.25-0.01+0.15+0.06-0.33+0.22-0.26A_t = R_t − b_k · bars above the line push their actions up, bars below push them downstep-in-episode k = 7 of 12b_k = 1.42+0.51-0.32+0.10-0.14+0.19-0.35+0.21-0.19A_t = R_t − b_k · bars above the line push their actions up, bars below push them downstep-in-episode k = 8 of 12b_k = 1.32+0.28+0.05-0.11-0.44+0.10-0.00+0.41-0.30A_t = R_t − b_k · bars above the line push their actions up, bars below push them downR_t = Σ γ^{t′−t} r_{t′}b_k = group mean at step kA_t = R_t − b_kstandard GRPO also dividesby length and group std,and the policy stoppedexploring in ten updates
All eight episodes in an update are at the same step-in-episode at the same time, so the baseline for that step is their mean return. Each bar is one episode's return minus that mean. Standard GRPO then divides by episode length and by the group standard deviation, and in this problem that drove the policy to one fixed action within ten updates. Leaving the raw differences in kept entropy between 0.3 and 0.5 for the whole run. The returns drawn here are made up.

GRPO without the normalisations

Standard GRPO does two more things to the advantage. It divides by the episode length, and it standardises within each group, dividing by the group's standard deviation so that every group's advantages have the same spread. Here that was the difference between a policy that learns and one that does not.

Entropy is a measure of how spread out the policy's choices are, and a policy with zero entropy always picks the same action. With the normalisations the policy's entropy collapsed within ten updates and it converged to one fixed action. Without them, keeping only the group mean baseline, entropy stayed between 0.3 and 0.5 for all fifty updates.

Our reading of why is this. Dividing each group's advantages by that group's standard deviation rescales every step to the same spread. At a step where the eight actions genuinely mattered the returns differ by a lot. At a step where they barely mattered the returns differ by a little, and that little is mostly noise.

Standardising makes those two steps look the same size to the gradient. So the noise at the unimportant steps is amplified until it is as loud as the signal at the important ones. The length normalisation rescales everything by a constant that carries no information when every episode has the same length.

In this problem returns correlate strongly with position in the episode, and that is the situation in which these normalisations bias the learning signal. Whatever the full mechanism, the empirical result is what we went with, and it is the reason the advantage above has no denominator.

The policy itself is a Gaussian over the two action coordinates, so each action is drawn from a bell curve with a mean and a standard deviation that the network sets. The mean is where the bell is centred and the standard deviation is its width, how far a typical draw lands from the centre. The network has a single input, two hidden layers of 64 tanh units and four outputs. The outputs are the two means and two log standard deviations, with the log standard deviations clamped to [−5,2][-5, 2] and initialised at −0.5-0.5, which is a starting standard deviation of about 0.61 in action space.

The entropy of a Gaussian is a function of its standard deviation alone. So entropy collapse means the standard deviations have shrunk until the policy emits nearly the same action every time and nothing new is tried.

The policy is updated with the clipped PPO objective, where PPO is the standard update that limits how far the policy can move in one step,

LCLIP(θ)=Et ⁣[min⁡ ⁣(ρt(θ)A^t, clip(ρt(θ),1−ϵ,1+ϵ)A^t)],ρt(θ)=πθ(at∣st)πθold(at∣st), \mathcal{L}^{\text{CLIP}}(\theta) = \mathbb{E}_t\!\left[\min\!\left(\rho_t(\theta)\hat A_t,\ \mathrm{clip}(\rho_t(\theta), 1-\epsilon, 1+\epsilon)\hat A_t\right)\right], \qquad \rho_t(\theta) = \frac{\pi_\theta(a_t \mid s_t)}{\pi_{\theta_{\text{old}}}(a_t \mid s_t)},

with A^t=At\hat A_t = A_t as defined above and ϵ=0.2\epsilon = 0.2. The ratio ρt\rho_t is how much more likely the action has become under the new policy than under the policy that generated it. Multiplying the advantage by it is importance sampling, which corrects for the data having come from an older policy and lets the same eight episodes be reused for several gradient steps. Here that is four passes over the data in minibatches of 64, where a minibatch is a slice of the collected decisions used for one gradient step.

The clip stops the ratio from being pushed past 1±ϵ1 \pm \epsilon, so a single large advantage cannot drag the policy far from the one that collected the data. The policy learning rate is 3×10−43 \times 10^{-4}.

The learned policy

The base hyperparameters are set low on purpose, a learning rate of 10−310^{-3} and weight decay of 10−210^{-2} for every parameter group, with no per-group tuning. A parameter group is a set of weights that share one learning rate, and here the embeddings and the matrices are the two groups.

The hand-tuned configuration uses nanochat's defaults instead. Those are a learning rate of 0.3 for the embeddings and 0.02 for the Muon matrices, with a weight decay of 0.2 scaled by (12/depth)2(12/\text{depth})^{2} to 0.8. So the controller starts from a point a person would never pick and has to find its way toward something better using one multiplier shared across all groups.

The learned policy raises both multipliers steadily through the run. The median learning-rate multiplier reaches roughly three and the weight-decay multiplier roughly four by the end, read off the paper's figure. It has learned that the base is too conservative and that the right correction grows as training goes on.

What it cannot do is treat the embeddings and the matrices differently, because the multiplier is shared. That is one candidate for where the remaining gap to hand-tuning lives.

what the learned policy does to a conservative basemedian multiplier at each decision point across the 50 meta-training updates · base lr 10⁻³, wd 10⁻²learning-rate multiplier1×2×3×weight-decay multiplier1×2×3×0100200300400500step
The policy ramps both multipliers up through training, from 1 to about 3 on the learning rate and about 4 on weight decay. The base values were set low on purpose and were the same for every parameter group, so the controller is doing the scaling a person would otherwise tune by hand. The curves are schematic tracings of the paper figure, not re-measured values.

Results

The model is a 6-layer decoder-only transformer, the same kind of architecture as GPT, with width 384, 3 attention heads of head dimension 128 and 73.5M parameters. It trains for 561 steps at 524K tokens per step, 294M tokens in all, on nanochat pretraining data with a 32,768-token vocabulary.

A few of those terms need unpacking. A token is a word or a piece of a word, and the vocabulary is the list of all the tokens the model can read or write, here 32,768 of them. The width is how many numbers the model carries for each token between layers. Attention is the part of a layer where each token looks at the tokens before it and pulls in what it needs, and a head is one independent copy of that operation. Three heads run side by side, each working with 128 of the 384 numbers.

The optimiser is hybrid AdamW and Muon. AdamW with momentum settings β1=0.8\beta_1 = 0.8 and β2=0.95\beta_2 = 0.95 handles the embeddings and Muon handles the matrices. The schedule is warmup, flat, warmdown, with the last 40% of the run as warmdown, where the learning rate ramps back down toward zero.

Meta-training ran 50 updates of 8 episodes each. The sequence length is how many tokens the model reads in one go. Every episode is a full 561 steps at sequence length 128 instead of 2048, which makes an episode about sixteen times cheaper. That is 400 episodes and 5.6 full-run equivalents of wall-clock time on 8 A100 GPUs, where wall-clock means time on a clock rather than a count of operations.

methodval BPB at 561train loss
schedule-free, best of an 8-run sweep1.2033.932
JEL1.1733.810
hand-tuned upper bound1.0823.507
same base, controller off1.4534.718

The controller-off row is the clean counterfactual, since it shares every setting with JEL except the multipliers. The 19.3% between them is what the controller contributes.

Against the schedule-free sweep JEL is 2.5% better at about the same compute. The sweep's best configuration, a schedule-free learning rate of 2.0 with no weight decay and no warmup, was found by trying eight. Against the hand-tuned bound JEL is 8.4% behind, and that bound carries knowledge of the architecture and data that one number cannot.

At deployment the controller adds under 0.5 ms every 50 steps, under 0.3% of the training cost. After the one-time 5.6 runs, each new training run costs one run, against six to eight for a sweep.

validation bits per byte at step 561, lower is betterhand-tuned upper bound1.082JEL1.173schedule-free, best of 81.203same base, controller off1.453
The controller-off baseline shares every number with JEL except that the controller is switched off, so the gap between those two rows is the controller. Schedule-free is the best of an eight-run sweep. The hand-tuned bound uses nanochat defaults found by a lot of manual work.

What it does not say

The result means that a reusable schedule can be learned from a clock, a loss difference and a group baseline, and that the learning is cheaper than one sweep. The three things that made it work are the ones that were removed rather than added, the richer state, the penalties and the GRPO normalisations.

What stands is that a state of one number, a loss difference and a group baseline without the usual normalisations are enough to learn a reusable schedule, and that it pays for itself after the first sweep it replaces.

References

  1. Shao et al., DeepSeekMath: pushing the limits of mathematical reasoning in open language models, 2024.
  2. Schulman et al., Proximal policy optimization algorithms, 2017.
  3. Defazio, Mishchenko and Jagiello, The road less scheduled, 2024.
  4. Li et al., A system for massively parallel hyperparameter tuning, MLSys, 2020.
  5. Liu et al., Muon is scalable for LLM training, 2025.
  6. Loshchilov and Hutter, Decoupled weight decay regularization, ICLR, 2019.
  7. Xu et al., Learning an adaptive learning rate schedule, 2019.
  8. Thérien et al., μLO: compute-efficient meta-generalization of learned optimizers, 2024.