Loss Functions for Top-k Error: Analysis and Insights

Maksim Lapin, Matthias Hein, Bernt Schiele
12/1/2015
112 citations
stat.MLcs.CVcs.LG

Official code: mlapin/libsdca (33 stars, Python, MIT, PyTorch, last commit 2026-11-12).

Abstract

In order to push the performance on realistic computer vision tasks, the number of classes in modern benchmark datasets has significantly increased in recent years. This increase in the number of classes comes along with increased ambiguity between the class labels, raising the question if top-1 error is the right performance measure.

Show full abstract

In this paper, we provide an extensive comparison and evaluation of established multiclass methods comparing their top-k performance both from a practical as well as from a theoretical perspective. Moreover, we introduce novel top-k loss functions as modifications of the softmax and the multiclass SVM losses and provide efficient optimization schemes for them. In the experiments, we compare on various datasets all of the proposed and established methods for top-k error optimization. An interesting insight of this paper is that the softmax loss yields competitive top-k performance for all k simultaneously. For a specific top-k error, our new top-k losses lead typically to further improvements while being faster to train than the softmax.

View on arXivView PDF

Code Implementations(1)

mlapin/libsdcaOfficial100%
PyTorchMIT

Accurate and fast classification losses for SDCA and neural networks: cross-entropy, top-k, multiclass and multilabel SVM, and distillation losses for PyTorch, JAX, NumPy, Rust, C/C++ and MATLAB

3313Python, C++Oct 25, 20152 weeks agoMIT
cppcross-entropycudahinge-lossjax+13 more

Similar Papers

Cite this paper

@article{lapin2015loss,
  title  = {Loss Functions for Top-k Error: Analysis and Insights},
  author = {Maksim Lapin and Matthias Hein and Bernt Schiele},
  year   = {2015},
  eprint = {1512.00486},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1512.00486}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/1512.00486.svg)](https://codeofpaper.com/paper/1512.00486)

Discussion