Skip to main content
QUICK REVIEW

[Paper Review] sigmoidF1: A Smooth F1 Score Surrogate Loss for Multilabel Classification

G. F. Benedict, Vincent Koops|arXiv (Cornell University)|Aug 24, 2021
Machine Learning and Data ClassificationComputer Science13 citations
TL;DR

This paper introduces sigmoidF1, a smooth, differentiable surrogate loss for multilabel classification that directly optimizes the macro F1 score by approximating the step function in F1 computation using a sigmoid. It outperforms standard losses like cross-entropy across four diverse datasets (one text, three images) on multiple metrics, demonstrating that training with metric-aware losses improves performance in multilabel settings.

ABSTRACT

Multiclass multilabel classification is the task of attributing multiple labels to examples via predictions. Current models formulate a reduction of the multilabel setting into either multiple binary classifications or multiclass classification, allowing for the use of existing loss functions (sigmoid, cross-entropy, logistic, etc.). Multilabel classification reductions do not accommodate for the prediction of varying numbers of labels per example and the underlying losses are distant estimates of the performance metrics. We propose a loss function, sigmoidF1, which is an approximation of the F1 score that (1) is smooth and tractable for stochastic gradient descent, (2) naturally approximates a multilabel metric, and (3) estimates label propensities and label counts. We show that any confusion matrix metric can be formulated with a smooth surrogate. We evaluate the proposed loss function on text and image datasets, and with a variety of metrics, to account for the complexity of multilabel classification evaluation. sigmoidF1 outperforms other loss functions on one text and two image datasets and several metrics. These results show the effectiveness of using inference-time metrics as loss functions for non-trivial classification problems like multilabel classification.

Motivation & Objective

  • Address the misalignment between standard loss functions (e.g., cross-entropy) and evaluation metrics (e.g., F1) in multilabel classification.
  • Overcome the intractability of optimizing non-differentiable metrics like F1 by introducing a smooth surrogate using sigmoid approximation.
  • Enable joint optimization of label prediction and label count estimation within a single unified loss function.
  • Demonstrate that using inference-time metrics as training objectives leads to superior generalization across diverse modalities and architectures.

Proposed method

  • Propose a smooth, differentiable approximation of the macro F1 score using a sigmoid function to replace the hard thresholding step in F1 computation.
  • Define the surrogate F1 score as a continuous function of logits, enabling backpropagation via stochastic gradient descent.
  • Formulate the loss as $\mathcal{L}_{\widetilde{\mathit{F1}}} = 1 - \widetilde{\mathit{F1}}$, minimizing the inverse of the smoothed F1 score.
  • Integrate the loss into a standard deep learning pipeline with a classification head and sigmoid activation, allowing end-to-end training.
  • Use batch-level macro F1 computation to ensure global optimization of the metric across all classes.
  • Introduce an unbounded variant, unboundedF1, to reduce hyperparameter sensitivity while maintaining strong performance.

Experimental results

Research questions

  • RQ1Can a smooth, differentiable surrogate of the macro F1 score be constructed that enables direct optimization during training in multilabel classification?
  • RQ2Does optimizing with sigmoidF1 lead to improved performance on standard multilabel metrics compared to conventional losses like cross-entropy?
  • RQ3How robust is sigmoidF1 across different data modalities (text, image), model architectures, and dataset sizes?
  • RQ4Can the proposed loss simultaneously improve both label prediction accuracy and label count estimation in multilabel settings?
  • RQ5What is the impact of using metric-based losses (e.g., F1) as training objectives versus standard cross-entropy in multilabel learning?

Key findings

  • sigmoidF1 outperforms standard cross-entropy and other baseline losses on the weighted F1 metric across one text and three image datasets.
  • The method achieves consistent improvements on multiple metrics, including precision, recall, and F1, across diverse datasets and model architectures.
  • On the MS-COCO image dataset, sigmoidF1 achieved a macro F1 of 15.20, outperforming other losses in the benchmark.
  • The unboundedF1 variant, which eliminates hyperparameter tuning, delivered better results than standard multiclass losses on most metrics.
  • The performance gains were observed across different model types, including CNNs and BERT-based models, indicating robustness to architecture and modality.
  • The study provides empirical evidence that training with metric-aware losses like sigmoidF1 leads to better alignment between training objectives and evaluation metrics.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.