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 0,0,90,0,9 and draw one at random. Before turning it over, the model predicts a number θ\theta. If the card shows yy, the model incurs half the squared error, ℓy(θ)=12(θ−y)2\ell_y(\theta)=\tfrac12(\theta-y)^2. Averaging over the three cards gives the risk

R(θ)=2θ2+(θ−9)26=9+12(θ−3)2.R(\theta)=\frac{2\theta^2+(\theta-9)^2}{6} =9+\tfrac12(\theta-3)^2.

The best prediction is 33. Start at θ=0\theta=0 and take one gradient step on the observed card, so θ+=θ+η(y−θ)\theta^+=\theta+\eta(y-\theta). With η=1/3\eta=1/3, training on the 99 takes the prediction straight to 33. Training on a 00 leaves it where it was. Choosing the 99 for the first step saves R(0)−R(3)=4.5R(0)-R(3)=4.5 in expected loss.

Comparing two possible updates

Now suppose the first card was the 99. The prediction is already at 33. To decide which card to use next, let Δa\Delta_a and Δb\Delta_b be the parameter updates we’d get by choosing example aa or bb from that same state. The one-step gain from choosing aa over bb, measured on the target distribution, is

V(a:b)=R(θ+Δb)−R(θ+Δa).V(a:b)=R(\theta+\Delta_b)-R(\theta+\Delta_a).

From the exact risk difference to a gradient inner product

Expand R(θ+Δ)=9+12(θ−3+Δ)2R(\theta+\Delta)=9+\tfrac12(\theta-3+\Delta)^2 for each update and subtract. The terms that depend only on the starting point cancel, leaving

V(a:b)=(θ−3)(Δb−Δa)+12(Δb2−Δa2).V(a:b)=(\theta-3)(\Delta_b-\Delta_a) +\tfrac12(\Delta_b^2-\Delta_a^2).

At θ=3\theta=3 the first term vanishes. Another 99 gives Δ9=2\Delta_9=2, while a 00 gives Δ0=−1\Delta_0=-1. On this step, V(9:0)=(12−22)/2=−1.5V(9:0)=(1^2-2^2)/2=-1.5. 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 LL-Lipschitz along both update segments. A first-order Taylor expansion gives

V(a:b)=∇R(θ)⊤(Δb−Δa)⏟S+ε,∣ε∣≤L2(∥Δa∥2+∥Δb∥2).V(a:b)=\underbrace{\nabla R(\theta)^\top(\Delta_b-\Delta_a)}_{S} +\varepsilon, \qquad |\varepsilon|\le \tfrac L2 \bigl(\|\Delta_a\|^2+\|\Delta_b\|^2\bigr).

If ∣S∣|S| exceeds the error bound, its sign tells us which example gives lower risk. For single-example SGD, Δy=−ηgy\Delta_y=-\eta g_y, where gy=∇θℓy(θ)g_y=\nabla_\theta\ell_y(\theta). Substituting gives S=η ∇R(θ)⊤(ga−gb)S=\eta\,\nabla R(\theta)^\top(g_a-g_b). 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 ∇R\nabla R. 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 bb with aa at step tt gives a signed difference of dt+1=ηt(a−b)d_{t+1}=\eta_t(a-b). Give both runs the same observations and learning rates from then on. At step ss, subtract one copy of the update θs+1=(1−ηs)θs+ηsys\theta_{s+1}=(1-\eta_s)\theta_s+\eta_s y_s from the other. The observation cancels, so ds+1=(1−ηs)dsd_{s+1}=(1-\eta_s)d_s. Carrying that difference forward to step TT gives

θTa−θTb=wt(a−b),wt=ηt∏s=t+1T−1(1−ηs).\theta_T^a-\theta_T^b=w_t(a-b), \qquad w_t=\eta_t\prod_{s=t+1}^{T-1}(1-\eta_s).

