Spend less gradient on examples already solved.

Dense classifiers can drown in easy negatives. Focal loss multiplies cross-entropy by a confidence-dependent factor so hard or misclassified examples carry more of the update.

Focus the loss

Loss weight across confidence

FL = −0.25(1 − pₜ)² log(pₜ)
Cross entropy0.22

Baseline negative log likelihood.

Focal weight0.01

α(1 − pₜ)^γ multiplier.

Focal loss0.00

Weighted contribution from this example.

Easy-negative share90%

Why dense imbalance can dominate training.

Focal loss changes allocation, not evidence.

Gamma suppresses easy cases

At γ = 0, focal loss reduces to α-balanced cross-entropy. Larger γ increasingly down-weights high-pₜ examples.

Alpha handles class asymmetry

α can rebalance positives and negatives, but it should be tuned against prevalence and the chosen decision metric.

Evaluation remains task-specific

Track precision-recall, calibration, rare cohorts, false negatives, and threshold behavior. Lower training loss is not the deployment objective.

Primary reading

Focal Loss for Dense Object Detection Lin et al.sigmoid_focal_loss TorchvisionClass-Balanced Loss Based on Effective Number of Samples Cui et al.