The Selective Layer Summarization (SLS) classifier extracts attention-weighted features from all 24 transformer layers of
XLS-R 300M (wav2vec 2.0), then classifies bonafide vs. spoofed speech via a lightweight fully-connected head.
RawBoost (algo=3, SSI) data augmentation is applied during training.
The original pretrained checkpoints from Zhang et al. are available from:
v1 closely reproduces the paper results. v2 improves LA slightly but degrades DF and In-the-Wild due to overfitting to the LA validation domain — a well-documented cross-domain generalization problem in audio deepfake detection (
Muller et al., Interspeech 2022).
1from huggingface_hub import hf_hub_download
2
3# Download v1 checkpoint (recommended)
4checkpoint_path = hf_hub_download(
5 repo_id="sukhdeveyash/XLS-R-SLS-Deepfake-Detection",
6 filename="v1/epoch_2.pth"
7)
8
9# Download v2 checkpoint
10# checkpoint_path = hf_hub_download(
11# repo_id="sukhdeveyash/XLS-R-SLS-Deepfake-Detection",
12# filename="v2/epoch_16.pth"
13# )
1import torch
2from model import Model # from the GitHub repo
3
4device = "cuda" if torch.cuda.is_available() else "cpu"
5
6model = Model(device=device, ssl_cpkt_path="xlsr2_300m.pt")
7model.load_state_dict(torch.load(checkpoint_path, map_location=device))
8model = model.to(device)
9model.eval()
Full training and evaluation code:
GitHub Repository
See
environment.yml in the
GitHub repo for the full environment.
1@inproceedings{zhang2024audio,
2 title={Audio Deepfake Detection with XLS-R and SLS Classifier},
3 author={Zhang, Qishan and Wen, Shuangbing and Hu, Tao},
4 booktitle={Proceedings of the 32nd ACM International Conference on Multimedia},
5 year={2024},
6 publisher={ACM}
7}