[Paper Review] Dual Focal Loss for Calibration
This paper proposes Dual Focal Loss (DFL), a novel loss function that improves deep neural network calibration by leveraging both the ground truth logit and the highest non-target logit to balance over-confidence and under-confidence. By maximizing the gap between these dual logits, DFL achieves state-of-the-art calibration performance across multiple models and datasets, reducing ECE to 0.46 on CIFAR-10 with ResNet-50 after temperature scaling.
The use of deep neural networks in real-world applications require well-calibrated networks with confidence scores that accurately reflect the actual probability. However, it has been found that these networks often provide over-confident predictions, which leads to poor calibration. Recent efforts have sought to address this issue by focal loss to reduce over-confidence, but this approach can also lead to under-confident predictions. While different variants of focal loss have been explored, it is difficult to find a balance between over-confidence and under-confidence. In our work, we propose a new loss function by focusing on dual logits. Our method not only considers the ground truth logit, but also take into account the highest logit ranked after the ground truth logit. By maximizing the gap between these two logits, our proposed dual focal loss can achieve a better balance between over-confidence and under-confidence. We provide theoretical evidence to support our approach and demonstrate its effectiveness through evaluations on multiple models and datasets, where it achieves state-of-the-art performance. Code is available at https://github.com/Linwei94/DualFocalLoss
Motivation & Objective
- To address the persistent trade-off between over-confidence and under-confidence in deep neural network calibration.
- To improve model calibration without sacrificing sample hardness information, which is often lost in regularization-based approaches.
- To develop a loss function that explicitly models the relationship between the correct logit and the next highest logit to enhance confidence calibration.
- To provide theoretical and empirical evidence that dual logit supervision leads to better calibration than single-logit focal loss.
Proposed method
- The proposed Dual Focal Loss (DFL) incorporates two logits: the ground truth logit and the largest logit from incorrect classes.
- DFL maximizes the margin between the correct logit and the top incorrect logit, promoting better separation and improved confidence calibration.
- The loss function is derived from instance-wise conditional risk analysis, providing theoretical justification for its ability to reduce under-confidence regions.
- The method is designed to balance regularization (to reduce over-confidence) and hardness preservation (to avoid under-confidence), outperforming both focal loss and inverse focal loss.
- Ablation studies evaluate variants using second, third, or mean logits from incorrect classes, demonstrating robustness and generalization of the dual-logit approach.
- The model is trained using standard cross-entropy and temperature scaling is applied post-hoc to further improve calibration metrics.
Experimental results
Research questions
- RQ1Can a loss function that explicitly models the gap between the correct logit and the top incorrect logit improve model calibration?
- RQ2Does dual-logit supervision reduce the size of the under-confidence region while maintaining advantages in over-confidence mitigation?
- RQ3How does DFL compare to focal loss and inverse focal loss in balancing calibration performance and sample hardness preservation?
- RQ4Can the dual-logit formulation be generalized to include multiple top incorrect logits, and does this improve calibration further?
Key findings
- DFL achieves state-of-the-art calibration performance on CIFAR-10 with an ECE of 0.46 after temperature scaling, outperforming focal loss (ECE: 1.55) and other variants.
- On CIFAR-100, DFL reduces ECE to 0.52 with ResNet-50, significantly outperforming baseline methods and showing consistent gains across models.
- The method reduces the under-confidence region size while preserving sample hardness, as evidenced by the distribution of maximum logit outputs and predicted probabilities.
- Ablation studies show that using the mean of the top two or three incorrect logits further improves calibration, with ECE dropping to 0.38 when all lower logits are averaged.
- Theoretical analysis confirms that DFL reduces both over-confidence and under-confidence regions, supporting its effectiveness through conditional risk minimization.
- DFL maintains high accuracy while improving calibration, demonstrating that it does not compromise predictive performance for better confidence estimation.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.