Research Blog · Visual explainer

Same Training Loss,
Different Behavior:
Which Solution Should We Choose?

From choosing training solutions to learning data mixtures for LLM fine-tuning.

Which data should an LLM learn from? Answering that question means evaluating the models training produces. But a training objective can leave more than one solution to choose from.

Equal training loss can hide different outcomes.

Minimizing training loss may leave many solutions, with different validation performance. Training alone does not tell us which solution should guide the next update. In this toy example, gradient descent from different initializations approaches different points on the same set of training solutions.

Toy example · Computed gradient descent

Same training fit. A better choice.

1. Models that minimize training loss

Blue curve: training-loss minimizers

Dashed paths: gradient descent (GD)

GD step 120 / 120 · Same step size η = 0.16

Different initializations approach different training solutions Both axes are model parameters. The blue curve is the set of minimizers of a computed toy loss; background color shows that same loss. Three dashed paths are actual gradient-descent runs with step size 0.16, from hollow starting points to A, B and C after 120 steps. All three approach zero training loss. Sixteen blue dots mark example solutions. Model B is circled because its illustrative validation score below is highest among these examples. Parameter x₁ Parameter x₂ Start A Start B Start C A B C Different initializations approach different training solutions Both axes are model parameters. The blue curve is the set of minimizers of a computed toy loss; background color shows that same loss. Three dashed paths are actual gradient-descent runs with step size 0.16, from hollow starting points to A, B and C after 120 steps. All three approach zero training loss. Sixteen blue dots mark example solutions. Model B is circled because its illustrative validation score below is highest among these examples. Parameter x₁ Parameter x₂ Start A Start B Start C A B C

Background: training lossLowerHigher

2. Validation score for each model

One bar per model, in the same order. Taller means a higher score.

Validation scores of the same models One bar per model, in the same horizontal order as the landscape. All bars start at the same baseline; bar height is an illustrative validation score, not a count. Model B has the tallest bar among the sixteen shown. Letters A, B and C match the labeled models in the landscape. A B C Validation scores of the same models One bar per model, in the same horizontal order as the landscape. All bars start at the same baseline; bar height is an illustrative validation score, not a count. Model B has the tallest bar among the sixteen shown. Letters A, B and C match the labeled models in the landscape. A B C
How this toy example is computed

The loss is g(x)=12(x2−h(x1))2, where h is a smooth cubic interpolation of the curve in my presentation. Its graph is the blue set of zero-loss solutions. The background and paths use this same loss.

Each run uses xk+1=xk−η∇g(xk), with η = 0.16 for 120 steps. The three initializations are chosen so the runs approach A, B and C. Their final losses are below 10−16; the paths are computed, without projecting onto the curve. Playback slows the early iterations so their movement is visible.

The validation scores are schematic values from the presentation, not experimental measurements. This illustrates dependence on initialization; it does not assert convergence for every starting point or step size.

With the same toy loss and step size, gradient descent from three initializations approaches A, B and C. Their training losses approach zero; the schematic validation scores distinguish the solutions. B scores highest among the models shown.

The challenge is to make that choice part of the optimization.

Select, then differentiate.

We propose a select-then-differentiate template [1]: first choose a training solution using the objective we ultimately care about, then compute the hypergradient at that selected solution to guide the outer update.

For LLM data reweighting, our practical method explores candidate LoRA updates [2], selects the one with the lowest validation loss, then differentiates through that update to adjust the training-data mixture.

Learning which data to emphasizeSchematic · Math setup
  1. Explore
  2. Evaluate
  3. Select
  4. Update

Data-source weights

Training proportions p(θ)

Share of training data from each of 10 sources.

Neural-network parameters

Four candidate LoRA updates

Same architecture; different parameter values.

Validation loss

Same held-out examples

Compare losses; choose the lowest.

Differentiate through the selected parameters to update the source weights, then repeat.

