awsaf49/sonics

[ICLR 2025] SONICS: Synthetic Or Not - Identifying Counterfeit Songs

Python

59

37 commits

updated May 23, 2025

See the code

README

SONICS: Synthetic Or Not - Identifying Counterfeit Songs

ICLR 2025 [Poster]

Paper Hugging Face Hugging Face Dataset Kaggle Dataset Hugging Face Demo Song Arena

This repository contains the official source code for our paper SONICS: Synthetic Or Not - Identifying Counterfeit Songs.


📌 Abstract

The recent surge in AI-generated songs presents exciting possibilities and challenges. These innovations necessitate the ability to distinguish between human-composed and synthetic songs to safeguard artistic integrity and protect human musical artistry. Existing research and datasets in fake song detection only focus on singing voice deepfake detection (SVDD), where the vocals are AI-generated but the instrumental music is sourced from real songs. However, these approaches are inadequate for detecting contemporary end-to-end artificial songs where all components (vocals, music, lyrics, and style) could be AI-generated. Additionally, existing datasets lack music-lyrics diversity, long-duration songs, and open-access fake songs. To address these gaps, we introduce SONICS, a novel dataset for end-to-end Synthetic Song Detection (SSD), comprising over 97k songs (4,751 hours) with over 49k synthetic songs from popular platforms like Suno and Udio. Furthermore, we highlight the importance of modeling long-range temporal dependencies in songs for effective authenticity detection, an aspect entirely overlooked in existing methods. To utilize long-range patterns, we introduce SpecTTTra, a novel architecture that significantly improves time and memory efficiency over conventional CNN and Transformer-based models. For long songs, our top-performing variant outperforms ViT by 8% in F1 score, is 38% faster, and uses 26% less memory, while also surpassing ConvNeXt with a 1% F1 score gain, 20% speed boost, and 67% memory reduction.


🎵 Spectro-Temporal Tokens Transformer (Spec🔱ra)

Model Architecture


🖥️ System Configuration

  • Disk Space: 150GB
  • GPU Memory: 48GB
  • RAM: 32GB
  • Python Version: 3.10
  • OS: Ubuntu 20.04
  • CUDA Version: 12.4

This is if you want to reproduce the results.

🚀 Installation

For training:

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

For inference:

pip install git+https://github.com/awsaf49/sonics.git

📂 Dataset

You can download the dataset either from Hugging Face or Kaggle.

Download from Hugging Face:

from huggingface_hub import snapshot_download

snapshot_download(repo_id="awsaf49/sonics", repo_type="dataset", local_dir="your_local_folder")

Download from Kaggle:

First, set up the Kaggle API by following this documentation.

Then, run:

kaggle datasets download -d awsaf49/sonics-dataset --unzip

Folder Structure:

├── dataset
│   ├── fake_songs
│   │   └── yyy.mp3
│   ├── real_songs.csv
│   └── fake_songs.csv

Note: This dataset contains only fake songs. For real songs, use the youtube_id from real_songs.csv to manually download them and place them inside /dataset/real_songs/ folder.

Data Split

To split it into train, val, and test set, we will need to run the following command from the parent folder

python data_split.py

Note: The real_songs.csv and fake_songs.csv contain the metadata for the songs including duration, split, etc and config file contains path of the metadata.

Note: Output files including checkpoints, model predictions will be saved in ./output/<experiment_name>/ folder.


📜 Metadata Properties

real_songs.csv

Column NameDescription
idUnique file ID
filenameName of the file
titleTitle of the song
artistArtist's name
yearRelease year
lyricsLyrics of the song
lyrics_featuresText features of lyrics extracted by LLM
durationTotal duration (seconds)
youtube_idYouTube ID of real song (not provided as mp3)
label"real" (all entries)
artist_overlapWhether train/test split contains the same artist
target0 (real songs)
skip_timeInstrumental-only duration before vocals (seconds)
no_vocalWhether the song has vocals (True/False)
splittrain/test/valid split

fake_songs.csv

Column NameDescription
idUnique file ID
filenameName of the file
titleTitle of the song
durationTotal duration (seconds)
algorithmAlgorithm used for generation
styleCharacteristics of the song style
sourceGenerated from Suno or Udio
lyrics_featuresText features of lyrics extracted by LLM
topicSong theme (e.g., Star Trek, Pokémon)
genreSong genre (e.g., salsa, grunge)
moodMood of the song (e.g., mournful, tense)
label"full fake", "half fake", "mostly fake"
target1 (fake songs)
splittrain/test/valid split