The coefficient wtw_t is the weight of training position tt in the final prediction. Start at 00 again and train once on each of 00 and 99. Fix the first learning rate at 1/51/5 and call the second one β\beta. Putting the 99 first gives a final prediction of 9(1−β)/59(1-\beta)/5. Putting it second gives 9β9\beta. Take 0<β≤1/30<\beta\le 1/3 so that both predictions are at or below the target of 33. The larger prediction then has lower risk, so the 99 belongs in the second position exactly when

9β>9(1−β)5⟺β>16.9\beta>\frac{9(1-\beta)}5 \quad\Longleftrightarrow\quad \beta>\frac16.

Keep the second learning rate at 1/51/5 and the 99 is worth more late. Lower it to 1/101/10 and the 99 is worth more early. At 1/61/6 the two positions have equal weight. If we allow the prediction to overshoot 33, the position with more weight can take it too far. We then have to compare the distances of the two final predictions from 33.

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 hsh_s include both the model parameters and the optimizer state. Once the data for step ss are fixed, write the update as hs+1=Fs(hs)h_{s+1}=F_s(h_s). Along a differentiable trajectory, the Jacobian DFsD F_s 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 u,v>0u,v>0, along with the learning rates and all the other observations. Draw YY from a distribution with mean μ\mu and variance σ2\sigma^2. Using that draw in both positions contributes (u+v)Y(u+v)Y to the final prediction. Two independent draws contribute uY1+vY2uY_1+vY_2. Both have mean (u+v)μ(u+v)\mu. Subtracting their variances gives

Var⁡((u+v)Y)−Var⁡(uY1+vY2)=2uvσ2.\operatorname{Var}((u+v)Y)-\operatorname{Var}(uY_1+vY_2) =2uv\sigma^2.

Under half-squared loss on the same distribution, the two predictions have the same mean, so the extra 2uvσ22uv\sigma^2 in variance costs uvσ2uv\sigma^2 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 σ2\sigma^2. Batch Geometry: Choosing a Batch Size

When fresh draws are unavailable, another pass over the training set can still help. Let yˉ\bar y be the mean of a finite training set and take full-batch gradient steps at a fixed rate 0<η<10<\eta<1. After kk steps, θk−yˉ=(1−η)k(θ0−yˉ)\theta_k-\bar y=(1-\eta)^k(\theta_0-\bar y). Each pass brings the prediction closer to yˉ\bar y. How far that sample mean fell above or below the population mean, yˉ−μ\bar y-\mu, was settled when we drew the data.

Measuring reuse in units of fresh data

Train for KK passes over a corpus of size NN. On a separate run that sees fresh data at every step, find the amount NfreshN_{\rm fresh} needed to reach the same validation loss. The ratio E(K,N)=Nfresh/NE(K,N)=N_{\rm fresh}/N measures the cumulative return in units of the original corpus. The contribution of pass KK is E(K,N)−E(K−1,N)E(K,N)-E(K-1,N). 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 uvσ2uv\sigma^2 is an average over possible draws. Once we’ve trained on the 99, we know which card we drew. We can ask a more specific question. At the model’s current prediction θ\theta, would another 99 do more good than a 00?

Keep the learning rate at 1/31/3. A 00 would move the prediction to 2θ/32\theta/3, and a 99 would move it to 2θ/3+32\theta/3+3. Substituting both into the original risk gives

V(9:0)=12[(2θ3−3)2−(2θ3)2]=92−2θ.V(9:0) =\tfrac12\left[\left(\tfrac{2\theta}{3}-3\right)^2 -\left(\tfrac{2\theta}{3}\right)^2\right] =\tfrac92-2\theta.

The 99 is the better choice whenever θ<9/4\theta<9/4. Immediately after the first 99, we’re at 33, above that threshold. But let the model train on a 00 in between. Its prediction drops to 22, and choosing the 99 now gives a risk 1/21/2 lower than choosing another 00. In both cases this would be the second exposure to the 99. 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 xx, target yy, and random mask MM, one recipe adds λ EM[ℓ(θ;M(x),y)]\lambda\,\mathbb E_M[\ell(\theta;M(x),y)] 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