Learned mixtureFinal fine-tuningTest evaluation
Network icons represent four finite LoRA parameter updates, not exact minimizers. Source proportions and validation-loss bars are illustrative; C is selected for its lowest validation loss. These are not recorded experimental results. Implementation details.

The template, in formulas

x denotes model parameters; θ controls source proportions p(θ)=softmax(θ).

1. Define training and validation losses

Training

g(θ,x)=∑sps(θ)Ls(x)

Validation

f(x)=Lval(x)

Ls is the average loss on source s; Lval is the held-out validation loss.

2. Select using validation loss

𝒮(θ)=arg minxg(θ,x) x⋆(θ)∈arg minx∈𝒮(θ)f(x)

Among training minimizers, choose the model with the lowest validation loss.

3. Differentiate at the selected solution

F(θ)=f(x⋆(θ)) ∇θF=−∇θx2g[∇xx2g]†∇xf

Evaluate every derivative at (θ,x⋆(θ)). The formula translates the validation gradient through the training curvature into a gradient for the mixture controls. The dagger (†) denotes the pseudoinverse, which handles flat training directions.

Here validation loss has no direct dependence on θ. The exact formula holds under the paper’s local PŁ and regularity assumptions, including a unique validation-optimal selection for nearby θ. The LLM animation uses finite candidate updates as a practical approximation.

Selection happens while learning the data mixture. The resulting mixture is then used for final fine-tuning, before the model is evaluated on test questions.

What changed in practice?

Higher math accuracy across four tested models. HG-MS, our select-then-differentiate method, achieved the highest reported GSM8K and MATH accuracy among completed runs on all four models. Below is the GSM8K comparison; the full results include both benchmarks.

GSM8K · Test accuracy (%)Higher is better

Comparing methods across four models

Shared 0–100% scale · HG-MS (ours) in blue.

Llama-3-8B

Qwen-2-7B

Gemma-2-9B

Qwen2.5-32B

Single-seed results. OOM means the method ran out of memory under the reported setup; it is not a zero score. Sources: Table 2 and Table 3(a).
Full results, protocol & downloads

Both benchmarks report test accuracy (%); higher is better. OOM denotes an out-of-memory run. These are single-seed measurements (seed 2424), not averages or evidence of statistical significance.

Llama-3-8B · Test accuracy (%)
MethodGSM8KMATH
Uniform Weighting60.0630.24
RHO-LOSS65.4325.89
LESS74.4529.93
ScaleBiO66.1930.58
HG-baseline73.7730.49
HG-MS (ours)74.8530.86
Qwen-2-7B · Test accuracy (%)
MethodGSM8KMATH
Uniform Weighting60.0330.26
RHO-LOSS63.1533.40
LESS65.2829.24
ScaleBiO75.7436.93
HG-baseline68.4634.27
HG-MS (ours)82.0338.98
Gemma-2-9B · Test accuracy (%)
MethodGSM8KMATH
Uniform Weighting78.0837.29
RHO-LOSS78.4737.35
LESS79.2838.00
ScaleBiO79.6237.98
HG-baseline80.1438.23
HG-MS (ours)80.8638.48
Qwen2.5-32B · Test accuracy (%)
MethodGSM8KMATH
Uniform Weighting78.1943.30
RHO-LOSSOOMOOM
LESSOOMOOM
ScaleBiO88.4051.29
HG-baseline86.8146.82
HG-MS (ours)92.5853.32

The compared methods include RHO-LOSS [3], LESS [4], and ScaleBiO [5]. All numerical results shown here come from our paper [1].

Each completed run uses a final 20,000-example fine-tuning set and one training epoch, with a common evaluation protocol within each model. These are the paper’s adapted baseline implementations under a single-H100 setup.

For the iterative methods (ScaleBiO, HG-baseline, and HG-MS), reweighting time is matched within each model: approximately 12 hours for Llama-3-8B, 9 for Qwen-2-7B, and 15 for Gemma-2-9B and Qwen2.5-32B. The noniterative baselines have no outer reweighting horizon. Experimental protocol.

