Authors: Leelavathi Raja, Amirreza Eshraghi, Vinay Prabhakar, Mark Blacher, Han Bao, Yutong Wang
Organizations: Illinois Institute of Technology · Modular · Friedrich Schiller University Jena · The Institute of Statistical Mathematics & Tohoku University & RIKEN AIP
The familywise (FW) loss for multiclass classification, introduced by Duchi, Ruan, and Khosravi, achieves universal equivalence to the 0-1 loss, and thus has stronger theoretical properties than cross entropy (CE). Prior work, however, left open whether FW is as computationally efficient as CE. First, on the theoretical side, we prove that the FW gradient can be computed in O(K) time, where K is the number of classes. Second, on the practical side, we develop optimized kernels for computing the forward and backward passes of FW which outperform CE in terms of speed on both CPU and GPU.
Figures & tables
Figure 1: An illustrative example (per-sample) of Algorithm 2 . The input vector consists of eight logits, with r=2 bits processed per pass, resulting in 2r=4 bins represented by different colors. After determining the initial threshold (Stage 1), the remaining logits are copied to the candidate buffer (Stage 2) and then partitioned into radix bins (Stage 3). The bins are successively accepted or refined until the stopping condition is reached, yielding the final maximizing κˉ .
Figure 2: GPU runtime across different numbers of classes K and values of σ . Radix FW (FW_CUDA), naive FW (FW_naive), top-k FW (FW_topk), and PyTorch cross-entropy (CE) are compared. Mean κˉ represents the average maximizing κˉ across N=32 samples for K2 to K6 . Median execution time over 200 timed trials after 20 warm-up iterations.
Figure 3: CPU loss and gradient computation time across different class counts K and sparsity regimes (batch size 32, two threads). We compare our single-pass threshold search (FW_CPU) against PyTorch cross-entropy (CE) and the naive implementation (FW_naive). Lines are medians and bands are the 20–80 quantiles.
Figure 4: ( Left ) Test accuracy vs wall clock time on MNIST using the example code provided by GDTUO ( Chandra et al., 2022 ) . ( Middle ) Test accuracy versus epoch on training ResNet18 using the DoG optimizer ( Ivgi et al., 2023 ) . ( Right ) Validation accuracy vs epoch on ImageNet using Prodigy Mishchenko and Defazio (2024) . Total wall clock times for both training runs are ∼ 48600 seconds.
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 5: (Left) Simulated logits z∼N(0,0.1) with K=10000 (thus σ=1000 in the notation of Theorem C.1 ). For each blue dot, the x-coordinate is κ/K and the y-coordinate is Hκ (subsampled to avoid clutter). The thick blue ribbon is the limiting curve as K→∞ . (Right) κˉ versus σ . The blue line is the prediction of Theorem C.1 with the actual σ .
# datasets where loss won
# features
<30
≥30
FW
22
15
CE
44
9
Both
20
10
Total
86
34
Appendix
Table 1: Performance of familywise loss vs cross entropy loss-trained linear classifiers on the 90 datasets panel subset of the UCI dataset from Arora et al. (2020)
Figure 6: Laplace distribution
Figure 7: Mixed Gaussian distribution
Figure 8: CPU loss and gradient computation time for Laplace logits with mean 0 and standard deviation σ (batch size 32, AVX-512, two threads). Lines are medians and bands are the 20–80 quantiles.
Figure 9: CPU loss and gradient computation time for mixture logits: each logit is drawn from N(0,1) or from N(2,σ2) with probability 1/2 each (batch size 32, AVX-512, two threads). Lines are medians and bands are the 20–80 quantiles.