🏋️ Training

python train.py --config <path_to_config_file>

Config files are available inside /configs folder.

🔍 Testing

python test.py --config <path_to_config_file> --ckpt_path <path_to_checkpoint_file>

📊 Model Profiling

python model_profile.py --config <path_to_config_file> --batch_size 12

🏆 Model Performance

Model NameHF LinkVariantDurationf_clipt_clipF1SensitivitySpecificitySpeed (A/S)FLOPs (G)Mem. (GB)# Act. (M)# Param. (M)
sonics-spectttra-alpha-5sHFSpecTTTra-α5s130.780.690.941482.90.5617
sonics-spectttra-beta-5sHFSpecTTTra-β5s350.780.690.941521.10.2517
sonics-spectttra-gamma-5sHFSpecTTTra-γ5s570.760.660.921540.70.1217
sonics-spectttra-alpha-120sHFSpecTTTra-α120s130.970.960.994723.73.95019
sonics-spectttra-beta-120sHFSpecTTTra-β120s350.920.860.998014.02.32921
sonics-spectttra-gamma-120sHFSpecTTTra-γ120s570.880.790.999710.11.62024

🎶 Model Usage

# Install from GitHub
pip install git+https://github.com/awsaf49/sonics.git

# Load model
from sonics import HFAudioClassifier
model = HFAudioClassifier.from_pretrained("awsaf49/sonics-spectttra-gamma-5s")

🎵 Song Arena

Can you detect if a song is AI-generated or real? Find out at our 🤗 Song Arena!


📝 Citation

@inproceedings{rahman2024sonics,
        title={SONICS: Synthetic Or Not - Identifying Counterfeit Songs},
        author={Rahman, Md Awsafur and Hakim, Zaber Ibn Abdul and Sarker, Najibul Haque and Paul, Bishmoy and Fattah, Shaikh Anowarul},
        booktitle={International Conference on Learning Representations (ICLR)},
        year={2025},
      }

📜 License

This project is licensed under:

  • MIT License for code and models
  • CC BY-NC 4.0 License for the dataset

See LICENSE for details.

audio-classification
cnn
deepfake-detection
fake-song-detection
music-dataset
transformer

awsaf49/sonics

[ICLR 2025] SONICS: Synthetic Or Not - Identifying Counterfeit Songs

Python

59

37 commits

updated May 23, 2025

See the code

README

SONICS: Synthetic Or Not - Identifying Counterfeit Songs

ICLR 2025 [Poster]

Paper Hugging Face Hugging Face Dataset Kaggle Dataset Hugging Face Demo Song Arena

This repository contains the official source code for our paper SONICS: Synthetic Or Not - Identifying Counterfeit Songs.


📌 Abstract

The recent surge in AI-generated songs presents exciting possibilities and challenges. These innovations necessitate the ability to distinguish between human-composed and synthetic songs to safeguard artistic integrity and protect human musical artistry. Existing research and datasets in fake song detection only focus on singing voice deepfake detection (SVDD), where the vocals are AI-generated but the instrumental music is sourced from real songs. However, these approaches are inadequate for detecting contemporary end-to-end artificial songs where all components (vocals, music, lyrics, and style) could be AI-generated. Additionally, existing datasets lack music-lyrics diversity, long-duration songs, and open-access fake songs. To address these gaps, we introduce SONICS, a novel dataset for end-to-end Synthetic Song Detection (SSD), comprising over 97k songs (4,751 hours) with over 49k synthetic songs from popular platforms like Suno and Udio. Furthermore, we highlight the importance of modeling long-range temporal dependencies in songs for effective authenticity detection, an aspect entirely overlooked in existing methods. To utilize long-range patterns, we introduce SpecTTTra, a novel architecture that significantly improves time and memory efficiency over conventional CNN and Transformer-based models. For long songs, our top-performing variant outperforms ViT by 8% in F1 score, is 38% faster, and uses 26% less memory, while also surpassing ConvNeXt with a 1% F1 score gain, 20% speed boost, and 67% memory reduction.


🎵 Spectro-Temporal Tokens Transformer (Spec🔱ra)

Model Architecture


🖥️ System Configuration

  • Disk Space: 150GB
  • GPU Memory: 48GB
  • RAM: 32GB
  • Python Version: 3.10
  • OS: Ubuntu 20.04
  • CUDA Version: 12.4

This is if you want to reproduce the results.

🚀 Installation

For training:

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

For inference:

pip install git+https://github.com/awsaf49/sonics.git

📂 Dataset

You can download the dataset either from Hugging Face or Kaggle.

Download from Hugging Face:

from huggingface_hub import snapshot_download

snapshot_download(repo_id="awsaf49/sonics", repo_type="dataset", local_dir="your_local_folder")

Download from Kaggle:

First, set up the Kaggle API by following this documentation.

Then, run:

kaggle datasets download -d awsaf49/sonics-dataset --unzip

Folder Structure:

├── dataset
│   ├── fake_songs
│   │   └── yyy.mp3
│   ├── real_songs.csv
│   └── fake_songs.csv

Note: This dataset contains only fake songs. For real songs, use the youtube_id from real_songs.csv to manually download them and place them inside /dataset/real_songs/ folder.

Data Split

To split it into train, val, and test set, we will need to run the following command from the parent folder

python data_split.py

Note: The real_songs.csv and fake_songs.csv contain the metadata for the songs including duration, split, etc and config file contains path of the metadata.

Note: Output files including checkpoints, model predictions will be saved in ./output/<experiment_name>/ folder.


📜 Metadata Properties

real_songs.csv

Column NameDescription
idUnique file ID
filenameName of the file
titleTitle of the song
artistArtist's name
yearRelease year
lyricsLyrics of the song
lyrics_featuresText features of lyrics extracted by LLM
durationTotal duration (seconds)
youtube_idYouTube ID of real song (not provided as mp3)
label"real" (all entries)
artist_overlapWhether train/test split contains the same artist
target0 (real songs)
skip_timeInstrumental-only duration before vocals (seconds)
no_vocalWhether the song has vocals (True/False)
splittrain/test/valid split

fake_songs.csv

Column NameDescription
idUnique file ID
filenameName of the file
titleTitle of the song
durationTotal duration (seconds)
algorithmAlgorithm used for generation
styleCharacteristics of the song style
sourceGenerated from Suno or Udio
lyrics_featuresText features of lyrics extracted by LLM
topicSong theme (e.g., Star Trek, Pokémon)
genreSong genre (e.g., salsa, grunge)
moodMood of the song (e.g., mournful, tense)
label"full fake", "half fake", "mostly fake"
target1 (fake songs)
splittrain/test/valid split

🏋️ Training

python train.py --config <path_to_config_file>

Config files are available inside /configs folder.

🔍 Testing

python test.py --config <path_to_config_file> --ckpt_path <path_to_checkpoint_file>

📊 Model Profiling

python model_profile.py --config <path_to_config_file> --batch_size 12

🏆 Model Performance

Model NameHF LinkVariantDurationf_clipt_clipF1SensitivitySpecificitySpeed (A/S)FLOPs (G)Mem. (GB)# Act. (M)# Param. (M)
sonics-spectttra-alpha-5sHFSpecTTTra-α5s130.780.690.941482.90.5617
sonics-spectttra-beta-5sHFSpecTTTra-β5s350.780.690.941521.10.2517
sonics-spectttra-gamma-5sHFSpecTTTra-γ5s570.760.660.921540.70.1217
sonics-spectttra-alpha-120sHFSpecTTTra-α120s130.970.960.994723.73.95019
sonics-spectttra-beta-120sHFSpecTTTra-β120s350.920.860.998014.02.32921
sonics-spectttra-gamma-120sHFSpecTTTra-γ120s570.880.790.999710.11.62024

🎶 Model Usage

# Install from GitHub
pip install git+https://github.com/awsaf49/sonics.git

# Load model
from sonics import HFAudioClassifier
model = HFAudioClassifier.from_pretrained("awsaf49/sonics-spectttra-gamma-5s")

🎵 Song Arena

Can you detect if a song is AI-generated or real? Find out at our 🤗 Song Arena!


📝 Citation

@inproceedings{rahman2024sonics,
        title={SONICS: Synthetic Or Not - Identifying Counterfeit Songs},
        author={Rahman, Md Awsafur and Hakim, Zaber Ibn Abdul and Sarker, Najibul Haque and Paul, Bishmoy and Fattah, Shaikh Anowarul},
        booktitle={International Conference on Learning Representations (ICLR)},
        year={2025},
      }

📜 License

This project is licensed under:

  • MIT License for code and models
  • CC BY-NC 4.0 License for the dataset

See LICENSE for details.

audio-classification
cnn
deepfake-detection
fake-song-detection
music-dataset
transformer

Languages

Python

100.0%