skip to content
← Scientific Spaces English

Making Model Training More Scientific, Part 8: Learning Rates for Multi-Stage Training

In the previous article, Making Model Training More Scientific, Part 7: Step-Size Scheduling and Weight Averaging, we briefly introduced work on schedule-free learning rates, which attempts to replace learning rate scheduling with a form of weight averaging, achieving the effect of training an optimal model with a constant learning rate. However, as also mentioned in that post, without introducing additional assumptions, this optimal constant learning rate still depends on the number of training steps, so it cannot achieve truly schedule-free training.

In this article, we rethink this problem from the perspective of multi-stage training. The central idea is to compromise on the scheduling objective to 'being close to optimal at the end of each stage,' making it simpler and more feasible in practice.

A Classical Result #

We start from a classical convergence result to understand why the optimal learning rate depends on the number of training steps. We first introduced this convergence result in Making Model Training More Scientific, Part 2: Extending the Results to Unbounded Domains:

We will not repeat the specific meanings of the notation. This convergence result is representative, as the subsequent Making Model Training More Scientific, Part 6: An Ingenious Top-Down Construction and the previous Making Model Training More Scientific, Part 7: Step-Size Scheduling and Weight Averaging both build upon it.

What we want to do now is, given , find such that is minimized. This can be solved via simple inequalities. First, it is easy to prove that , and thus

The condition for equality to hold simultaneously in both parts is , which depends on . If we instead switch to a learning rate schedule that is truly independent of , such as , then at most we can achieve , and it can also be proved that no matter how we improve it, a learning rate independent of cannot achieve better than for .

A Shift in Perspective #

Now let us return to reflect on the motivation behind schedule-free methods. Ideally, schedule-free training seeks to train continuously in a way that does not require knowing the total number of training steps in advance, so that no matter at which step we stop training, we obtain model weights that are nearly optimal up to the current step.

However, this ideal goal seems nearly impossible. Even under the convex optimization assumptions of schedule-free methods, where we can equate LR decay with weight averaging to achieve training with a constant learning rate, as analyzed in the previous section, the optimal value of this constant learning rate also depends on , making it impossible to stop at any time and obtain the optimal solution up to that point unless we introduce further assumptions.

That being the case, we might as well reconsider what we really want from schedule-free training. First, a constant learning rate is not a strict necessity; if a time-varying learning rate yields good results, we can certainly accept it. Second, 'stopping at any time yields optimality' is undeniably an attractive property, but it is not a hard requirement either; our primary hope is that during multi-stage training, the end of each stage comes as close to optimal as possible.

In other words, when our training is divided into multiple stages, we want to obtain a model that is as close to optimal as possible at the end of each stage. The number of stages will not be very large, so for simplicity, let us first consider two-stage training, where the first stage trains for steps and the second stage trains for steps, totaling steps.

Here, we can further distinguish between two cases: 'unplanned' and 'planned.' The 'unplanned' case refers to situations where there was originally no plan to continue training, so the first stage is tuned to be as optimal as possible; once the decision to continue training is made, the second stage seeks to optimize as much as possible on top of the existing foundation, which yields a greedy solution—the downside being that no matter how the second stage is tuned, the result is relatively suboptimal. As for the 'planned' case, multi-stage training is planned in advance, allowing us in theory to strike a better balance between the performance across both stages.

Greedy Decisions #

Let's first look at the greedy version. To achieve the optimum in the first stage, it is naturally the constant learning rate , at which point the first stage's reaches the theoretical optimum . In the second stage, building on this, we need to find , to minimize

Based on the same inequality , we know that the minimum is still achieved at a constant learning rate, so this simplifies to

This can be done by constructing an inequality or by direct differentiation; the minimizing point is

where

Equivalent Steps #

Here we introduce the notation , which means "equivalent steps".

Without the constraint of the first stage, we could use the constant learning rate , and the minimum at the end of training would reach , but now we can only achieve , and the learning rate in the second stage also takes the form of , which is equivalent to saying that the effective steps change from to , and it is not hard to verify that

That is to say, two-stage greedy training is in effect equivalent to losing some steps. Taking as an example, , compared to , it roughly loses of the steps. Note that if , then , that is to say, if we continue training indefinitely, the lost proportion will become larger and larger, losing up to half at most.

