Music Genre Classification using Large Language Models

Mohamed El Amine Meguenani, Alceu de Souza Britto, Alessandro L. Koerich2024

TL;DR

This paper explores the potential of large language models (LLMs), specifically audio-focused ones like WavLM, HuBERT, and wav2vec 2.0, for zero-shot music genre classification. While LLMs show promise, the Audio Spectrogram Transformer (AST) achieved the highest accuracy, suggesting that attention-based architectures are currently leading the pack in this domain.

What Problem Does This Paper Address?

The ever-growing digital music libraries necessitate efficient ways to organize, search, and understand music. Music Genre Classification (MGC) is a key task in Music Information Retrieval (MIR) that helps with this organization and facilitates music discovery. However, MGC is challenging due to the subtle acoustic characteristics, cultural subjectivity, and the need to infer genre from sound alone. Traditional methods relied on handcrafted features and expert knowledge, but deep learning has enabled automatic feature extraction. This paper investigates whether recent advancements in audio-focused LLMs, designed for speech processing, can be effectively adapted for MGC, particularly in a "zero-shot" setting where models are not explicitly trained on music genre data.

Methods

The core of the proposed approach involves using pre-trained audio LLMs as feature extractors. The audio signal is segmented into 20ms chunks with a 25ms stride. These segments are then processed by the LLM's feature encoder to generate feature vectors. These vectors are fed into a simple two-layer perceptron classification head, which is trained for multi-class classification. During inference, predictions from individual segments are aggregated (e.g., using majority voting) to produce a final genre prediction for the entire track.

The study compares three prominent audio LLMs:

  • HuBERT: A self-supervised model for speech representation learning.
  • wav2vec 2.0: Another self-supervised model that processes raw audio waveforms and quantizes representations.
  • WavLM: A model built upon HuBERT, designed for comprehensive speech processing, incorporating noise reduction and gated relative position bias.

The researchers also compare these LLMs against traditional deep learning architectures, including 1D and 2D Convolutional Neural Networks (CNNs) and the Audio Spectrogram Transformer (AST). The AST is highlighted as a transformer-based model that adapts vision transformer architectures to audio spectrograms, using self-attention mechanisms.

Datasets

The primary dataset used for evaluation is the GTzan dataset. This dataset contains 1,000 30-second music excerpts across ten genres (classical, rock, blues, reggae, metal, disco, country, jazz, hip-hop, and pop). The authors note that GTzan, despite its popularity, has known issues with duplicates, incorrect labels, and distortions. For compatibility with the audio LLMs, the GTzan dataset was resampled to 16 kHz. The paper also mentions that the LLMs themselves were pre-trained on large datasets of speech data (e.g., LibriSpeech, Libri-Light, GigaSpeech, VoxPopuli), but crucially, they were not fine-tuned on music data for this study, enabling the zero-shot evaluation.

Key Insights and Ideas

  • LLMs for Music: A Promising Frontier: The study demonstrates that audio LLMs, primarily developed for speech, can indeed extract meaningful features for music genre classification, even without specific music genre training.
  • Layer Matters: For LLMs, the performance on MGC varied significantly across different layers. Generally, earlier layers showed better performance, suggesting they capture more fundamental acoustic features relevant to genre, while deeper layers might focus on speech-specific linguistic structures.
  • AST Leads the Pack: The Audio Spectrogram Transformer (AST) emerged as the top performer, outperforming all LLM variants and traditional CNNs. This highlights the continued strength of attention-based architectures for audio processing tasks.
  • Zero-Shot vs. Fine-Tuning: The zero-shot approach provides a valuable baseline for understanding the inherent generalization capabilities of these models. However, the authors suggest that fine-tuning LLMs on music data could further boost their performance.

Key Results

  • The Audio Spectrogram Transformer (AST) achieved the highest overall accuracy, reaching 85.5% after temporal aggregation on the GTzan dataset.
  • Among the LLMs, WavLM Large showed the best performance, achieving 75.5% accuracy on segments and 84.6% after aggregation.
  • The study found that for LLMs, performance generally peaked in earlier layers (e.g., 5th and 11th layers for WavLM Large) and decreased in deeper layers.
  • The proposed LLM-based approach achieved accuracies of 84.6% (WavLM), 81.2% (wav2vec 2.0), and 81.4% (HuBERT) after aggregation.
  • Transformer-based models (AST) and LLMs consistently outperformed traditional 1D and 2D CNN approaches.

Limitations and Future Work

  • Dataset Limitations: The GTzan dataset, while widely used, has known integrity issues (duplicates, incorrect labels) and limited genre diversity. This can affect the generalizability of the models.
  • Zero-Shot vs. Fine-Tuning: The zero-shot evaluation provides a baseline but doesn't fully exploit the potential of LLMs. Future work could involve fine-tuning these models on music data to improve performance.
  • Model Generalization: Variability in audio recordings and potential dataset biases might impact the models' ability to generalize to unseen music.

Future research directions suggested include:

  • Implementing cross-attention mechanisms between different models.
  • Utilizing larger and more diverse datasets (e.g., Free Music Archive, ISMIR2004).
  • Exploring the impact of fine-tuning audio LLMs and transformers on music data for enhanced genre classification and other MIR tasks like music recommendation or mood classification.

Summary updated

BibTeX
@misc{meguenani2024music,
  author = {Mohamed El Amine Meguenani and Alceu de Souza Britto and Alessandro L. Koerich},
  title = {{Music Genre Classification using Large Language Models}},
  year = {2024},
  eprint = {2410.08321},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.08321},
}
Figure