Organizations: American University, Washington, DC, USA · University of Vermont, Burlington, USA · AGH University, Krakow, Poland · Xinjiang University, Ürümqi, China · University of Edinburgh, Edinburgh, United Kingdom
Cross-entropy loss has long been the standard choice for training deep neural networks, yet it suffers from interpretability limitations, unbounded weight growth, and inefficiencies that can contribute to costly training dynamics. The harmonic loss is a distance-based alternative grounded in Euclidean geometry that improves interpretability and mitigates phenomena such as grokking, or delayed generalization on the test set. However, the study of harmonic loss remains narrow: only Euclidean distance is explored, and no systematic evaluation of computational efficiency or sustainability was conducted. We extend harmonic loss by systematically investigating a broad spectrum of distance metrics as replacements for the Euclidean distance. We comprehensively evaluate distance-tailored harmonic losses on both vision backbones and large language models. Our analysis is framed around a three-way evaluation of model performance, interpretability, and sustainability. On vision tasks, cosine distances provide the most favorable trade-off, consistently improving accuracy while lowering carbon emissions, whereas Bray-Curtis and Mahalanobis further enhance interpretability at varying efficiency costs. On language models, cosine-based harmonic losses improve gradient and learning stability, strengthen representation structure, and reduce emissions relative to cross-entropy and Euclidean heads. Our code is available at: https://anonymous.4open.science/r/rethinking-harmonic-loss-5BAB/.
Figures & tables
Figure 1: Vision: Radar plots: 1) Model Performance (F1, Accuracy); 2) Interpretability (PC2 EV, PCA 90%), and 3) Sustainability (Duration/Epoch/GFLOPs, Emissions). Plots feature Baseline (Cross-Entropy), Euclidean harmonic, and the four top-performing non-Euclidean harmonic losses.
Figure 2: Language: Radar plots: 1) Model Performance (Perplexity, Effective Rank, Gradient Stability); 2) Interpretability (PCA5 EV), and 3) Sustainability (Emissions). Plots feature Baseline (CE), Euclidean harmonic, and the top-performing non-Euclidean harmonic losses.
Appendix figures & tables38 assets
Supplementary material from the paper’s appendix.
Appendix
Configuration
GPT
BERT
Qwen
GPT-2B
nlayer
12
12
24
48
nhead
12
12
14
20
nembd
768
768
896
1600
Vocab size
50304
50304
151936
50304
Dropout
0.1
0.1
0.0
0.1
Bias
True
True
True
True
Appendix
Table 1: Core configuration for GPT, BERT, Qwen, and GPT-2B on OpenWebText.
Configuration
GPT
BERT
Qwen
GPT-2B
Block size / Seq length
1024
512
1024
512
Type vocab size
–
2
–
–
Pad token id
–
0
–
–
MLM probability
–
0.15
–
–
Intermediate size
–
–
4864
–
# key–value heads
–
–
2
–
Appendix
Table 2: Architecture-specific settings for GPT, BERT, Qwen, and GPT-2B.
Aspect
GPT
BERT
Qwen
GPT-2B
Model size (approx.)
∼ 124M
∼ 110M
∼ 494M
∼ 2B
Attention
Causal
Bidirectional
Causal (GQA)
Causal
Training task
CLM
MLM
CLM
CLM
Position encoding
Learned
Learned
RoPE
Learned
Appendix
Table 3: Key differences summary (task and position encoding).
Configuration
MLP
CNN
PVT
ResNet50
LR (MNIST)
3e-4
3e-4
1e-3
0.1
LR (CIFAR-10)
3e-4
3e-4
1e-3
0.1
LR (CIFAR-100)
3e-4
3e-4
5e-4
0.1
LR (MarathiSign)
1.5e-4
1.5e-4
5e-4
0.05
LR (TinyImageNet)
3e-4
3e-4
5e-4
0.1
Epochs (MNIST)
40
40
80
100
Appendix
Table 4: Core training configuration by backbone and dataset.
Table 9: Wilcoxon signed–rank test comparing each non–Euclidean harmonic loss against the Euclidean harmonic baseline on average final test accuracy . Median score improvement is the median paired difference (non–Euclidean minus Euclidean) across N dataset–backbone combinations. Positive values indicate that the non–Euclidean distance attains higher accuracy; the last column marks tests with p<0.05 .
Comparison
N Pairs
Median Impr.
p -value
padj
Sig. ( p<0.05 )
Bray–Curtis (Norm.)
16
12.8333
<0.001
0.1142
Yes
Canberra (Robust)
16
9.8333
0.00162
0.2086
Yes
Canberra (Std.)
16
8.1667
<0.001
0.0988
Yes
Chebyshev (Std.)
16
7.7083
0.01864
1.0000
Yes
Manhattan
16
7.6667
0.00412
0.4764
Yes
Cosine (Unst.)
16
5.8333
0.01043
1.0000
Yes
Appendix
Table 10: Wilcoxon signed–rank test comparing each non–Euclidean harmonic loss against the Euclidean harmonic baseline on average intrinsic dimension (number of PCs required to reach 90% EV). Median score improvement is again the median paired difference (non–Euclidean minus Euclidean); here more negative values correspond to fewer required components.
Comparison
N Pairs
Median Impr.
p -value
padj
Sig. ( p<0.05 )
Mahalanobis (Std.)
16
1.8037
<0.001
0.114
Yes
Bray–Curtis (Std.)
16
1.1880
0.01620
1.000
Yes
Cosine (Unst.)
16
0.2341
0.05249
1.000
Canberra (Std.)
16
0.0351
0.77611
1.000
Chebyshev (Smooth)
16
0.0208
0.73679
1.000
Canberra (Robust)
16
-0.0206
0.73679
1.000
Appendix
Table 11: Wilcoxon signed–rank test comparing each non–Euclidean harmonic loss against the Euclidean harmonic baseline on average emissions (gCO 2 eq). Median score improvement is the median paired difference (non–Euclidean minus Euclidean); negative values indicate lower emissions than the Euclidean reference.
Figure 3: Vision: Accuracy curves with Confidence Intervals. Shaded regions show 95% confidence intervals (n = 3 seeds)
Figure 4: Vision: Radar plots: 1) Model Performance (F1, Accuracy); 2) Interpretability (PC2 EV, PCA 90%), and 3) Sustainability (Duration/Epoch/GFLOPs, Emissions). Plots feature Baseline (Cross-Entropy), Euclidean harmonic, and the four top-performing non-Euclidean harmonic losses.
Method
Acc
F1
gCO 2 eq
EV
PC90%
Baseline
0.3994
0.3970
3.67
0.0973
50.0
Focal ( γ=2,α=0.25 )
0.4017 ( 0.59% )
0.3996 ( 0.65% )
4.9609 ( -35.35% )
0.1257 ( 29.22% )
50.0 ( 0% )
Focal ( γ=3,α=0.25 )
0.4015 ( 0.53% )
0.3999 ( 0.72% )
4.9567 ( -35.24% )
0.1364 ( 40.21% )
50.0 ( 0% )
Focal ( γ=2,α=0.5 )
0.4010 ( 0.40% )
0.3997 ( 0.66% )
3.9182 ( -6.90% )
0.1271 ( 30.64% )
50.0 ( 0% )
Conf. Penalty ( β=0.1 )
0.3999 ( 0.13% )
0.3977 ( 0.17% )
5.2574 ( -43.44% )
0.0963 ( -0.96% )
50.0 ( 0% )
Label Smoothing ( ε=0.1 )
0.3894 ( -2.50% )
0.3888 ( -2.08% )
2.6626 ( 27.36% )
0.0818 ( -15.92% )
50.0 ( 0% )
Appendix
Table 12: Results for CIFAR100 PVT (top-8 losses) and % changes w.r.t. Baseline (CE).
Method
Acc
F1
gCO 2 eq
EV
PC90%
Baseline
0.7006
0.6993
89.64
0.1069
50.0
Cosine (Stable)
0.7381 ( 5.35% )
0.7384 ( 5.59% )
79.2831 ( 11.55% )
0.5915 ( 453.51% )
8.0 ( 84.00% )
Focal ( γ=2,α=0.25 )
0.7349 ( 4.90% )
0.7342 ( 5.00% )
72.1795 ( 19.48% )
0.1468 ( 37.32% )
50.0 ( 0% )
Focal ( γ=2,α=0.5 )
0.7341 ( 4.79% )
0.7332 ( 4.85% )
78.7234 ( 12.18% )
0.1224 ( 14.52% )
50.0 ( 0% )
Cosine (Unst.)
0.7340 ( 4.77% )
0.7349 ( 5.09% )
72.5413 ( 19.07% )
0.5891 ( 451.21% )
8.0 ( 84.00% )
Focal ( γ=3,α=0.25 )
0.7311 ( 4.36% )
0.7308 ( 4.51% )
81.5875 ( 8.98% )
0.1554 ( 45.41% )
50.0 ( 0% )
Appendix
Table 13: Results for CIFAR100 ResNet50 (top-8 losses) and % changes w.r.t. Baseline (CE).
Method
Acc
F1
gCO 2 eq
EV
PC90%
Baseline
0.9965
0.9964
2.85
0.2135
24.75
ArcFace ( m=0.7,s=30 )
0.9997 ( 0.33% )
0.9997 ( 0.33% )
4.2108 ( -47.88% )
0.1132 ( -47.00% )
36.0 ( -45.45% )
Focal ( γ=3,α=0.25 )
0.9997 ( 0.32% )
0.9996 ( 0.32% )
2.7240 ( 4.34% )
0.2749 ( 28.74% )
19.33 ( 21.89% )
Center Loss ( λ=1 )
0.9995 ( 0.31% )
0.9995 ( 0.31% )
5.1746 ( -81.72% )
0.1824 ( -14.56% )
29.67 ( -19.87% )
Conf. Penalty ( β=0.2 )
0.9995 ( 0.30% )
0.9994 ( 0.30% )
3.6912 ( -29.63% )
0.1504 ( -29.58% )
33.67 ( -36.03% )
Focal ( γ=2,α=0.25 )
0.9993 ( 0.29% )
0.9993 ( 0.28% )
2.5648 ( 9.93% )
0.2853 ( 33.63% )
19.33 ( 21.89% )
Appendix
Table 14: Results for MarathiSign PVT (top-8 losses) and % changes w.r.t. Baseline (CE).
Method
Acc
F1
gCO 2 eq
EV
PC90%
Baseline
0.9998
0.9998
35.41
0.4507
15.5
Conf. Penalty ( β=0.1 )
0.9999 ( 0.01% )
0.9999 ( 0.01% )
29.6596 ( 16.24% )
0.4393 ( -2.55% )
17.5 ( -12.90% )
Cosine (Stable)
0.9999 ( 0.01% )
0.9999 ( 0.01% )
54.8139 ( -54.80% )
0.7321 ( 62.42% )
5.5 ( 64.52% )
Conf. Penalty ( β=0.2 )
0.9998 ( 0.00% )
0.9998 ( 0.00% )
30.3697 ( 14.23% )
0.3288 ( -27.05% )
33.0 ( -112.90% )
Focal ( γ=2,α=0.25 )
0.9998 ( 0.00% )
0.9998 ( 0.00% )
24.95 ( 29.54% )
0.4016 ( -10.89% )
17.0 ( -9.68% )
Focal ( γ=3,α=0.25 )
0.9998 ( 0.00% )
0.9998 ( 0.00% )
28.1206 ( 20.58% )
0.4286 ( -4.91% )
16.5 ( -6.45% )
Appendix
Table 15: Results for MarathiSign ResNet50 (top-8 losses) and % changes w.r.t. Baseline (CE).
Figure 5: Vision: Radar plots – MNIST, CIFAR10, CIFAR100: 1) Model Performance (F1, Accuracy); 2) Interpretability (PC2 EV, PCA 90%), and 3) Sustainability (Duration/Epoch, Emissions). Plots feature Baseline (Cross-Entropy), Euclidean harmonic, and the four top-performing losses.
Figure 6: Vision: Radar plots – Marathi Sign Language, TinyImageNet: 1) Model Performance (F1, Accuracy); 2) Interpretability (PC2 EV, PCA 90%), and 3) Sustainability (Duration/Epoch, Emissions). Plots feature Baseline (Cross-Entropy), Euclidean harmonic, and the four top-performing losses.
Figure 7: Vision: Emissions Averaged Across Seeds and Aggregated Over all 12 Model Backbones.
Figure 8: Loss convergence behavior with PVT and ResNet50: Training and Validation loss across all datasets with different non-Euclidean harmonic losses.
Figure 9: Loss convergence behavior with language models (BERT-0.1B, GPT-0.1B, QWEN2-0.5B, GPT-2B).
Model
Dataset
In Ch.
H
W
#Cls
FLOPs
Params
GFLOPs
CNN
CIFAR10
3
32
32
10
12307072
545098
0.0123
CNN
CIFAR100
3
32
32
100
12330112
556708
0.0123
CNN
MarathiSign
3
32
32
43
12315520
549355
0.0123
CNN
MNIST
1
28
28
10
8520064
421642
0.0085
CNN
TinyImageNet
3
224
224
200
602966144
25735432
0.6029
MLP
CIFAR10
3
32
32
10
3413760
1707274
0.0034
Appendix
Table 16: Per-sample FLOPs, GFLOPs, and parameter counts for each backbone and dataset.
Figure 11: Geometric effect of distance–based harmonic losses on ResNet50 embeddings (MNIST). From top to bottom: Baseline (a), Euclidean harmonic loss (b), cosine harmonic loss (c), and Mahalanobis harmonic loss (d).
Figure 12: Geometric effect of distance–based harmonic losses on ResNet50 embeddings (CIFAR10). From top to bottom: Baseline (a), Euclidean harmonic loss (b), cosine harmonic loss (c), and Mahalanobis harmonic loss (d).
Figure 13: Carbon emission differences for MNIST across four model backbones (MLP, CNN, ResNet50, PVT) when replacing cross-entropy with harmonic loss variants. Bars show the emission difference in grams of CO 2 eq relative to the baseline (cross-entropy). Values above zero indicate higher emissions than baseline, while negative values indicate greener, more sustainable outcomes.
Figure 14: Carbon emission differences for CIFAR10 across four model backbones (MLP, CNN, ResNet50, PVT) when replacing cross-entropy with harmonic loss variants. Bars show the emission difference in grams of CO 2 eq relative to the baseline (cross-entropy). Values above zero indicate higher emissions than baseline, while negative values indicate greener, more sustainable outcomes.
Figure 15: Carbon emission differences for CIFAR100 across four model backbones (MLP, CNN, ResNet50, PVT) when replacing cross-entropy with harmonic loss variants. Bars show the emission difference in grams of CO 2 eq relative to the baseline (cross-entropy). Values above zero indicate higher emissions than baseline, while negative values indicate greener, more sustainable outcomes.
Figure 16: Carbon emission differences for LLM pretraining on OpenWebText (BERT, GPT2, QWEN) when replacing cross-entropy with harmonic loss variants. Bars show the emission difference in grams of CO 2 eq relative to the baseline (cross-entropy). Values above zero indicate higher emissions than baseline, while negative values indicate greener, more sustainable outcomes.
Neural network interpretability studies how models represent information and make predictions, and how to explain, test, or control their internal computations.
Neural networks trained with standard objectives exhibit behaviors characteristic of probabilistic inference: soft clustering, prototype specialization, and Bayesian uncertainty tracking. These phenomena appear across architectures -- in attention mechanisms, classification heads, and energy-based models -- yet existing explanations often rely on loose analogies to mixture models or post-hoc architectural interpretation. We provide a direct explanation. For any objective with log-sum-exp structure over distances or energies, the gradient with respect to each distance is exactly the negative posterior responsibility of the corresponding component: ∂L/∂dj=−rj. The identity is algebraic, requiring only differentiability; it is a specialization of Fisher's identity, and its significance here is its address: standard neural objectives instantiate it without modification. The consequence is that gradient descent on such objectives performs generalized expectation-maximization implicitly, with responsibilities arising as gradients to be applied rather than auxiliary variables to be computed. This result unifies three regimes of learning: unsupervised mixture modeling, where responsibilities are fully latent; attention, where responsibilities are conditioned on queries; and cross-entropy classification, where supervision clamps responsibilities to targets. Our claims live at training time: the responsibility-weighted gradient dynamics recently documented in transformers follow from the objective's geometry. The in-context Bayesian computation that trained transformers perform at inference time is the endpoint of these dynamics, not their per-step content.
Large-scale Vision-Language Models (VLMs) such as CLIP learn powerful semantic representations but operate in Euclidean space, which fails to capture the inherent hierarchical structure of visual and linguistic concepts. Hyperbolic geometry, with its exponential volume growth, offers a principled alternative for embedding such hierarchies with low distortion. However, existing hyperbolic VLMs use entailment losses that are unstable: as parent embeddings contract toward the origin, their entailment cones widen toward a half-space, causing catastrophic cone collapse that destroys the intended hierarchy. Additionally, hierarchical evaluation of these models remains unreliable, being largely retrieval-based and correlation-based metrics and prone to taxonomy dependence and ambiguous negatives. To address these limitations, we propose an adaptive entailment loss paired with a norm regularizer that prevents cone collapse without heuristic aperture clipping. We further introduce an angle-based probabilistic entailment protocol (PEP) for evaluating hierarchical understanding, scored with AUC-ROC and Average Precision. This paper introduces a stronger hyperbolic VLM baseline ARGENT, Adaptive hieRarchical imaGe-tExt represeNTation. ARGENT improves the SOTA hyperbolic VLM by 0.7, 1.1, and 0.8 absolute points on image classification, text-to-image retrieval, and proposed hierarchical metrics, respectively.
Chuong Huynh, Hossein Souri, Abhinav Kumar +3
University of Maryland, College Park · Samsung Research America, AI Center – Mountain View
Real-world data frequently exhibit latent hierarchical structures, which can be naturally represented by hyperbolic geometry. Although recent hyperbolic neural networks have demonstrated promising results, many existing architectures remain partially intrinsic, mixing Euclidean operations with hyperbolic ones or relying on extrinsic parameterizations. To address it, we propose the Intrinsic Lorentz Neural Network (ILNN), a fully intrinsic hyperbolic architecture that conducts all computations within the Lorentz model. At its core, the network introduces a novel point-to-hyperplane fully connected layer (FC), replacing traditional Euclidean affine logits with closed-form hyperbolic distances from features to learned Lorentz hyperplanes, thereby ensuring that the resulting geometric decision functions respect the inherent curvature. Around this fundamental layer, we design intrinsic modules: GyroLBN, a Lorentz batch normalization that couples gyro-centering with gyro-scaling, consistently outperforming both LBN and GyroBN while reducing training time. We additionally proposed a gyro-additive bias for the FC output, a Lorentz patch-concatenation operator that aligns the expected log-radius across feature blocks via a digamma-based scale, and a Lorentz dropout layer. Extensive experiments conducted on CIFAR-10/100 and two genomic benchmarks (TEB and GUE) illustrate that ILNN achieves state-of-the-art performance and computational cost among hyperbolic models and consistently surpasses strong Euclidean baselines. The code is available at magenta{this url}.
Xianglong Shi, Ziheng Chen, Yunhan Jiang +1
University of Science and Technology of China · University of Trento · Peking University