Why abstract this concept? Because the concept of "steps" is universal, which makes the conclusions easier to transfer. The above conclusions were derived based on SGD, but actual training typically uses non-SGD optimizers like Adam and Muon, and hyperparameter settings like the learning rate are not directly calculated using the formulas above, but are usually determined based on empirically found scaling laws.

Therefore, the various conclusions given by SGD cannot be directly used, but if we can extract the relative changes through the concept of "equivalent steps", then the step count input in practical scaling laws can similarly be replaced with equivalent steps to obtain a heuristic correction. This is the key idea for bringing SGD conclusions into practice.

The Planned Case #

Next, let us look at the "planned" case. Here, are both known, so the learning rates for both stages can be tuned jointly. The core issue here is that we have two delivery targets—the model at the end of the first stage and the final model—and we need to find a way to balance performance across both stages. To this end, we introduce a minimax optimization objective:

It aims to make the ratio of each stage's actual performance to its ideal value as small as possible. The advantage of this optimization objective is that it introduces no extra hyperparameters, while being easy to extend to multi-stage training. Introducing a new variable , we can convert it into a nonlinear programming problem:

Nondimensionalizing the problem: let , then for any , we can complete the square to obtain

That is, the feasible set of forms a hypersphere centered at with radius . From this, we see that the original problem is equivalent to a quadratic programming problem with as the objective.

Solution Process #

For the two-stage case, this problem can be solved analytically. Note that the first constraint only involves , while the second constraint involves all variables. For , the appear only in the second constraint, so we can simply set to make their contribution zero. Thus, the problem reduces to: the first of the must lie inside both spheres simultaneously:

Both spheres have radius , and their centers both lie along the direction of the all-ones vector. The squared distance between their centers is

The two spheres intersect if and only if the distance between their centers does not exceed twice the radius, namely, , from which we solve for the optimal :

The corresponding solution can be taken as the midpoint of the line segment connecting the two centers, namely,

Analysis of Results #

Restoring gives

Interestingly, is precisely the average of the two single-stage optimal constant learning rates for "training only steps" and "training from scratch for steps" (further multiplied by ). From the perspective of equivalent steps, corresponds to presetting a larger number of training steps, while corresponds to presetting a smaller number of training steps:

That is to say, the first stage only needs to be trained for steps, but when setting its learning rate, one assumes it will be trained for steps; the two stages are trained for a total of steps, but when setting the learning rate for the second stage, one assumes it will be trained for steps. As for the effect, at this point , meaning the relative losses of the two stages are completely equal—this is precisely the equilibrium property of the minimax objective: it does not favor any single delivery point.

Taking as an example again, here . Substituting this yields , so in terms of performance, compared to the optimal solution, both stages effectively lose about worth of steps; evaluated by the average performance across both stages, this is superior to the greedy solution. In terms of setting the learning rate, the first stage's learning rate should be set according to the equivalent steps of , while the second stage's learning rate should be set according to the equivalent steps of .

Another limit is when , where , meaning that when the number of steps in the stage is sufficiently large, the minimax solution at the endpoint loses at most worth of steps, which is somewhat better than the greedy solution's .

Extension to Multiple Stages #

Whether it is the greedy solution under the "unplanned" scenario or the minimax solution under the "planned" scenario, both can theoretically be easily extended to multi-stage training. The greedy solution goes without saying; here we mainly elaborate on the minimax solution. Suppose there are delivery points , and the minimax objective becomes

The same non-dimensionalization yields spherical constraints:

Although there are theoretically variables, it can still be proven that the optimal solution can always be chosen in a "piecewise constant" form, so the problem reduces to a small-scale program with only variables. When , there is generally no concise closed-form solution, but solving it numerically is not difficult.

Summary #

This post revisits 'schedule-free learning rates' from the perspective of multi-stage training. By changing the scheduling objective to 'being close to optimal at the end of each stage', we make it simpler and more feasible in practice. Furthermore, we distill the concept of 'equivalent steps', potentially allowing the conclusions to transfer to practical optimizers and scaling laws.