Download both benchmarks (CSV) · Download GSM8K figure (SVG)

A closer look: Qwen-2-7B

HG-MS reached 82.03% GSM8K accuracy, compared with 75.74% for ScaleBiO, the strongest comparator here. Its learned mixture also emphasized a different source: DART-Math rather than MathInstruct.

The three iterative methods below use the same ten-source portfolio and nine-hour reweighting budget. Each final mixture supplies 20,000 examples for one epoch of fine-tuning.

Qwen-2-7B · 9-hour reweightingReported final mixtures

Same ten sources. Different final mixtures.

Final sampling weights · Each ring totals 100%.

ScaleBiO

99.6%

MathInstruct

0.4% remaining sources

HG-baseline

99.6%

MathInstruct

0.4% remaining sources

HG-MS (ours)

94.0%

DART-Math

5.6% MathInstruct0.4% Orca-Math

HG-MS shifts the emphasis from MathInstruct to DART-Math in this experiment.

Final sampling weights, rounded as reported. Source: Table 14.
Source weights & comparison details

All three runs use the same ten-source portfolio and nine-hour reweighting budget. These are sampling weights, not exact counts of sampled examples. For the comparators, the remaining weight is grouped as “remaining sources”. DART-Math’s individual weight is not reported for either comparator; it is included in that remainder, not assumed to be zero.

Top three weights reported in Table 14
MethodSourceWeight (%)
ScaleBiOMathInstruct99.6
SlimOrca0.1
GPT4-LLM-Cleaned0.1
HG-baselineMathInstruct99.6
GPT4-LLM-Cleaned0.3
SlimOrca0.0
HG-MSDART-Math94.0
MathInstruct5.6
Orca-Math0.4

HG-MS’s 0.4% Orca-Math share is shown at the reported precision. A rounded 0.0 does not establish an exactly zero weight. This single-seed comparison does not imply that DART-Math is best for every model, or separate the mixture’s effect from the rest of the procedure.

Download reported source weights (CSV) · Experimental protocol

When training leaves a choice,
selection becomes part of optimization.

Read the paper

Select-then-differentiate: Solving Bilevel Optimization with Manifold Lower-level Solution Sets
Saeed Masiha, Zebang Shen, Negar Kiyavash, and Niao He.

References

  1. Saeed Masiha, Zebang Shen, Negar Kiyavash, and Niao He. Select-then-differentiate: Solving Bilevel Optimization with Manifold Lower-level Solution Sets. NeurIPS, 2026.
  2. Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-Rank Adaptation of Large Language Models. ICLR, 2022.
  3. Sören Mindermann, Jan M. Brauner, Muhammed T. Razzak, Mrinank Sharma, Andreas Kirsch, Winnie Xu, Benedikt Höltgen, Aidan N. Gomez, Adrien Morisot, Sebastian Farquhar, and Yarin Gal. Prioritized Training on Points that are Learnable, Worth Learning, and not yet Learnt. ICML, PMLR 162:15630–15649, 2022.
  4. Mengzhou Xia, Sadhika Malladi, Suchin Gururangan, Sanjeev Arora, and Danqi Chen. LESS: Selecting Influential Data for Targeted Instruction Tuning. ICML, PMLR 235:54104–54132, 2024.
  5. Rui Pan, Dylan Zhang, Hanning Zhang, Xingyuan Pan, Minrui Xu, Jipeng Zhang, Renjie Pi, Xiaoyu Wang, and Tong Zhang. ScaleBiO: Scalable Bilevel Optimization for LLM Data Reweighting. ACL, pp. 31959–31982, 2025.

Cite this post

@misc{masiha2026sametrainingloss,
  author = {Masiha, Saeed},
  title = {{Same Training Loss, Different Behavior: Which Solution Should We Choose?}},
  year = {2026},
  month = oct,
  howpublished = {Saeed Masiha's Research Blog},
  url = {https://smasiha.github.io/writing/same-training-loss/},
  note = {Published 16 October 2026}
}

← Research Blog

Top