A hybrid transformer model with supervised contrastive loss for automatic music classification

With the rapid expansion of the digital music industry, streaming platforms are required to efficiently and accurately classify massive music collections to support personalized recommendation, content organization, and copyright management. However, music genre classification remains challenging due to class imbalance, limited samples in minority genres, and the inherent limitations of single-model architectures in capturing complex temporal and structural patterns. These issues restrict the robustness and discriminative capability of existing supervised deep learning approaches. To address these challenges, we propose a Hybrid Transformer with Supervised Contrastive Learning (HT-SCL) framework for automatic music classification. The proposed model integrates Transformer, Long Short-Term Memory (LSTM), and Convolutional Neural Network (CNN) branches in a parallel architecture, enabling simultaneous modeling of global dependencies, temporal dynamics, and local spectral features. In addition, a joint optimization strategy combining supervised contrastive loss and cross-entropy loss is introduced to enhance intra-class compactness and inter-class separability, thereby mitigating class imbalance and improving feature discriminability. Extensive experiments under multiple data split strategies demonstrate that HT-SCL consistently outperforms conventional machine learning models and single-branch deep architectures across evaluation metrics, showing stable performance even under reduced training data conditions. The results confirm the effectiveness and robustness of the proposed hybrid design and representation learning strategy. Overall, this work provides a reliable and scalable solution for music genre classification and offers practical value for real-world music streaming systems.

Authors

Publication Details

Journal
Alexandria Engineering Journal
Published
2026-04-16
DOI
https://doi.org/10.1016/j.aej.2026.03.046
Primary Topic
Music and Audio Processing
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

A hybrid transformer model with supervised contrastive loss for automatic music classification

X. Wang, Dongyun Chang, Tingting Zhuang
Alexandria Engineering Journal
Music and Audio Processing
article

A hybrid transformer model with supervised contrastive loss for automatic music classification

X. Wang, Dongyun Chang, Tingting Zhuang
article en

Abstract

With the rapid expansion of the digital music industry, streaming platforms are required to efficiently and accurately classify massive music collections to support personalized recommendation, content organization, and copyright management. However, music genre classification remains challenging due to class imbalance, limited samples in minority genres, and the inherent limitations of single-model architectures in capturing complex temporal and structural patterns. These issues restrict the robustness and discriminative capability of existing supervised deep learning approaches. To address these challenges, we propose a Hybrid Transformer with Supervised Contrastive Learning (HT-SCL) framework for automatic music classification. The proposed model integrates Transformer, Long Short-Term Memory (LSTM), and Convolutional Neural Network (CNN) branches in a parallel architecture, enabling simultaneous modeling of global dependencies, temporal dynamics, and local spectral features. In addition, a joint optimization strategy combining supervised contrastive loss and cross-entropy loss is introduced to enhance intra-class compactness and inter-class separability, thereby mitigating class imbalance and improving feature discriminability. Extensive experiments under multiple data split strategies demonstrate that HT-SCL consistently outperforms conventional machine learning models and single-branch deep architectures across evaluation metrics, showing stable performance even under reduced training data conditions. The results confirm the effectiveness and robustness of the proposed hybrid design and representation learning strategy. Overall, this work provides a reliable and scalable solution for music genre classification and offers practical value for real-world music streaming systems.

Alexandria Engineering JournalVol. 143
Openalex Percentile: Top 25%
Music and Audio Processing
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.