HackerPapers

arXiv:2502.01628cs.LG

Harmonic Loss Trains Interpretable AI Models

David D. Baek, Ziming Liu, Riya Tyagi, Max Tegmark

Abstract

In this paper, we introduce harmonic loss as an alternative supervisory signal for training neural networks and large language models (LLMs). Harmonic loss differs from standard cross-entropy loss by (a) replacing the usual SoftMax normalization with a scale-invariant HarMax function and (b) computing logits via Euclidean distance rather than a dot product. Harmonic loss enables improved interpretability and faster convergence, owing to its scale invariance and finite convergence point by design, which can be interpreted as a class center. We first validate the performance of harmonic models across algorithmic, vision, and language datasets. Through extensive experiments, we demonstrate that models trained with harmonic loss perform better than standard models by: (a) enhancing interpretability, (b) requiring less data for generalization, and (c) reducing grokking. Moreover, we compare a GPT-2 model trained with harmonic loss to the standard GPT-2, illustrating that the harmonic model develops more interpretable representations. Looking forward, we believe harmonic loss may become a valuable tool in domains with limited data availability or in high-stakes applications where interpretability and reliability are paramount, paving the way for more robust and efficient neural network models.

arXiv comments
21 pages, 14 figures; The first two authors contributed equally
Journal reference
DOI
Subjects
cs.LGMachine Learning

On Hacker News

Linked by 2 identifiable commenters in 2 comments across 2 threads, from Feb 2025 to Feb 2025. Found in 2 HN submissions from Feb 2025 to Feb 2025. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments2 threads

    • The author admits they "kinda stopped reading this paper" after noticing that they only used one hyperparameter configuration, which I agree is a flaw in the paper, but that's not an excuse for sloppy treatment of the rest of the paper. (It would however, be an excuse to ignore…

      yorwbaView on HNParent context

    • "Harmonic Loss Trains Interpretable AI Models" (2025) https://arxiv.org/abs/2502.01628 Src: https://github.com/KindXiaoming/grow-crystals : > What is Harmonic Loss? Cross Entropy: https://en.wikipedia.org/wiki/Cross-entropy XAI: Explainable AI > Interpretability…

      westurnerView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.