You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

理论上训练集Loss与Accuracy是否可能反向变化?(非欠/过拟合场景)

Can Training Loss Rise While Accuracy Rises (and Vice Versa)?

Great question! These counterintuitive scenarios absolutely exist, and they’re not tied to the classic underfitting/overfitting patterns we usually talk about. Let’s break down each case with concrete examples and explanations:

1. Training Loss Rises, But Training Accuracy Improves

This happens because loss is a cumulative (or average) measure of error magnitude, while accuracy only counts how many samples are correctly classified—they optimize for slightly different things. Here’s a simple example to illustrate:

Suppose we have 100 training samples: 90 correctly classified (each with a cross-entropy loss of 0.1) and 10 misclassified (each with a loss of 10).

  • Initial total loss: (90 * 0.1) + (10 * 10) = 9 + 100 = 109
  • Initial accuracy: 90%

After one training iteration:

  • We fix 5 of the misclassified samples (now 95 correct, 5 misclassified). These 5 now have a loss of 0.1 instead of 10.
  • The remaining 5 misclassified samples now have a higher loss of 30 (the model is still refining its boundary for these tough cases).
  • 20 of the originally correct samples now have a higher loss of 0.8 (the model’s new decision boundary nudges these samples closer to the wrong side, but not enough to misclassify them).

Calculating the new metrics:

  • New total loss: (70 * 0.1) + (20 * 0.8) + (5 * 0.1) + (5 * 30) = 7 + 16 + 0.5 + 150 = 173.5 (which is higher than 109)
  • New accuracy: 95% (which is better than 90%)

Why this works:

The model fixed more high-impact misclassifications, but the increased loss from the remaining tough misclassifications and the slightly perturbed correct samples added up to a higher total loss. Accuracy improves because we’re correctly classifying more samples overall—even if some correct samples now have higher individual loss.

Other real-world triggers:

  • Using weighted loss functions that prioritize certain samples, leading to tradeoffs between overall loss and classification count.
  • The model learning a more nuanced decision boundary that temporarily increases loss for some correct samples but fixes more errors.

2. Training Loss Falls, But Training Accuracy Drops

This is the reverse scenario: the model reduces total loss by targeting high-loss misclassified samples, but at the cost of misclassifying some previously correct samples. Here’s an example:

Using the same initial setup:

  • Initial total loss: 109
  • Initial accuracy: 90%

After training:

  • The model reduces the loss of all 10 misclassified samples from 10 to 2 (a big drop).
  • But it misclassifies 15 previously correct samples, which now have a loss of 5 instead of 0.1.

New metrics:

  • New total loss: (75 * 0.1) + (15 * 5) + (10 * 2) = 7.5 + 75 + 20 = 102.5 (lower than 109)
  • New accuracy: 75% (worse than 90%)

Why this works:

The massive loss reduction from fixing the misclassified samples outweighs the loss increase from misclassifying some correct samples. Total loss goes down, but since we’re now getting more samples wrong overall, accuracy drops.

Real-world triggers:

  • The model is optimizing for loss reduction over classification correctness (common with certain loss functions or when training with noisy labels).
  • A local optimum where the model finds a way to reduce average loss but at the expense of more classification errors.

Key Distinction from Underfitting/Overfitting

These scenarios are entirely about the relationship between two training-set metrics, not about generalization to a test set. Underfitting is when both training loss is high and accuracy is low; overfitting is when training loss is low/accuracy high but test performance is poor. These cases are unique because they involve conflicting trends within the training set itself.

内容的提问来源于stack exchange,提问作者Jjang

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:31:19