voice-deepfake-synthesis-detector
synthetic speech and voice deepfake detector
2 min readupdated
The model detects whether an audio recording features a live human voice or speech generated using text-to-speech (TTS) and voice conversion. It is built on the Facebook wav2vec 2.0 XLS-R 300M encoder, fine-tuned end-to-end within the StandardDetector architecture from the DeepFense framework. It takes 4-second mono audio fragments sampled at 16 kHz as input and outputs two logits (probability scores for real speech and spoofing). This tool is useful for developers of anti-fraud systems, moderators, and audio security researchers.
Key features
- StandardDetector architecture (DeepFense) with an XLS-R 300M encoder and an MLP head (1024 → 128) using temporal pooling.
- Processes 4-second windows at 16 kHz (64,000 samples; shorter clips are padded by repeating).
- Trained on the ASVspoof 5 dataset, selecting the best checkpoint at epoch 3 without data augmentation.
- Weights are saved in the safe format
asv5-300m-epoch3-model.pthand loaded viatorch.load(..., weights_only=True).
What you can do
- Integrate it into call or voice message verification pipelines for initial TTS spoof filtering alongside watermark and speaker-recording detectors.
- Use it as a baseline classifier in research projects focused on anti-spoofing and voice system vulnerability assessment.
Example
import torch
# Загрузка словаря весов модели (428 тензоров)
checkpoint = torch.load("asv5-300m-epoch3-model.pth", weights_only=True)
state_dict = checkpoint["model_state"]
# Разница логитов используется как логарифм отношения правдоподобия:
# score = logit(bona_fide) - logit(spoof)Read more
DetailsTraining: ASVspoof 5 dataset (ODC-By 1.0 license), Adam optimizer (lr 1e-6, batch 32, seed 42) on an AMD Instinct GPU using ROCm.
Output: index 1 is bona fide (real speech), index 0 is spoof (synthetic).
Limitations: The model is not a certified security tool and was trained only on attacks from ASVspoof 5—new voice cloning systems may not be recognized.
Calibration: Scores are uncalibrated (default threshold is 0); calibration on your own data is required before production deployment.










Comments