A language model has already trained on a passage once. Given one more update, should it revisit that passage or spend the step on a different one? We can compare the two choices by asking which leaves the model with lower loss on unseen text.
To work this out by hand, take three cards marked and draw one at random. Before turning it over, the model predicts a number . If the card shows , the model incurs half the squared error, . Averaging over the three cards gives the risk
The best prediction is . Start at and take one gradient step on the observed card, so . With , training on the takes the prediction straight to . Training on a leaves it where it was. Choosing the for the first step saves in expected loss.
Comparing two possible updates
Now suppose the first card was the . The prediction is already at . To decide which card to use next, let and be the parameter updates we’d get by choosing example or from that same state. The one-step gain from choosing over , measured on the target distribution, is
From the exact risk difference to a gradient inner product
Expand for each update and subtract. The terms that depend only on the starting point cancel, leaving
At the first term vanishes. Another gives , while a gives . On this step, . At the minimum the risk gradient is zero, so the choice comes down to the lengths of the two steps. Dropping the squared terms would score them as a tie.
With vector-valued parameters, we can bound the error from dropping those terms. Suppose the gradient of the target risk is -Lipschitz along both update segments. A first-order Taylor expansion gives
If exceeds the error bound, its sign tells us which example gives lower risk. For single-example SGD, , where . Substituting gives . For Adam, we have to compute each candidate update from the same optimizer state. We saw a related effect with scale-invariant weights. Rescaling the weights preserved every prediction, yet one SGD step at the same learning rate made the two models’ predictions diverge. Same Model, Different Steps
Scoring examples with the optimizer state
During pretraining, a small batch of target text can supply an estimate of . Holding some of the optimizer’s running statistics fixed gives an approximate update direction for each candidate. We can then choose examples before taking the step. Changing the target text changes one side of the inner product, so the resulting scores depend on the distribution we want to do well on. OPUS
Computing gradients with a smaller model
Two linear layers can make the same predictions as a single matrix. Take one gradient step on the factors, though, and their product generally differs from the matrix you’d get by training it directly. To select fine-tuning data with a smaller model, one approach is to compress the target model and align the proxy’s gradients and outputs with the teacher’s. The proxy learns to reproduce the teacher’s ranking. If the teacher uses gradient cosine similarity, even a perfectly faithful proxy inherits a score that discards gradient magnitude. Why Linear Networks Don’t Train Like Linear Models · IProX
What survives until the end of training?
Back in the card model, replacing with at step gives a signed difference of . Give both runs the same observations and learning rates from then on. At step , subtract one copy of the update from the other. The observation cancels, so . Carrying that difference forward to step gives
The coefficient is the weight of training position in the final prediction. Start at again and train once on each of and . Fix the first learning rate at and call the second one . Putting the first gives a final prediction of . Putting it second gives . Take so that both predictions are at or below the target of . The larger prediction then has lower risk, so the belongs in the second position exactly when
Keep the second learning rate at and the is worth more late. Lower it to and the is worth more early. At the two positions have equal weight. If we allow the prediction to overshoot , the position with more weight can take it too far. We then have to compare the distances of the two final predictions from .
Data order and learning rate in continued pretraining
Start from the same pretrained model and fix both the total token budget and the number of math tokens in the remaining run. When the learning rate decayed throughout that run, mixing in the math data earlier gave lower final loss on math text. With a constant learning rate, concentrating the math data at the end did better in the corresponding comparison. What varied was when the math data appeared. The evaluation distribution stayed fixed. Data Schedules and Learning Rate Schedules Should Be Designed Together
Tracing the final loss back to an earlier example
Let include both the model parameters and the optimizer state. Once the data for step are fixed, write the update as . Along a differentiable trajectory, the Jacobian carries an infinitesimal perturbation forward. Its transpose carries the gradient of the final loss backward. Summing the losses along the way lets us measure how an early perturbation affects the whole learning curve. In practice, a small model can assign values to documents over short training runs. Those values can then serve as labels for a text scorer. Using its ranking for a larger model assumes that the relative benefits of the documents carry over. Data Selection via Optimal Control for Language Models
Two training positions, one draw or two?
So far we’ve held the card values fixed and changed their order. Now fix two training positions with final weights , along with the learning rates and all the other observations. Draw from a distribution with mean and variance . Using that draw in both positions contributes to the final prediction. Two independent draws contribute . Both have mean . Subtracting their variances gives
Under half-squared loss on the same distribution, the two predictions have the same mean, so the extra in variance costs in expected risk. This is the same covariance term that limits variance reduction in a batch of correlated examples. Independent draws have zero covariance. A draw paired with itself has covariance . Batch Geometry: Choosing a Batch Size
When fresh draws are unavailable, another pass over the training set can still help. Let be the mean of a finite training set and take full-batch gradient steps at a fixed rate . After steps, . Each pass brings the prediction closer to . How far that sample mean fell above or below the population mean, , was settled when we drew the data.
Measuring reuse in units of fresh data
Train for passes over a corpus of size . On a separate run that sees fresh data at every step, find the amount needed to reach the same validation loss. The ratio measures the cumulative return in units of the original corpus. The contribution of pass is . Making the same comparison for a different corpus requires its own single-pass learning curve. Larger Datasets Can Be Repeated More
When is this example worth repeating?
The cost is an average over possible draws. Once we’ve trained on the , we know which card we drew. We can ask a more specific question. At the model’s current prediction , would another do more good than a ?
Keep the learning rate at . A would move the prediction to , and a would move it to . Substituting both into the original risk gives
The is the better choice whenever . Immediately after the first , we’re at , above that threshold. But let the model train on a in between. Its prediction drops to , and choosing the now gives a risk lower than choosing another . In both cases this would be the second exposure to the . One intervening update reverses the choice.
For a passage of text, the same comparison starts at the checkpoint where the passage might be used again. Give one copy of the model the familiar passage and another copy an alternative, starting with identical optimizer states. The difference in loss on held-out text estimates the value of that repeat. To measure how much of it lasts, continue both runs on the same subsequent batches and take the difference again at the end.
What if the second exposure uses a different context?
There is another choice we can make while keeping the passage fixed. Suppose it contains both a name that gives away the next token and an explanation from which the token can be inferred. Masking the name makes the model rely on the remaining words. With context , target , and random mask , one recipe adds to the ordinary next-token loss. The document and target are the same, but the extra term changes the update they produce. With the unique corpus and number of passes held fixed, this lowered validation loss on top of a strongly regularized baseline. The masked pass costs extra compute, so a comparison at fixed compute would give the baseline that budget too. Data-Constrained Language Model Pretraining: Improved Regularization and Scaling Laws