Learning Rate Schedules in Finetuning
There is no universal optimal learning rate, so you find a workable one by experimenting within the typical range and reading the loss curve.
Why Finetuning Has No Universal Setting
Finetuning starts from a base model that has already been trained, and then adjusts it for a specific use case. Along the way you make many choices that are not learned from the data. These settings are called hyperparameters. The exact list depends on the base model and on the finetuning method you use, so the documentation for your model or framework is always the authoritative reference. This article focuses on four hyperparameters that come up again and again and strongly influence how efficiently finetuning works: the learning rate, the batch size together with gradient accumulation, the number of epochs, and the prompt model weight.
A very common assumption is that somewhere there is a correct learning rate, a number that experts know and that works for any finetuning job. The assumption is easy to reach. Tutorials often show one specific value, and it feels natural that a best setting should exist, the way a recipe has a best oven temperature. The learning rate does not work that way. The right value depends on the model, the data, and where training currently stands, so the goal is to find a workable value for your run rather than to recall a universal one.
A useful way to hold each of these settings in your head is to ask two questions: what does this setting control during training, and what goes wrong when it is set badly? The sections that follow answer those two questions one knob at a time, beginning with the learning rate.
The Learning Rate as Step Length
The learning rate sets how fast the model's parameters change with each learning step. A helpful picture is learning as a walk toward a goal, where the learning rate is the length of each step. Short steps are safe but slow: if the steps are too small, reaching the goal takes too long. Long steps cover ground quickly, but they can carry you past the goal. If the steps are too big, the model can overshoot the goal over and over and, as a result, may never converge.
In this expression, $\Delta w$ is how far a weight moves in one update, $\eta$ is the learning rate, and $g$ is the gradient, which points in the direction that reduces the loss. Read the expression as a rule about step length: the learning rate scales the gradient before it is applied. Double the learning rate and, for the same gradient, each update moves the weight twice as far.
Trace the diagram as a sequence. The weights start where they are. The gradient tells the update which direction to move. The learning rate decides how big that move is. The weights end in a new position. When the learning rate is large, the same gradient produces a big jump, which is how an update can overshoot the minimum. When it is small, the jump is so tiny that the weights hardly change from one update to the next.
Reading the Loss Curve to Diagnose a Learning Rate
Experiments are much easier to interpret when you watch the loss curve, which records the loss over the course of training. The source describes two diagnostic patterns. If the loss curve fluctuates a lot, the learning rate is probably too big, because each update overshoots and the loss bounces around. If the loss curve is stable but takes a long time to decrease, the learning rate is probably too small, because each update moves the model only a little.
Read the two columns side by side. The left column shows what a too-large learning rate looks like: the curve zigzags because every update lands on the far side of the minimum. The right column shows a too-small learning rate: the curve looks calm, which can make it tempting to accept, but it falls so slowly that training wastes time. Neither column means the run has failed outright, but each tells you which direction to adjust.
What do you think happens?
You run finetuning and the loss zigzags up and down from one update to the next. Which adjustment does the diagnostic rule suggest?
Reveal answer
Decrease the learning rate
A loss that fluctuates a lot signals that the learning rate is probably too big, because each update overshoots and the loss bounces around.
Finding a Workable Learning Rate
Because the right step length depends on the situation, the source recommends experimenting across the typical range, which runs roughly from $10^{-7}$ to $10^{-3}$, and seeing which value works best for your run. Each experiment is a short trial at one learning rate, and you compare their loss curves. You are looking for the value whose loss curve decreases steadily, not the one that looks best on a single number taken at one moment.
The source also offers a practical starting point rather than a blind guess. Take the learning rate that was used at the end of the pre-training phase and multiply it by a constant between 0.1 and 1. That gives you a sensible neighborhood to search. The multiplier is a choice you make, and the result is a range to explore with your own loss curves.
Choosing a search neighborhood from the pre-training rate
Suppose the learning rate at the end of pre-training was $2 \times 10^{-5}$. Using the suggested multiplier range of 0.1 to 1, what neighborhood should you search for your finetuning run?
- 1Identify the anchor value
The starting point is the learning rate at the end of pre-training, here $2 \times 10^{-5}$.
- 2Apply the lower multiplier
Multiplying by 0.1 gives $2 \times 10^{-6}$, the low end of the neighborhood.
- 3Apply the upper multiplier
Multiplying by 1 gives $2 \times 10^{-5}$, the high end of the neighborhood.
- 4Check against the typical range
Both ends fall inside the typical range of roughly $10^{-7}$ to $10^{-3}$, so this is a reasonable place to run short experiments.
Search between about $2 \times 10^{-6}$ and $2 \times 10^{-5}$, then compare the loss curves of a few runs inside that span.
Once the search is running, the learning rate is not necessarily fixed for the whole training run. You can use larger learning rates at the beginning and smaller learning rates near the end. An algorithm that determines how the learning rate should change throughout training is called a learning rate schedule. A schedule is therefore just a rule that maps training progress to a learning rate, and it lets you act on the diagnostic patterns as training moves forward.
Batch Size and Memory Limits
The batch size determines how many examples the model learns from in each step before it updates its weights. Batch size affects both stability and speed, and it is limited by the hardware you have. A batch size that is too small, such as fewer than eight examples, can lead to unstable training. A larger batch helps aggregate the signals from different examples, which produces more stable and reliable updates.
Bigger is not free. In general, a larger batch lets the model get through the training examples faster, but it also needs more memory to run. Because memory is finite, batch size is capped by the hardware you use. This is where the trade-off between cost and efficiency appears: more expensive compute allows faster finetuning. The source notes that, at the time of writing, compute remains a bottleneck. Models are often so large, and memory so constrained, that only small batch sizes fit.
That creates a tension. Small batches are what fit in memory, but small batches can produce unstable weight updates. The technique that addresses this tension is gradient accumulation.
How Gradient Accumulation Combines Small Batches
Gradient accumulation changes when the weights get updated, not how many examples each batch holds. Instead of updating the model weights after every batch, you accumulate gradients across several batches and update the weights once enough reliable gradients have been collected. The weight update is then based on information gathered from several batches, which helps when each individual batch is too small to give a stable update on its own.
Read the diagram as a flow with a pause in the middle. Each batch contributes its gradients to a running total, and the weights change only at the end of that stretch. The batches still pass through the model one at a time, so the memory limit that forced you to use small batches still applies. The update you finally make, however, reflects several batches rather than one.
Counting the examples behind one update
Your hardware fits only 2 examples in memory at a time. You want each weight update to reflect 8 examples. How many micro-batches should you accumulate before updating?
- 1Note the memory limit
Each micro-batch holds 2 examples, which is all the memory allows.
- 2Set the target
You want one weight update to be informed by 8 examples in total.
- 3Divide the target by the micro-batch size
8 divided by 2 is 4, so 4 micro-batches must be accumulated before each update.
Accumulate 4 micro-batches of 2 examples each, then update the weights once, so each update reflects 8 examples without holding 8 examples in memory at once.
Choosing the Number of Epochs
An epoch is one pass over the training data, so the number of epochs determines how many times each training example is trained on. Small datasets often need more epochs than large ones. For a dataset with millions of examples, one or two epochs might be sufficient. A dataset with thousands of examples might still improve after four to ten epochs.
The gap between the training loss and the validation loss gives you hints about the right number of epochs. If both losses keep decreasing steadily, the model can benefit from more epochs and more data. If the training loss still decreases but the validation loss increases, the model is overfitting to the training data, and you might try lowering the number of epochs. Watching the two curves together, rather than the training loss alone, is what reveals overfitting.
The Prompt Model Weight
In instruction finetuning, each training example consists of a prompt and a response, and both can contribute to the model's loss during training. At inference time, however, users usually supply the prompt, and the model only needs to generate the response. Because of this, response tokens should contribute more to the loss than prompt tokens. The prompt model weight is the setting that controls how much prompts count toward the loss compared with responses.
The two extremes are instructive. At 100 percent, prompts contribute to the loss as much as responses, so the model learns equally from both. At 0 percent, the model learns only from responses. The default is typically 10 percent, which means the model learns a little from prompts but mostly from responses. The low default keeps the focus on the part of the example the model must produce at inference time.
Imagine a support-assistant dataset in which each prompt is a customer question and each response is the assistant's answer. At inference time, customers supply the questions, so the valuable skill is writing good answers. With the prompt weight at the default of 10 percent, the loss rewards the answers far more than the questions, which matches what the deployed model actually has to do.
Mistakes When Tuning These Settings
Common mistake Treating a published learning rate as universal
What it looks likeCopying one value from a tutorial and assuming it will work for a different model and dataset.
Why it failsThe right step length depends on the model, the data, and where training stands, so no single value wins everywhere.
Do this insteadSearch within the typical range and compare the loss curves of a few runs.
Common mistake Accepting a flat loss curve as healthy
What it looks likeThe loss barely moves across many updates, and the run is left going without changes.
Why it failsA stable but very slow decline usually means the learning rate is too small.
Do this insteadIncrease the learning rate as high as you can while the loss curve remains stable.
Common mistake Raising the batch size to fix instability without checking memory
What it looks likeSetting a batch size that exceeds what the hardware can hold.
Why it failsBatch size is capped by memory, and a batch that does not fit cannot be run.
Do this insteadUse gradient accumulation to combine several smaller batches into one update.
Common mistake Training for more epochs because training loss is still falling
What it looks likeContinuing for many more epochs while the validation loss has started to rise.
Why it failsA rising validation loss alongside a falling training loss signals overfitting.
Do this insteadLower the number of epochs, and judge the run by the gap between training and validation loss.
Common mistake Setting the prompt model weight high by default
What it looks likeChoosing 100 percent so that prompts count as much as responses.
Why it failsAt inference time users supply the prompt, so the model mainly needs to learn to generate responses.
Do this insteadKeep the typical default of 10 percent so the focus stays on responses.
Practice Reading a Loss Curve
You run three short experiments on the same finetuning job. Run A has a loss curve that zigzags strongly from one update to the next. Run B has a loss curve that is smooth but has dropped only a little after many updates. Run C has a loss curve that decreases steadily and smoothly. For each run, say whether its learning rate looks too large, too small, or workable, and name the next adjustment you would make.
Hints
- Think about what a zigzagging loss means for the size of each update.
- A smooth but slow decline is the signature of steps that are too short.
- For a workable run, the question is whether the curve is both stable and still improving.
Key Takeaways
- There is no universal optimal learning rate; find a workable one by experimenting within the typical range, roughly $10^{-7}$ to $10^{-3}$, and reading the loss curve.
- A fluctuating loss suggests the learning rate is too large, and a stable but slow decline suggests it is too small; raise the learning rate as high as you can while the curve stays stable.
- Batch size is capped by memory and affects stability, and gradient accumulation combines several small batches into one weight update without holding them all in memory at once.
- Watch the gap between training loss and validation loss to choose the number of epochs, since a rising validation loss signals overfitting.
- The prompt model weight controls how much prompts contribute to the loss, and its typical default of 10 percent keeps the focus on responses, which are what users need at inference time.