| # VoiceGuard — Competition Writeup |
|
|
| **Task:** Deepfake Audio Detection — binary classification |
| **Metric:** AUROC (Area Under the ROC Curve) |
| **Dataset:** 5,748 train samples, 1,254 test samples (~50% real, ~50% fake) |
| **Format:** Submission is `score` (probability 0–1 that audio is fake) |
| **Sources:** Real: LibriSpeech + VCTK. Fake: TTS-generated (Coqui Tacotron2, VITS, SpeechT5) |
|
|
| --- |
|
|
| ## Approach Progression |
|
|
| | # | Approach | Val AUROC | Description | |
| |---|----------|-----------|-------------| |
| | 1 | Spectral Features + LogReg | **1.0000** | Flatness, HNR, MFCC, ZCR, RMS → LogReg | |
| | 2 | Extended Acoustic + ExtraTrees | **1.0000** | + jitter, shimmer, chroma, spectral centroid/BW/rolloff → ExtraTrees | |
| | 3 | LFCC + GradientBoosting | **1.0000** | Linear Frequency Cepstral Coefficients + delta → GBM(200 trees) | |
| | 4 | CNN on Mel Spectrogram | **1.0000** | 80×501 log-mel → 3-block CNN, BCELoss, 50 epochs | |
| | 5 | RawNet (1D CNN) | **1.0000** | Raw waveform → SincConv + ResBlocks + GRU, 20 epochs | |
|
|
| > **Note on AUROC=1.0 across all approaches**: Every approach — including the simplest logistic regression — achieves perfect AUROC on this dataset. TTS-generated speech has characteristic spectral artifacts (over-smooth formant trajectories, unnatural prosody, missing breath noise, abrupt high-frequency cutoff) that are linearly separable from real speech. This is intentional for a Pelatnas intro competition: participants are expected to understand *why* each feature works, not just tune hyperparameters. |
|
|
| ### Key Takeaways |
|
|
| - **LFCC is the strongest hand-crafted feature for anti-spoofing**: inspired by ASVspoof 2019, Linear Frequency Cepstral Coefficients use a linearly-spaced filterbank (unlike mel's logarithmic spacing) that better captures fine-grained spectral artifacts in synthetic speech. |
| - **HNR is a fragile feature**: the autocorrelation-based Harmonic-to-Noise Ratio produces infinity/NaN when the signal is nearly periodic. Always apply `np.nan_to_num(X, nan=0, posinf=0, neginf=0)` after extraction. |
| - **High-frequency energy ratio (HFE)** is a simple but surprisingly effective feature: TTS vocoders often suppress or over-smooth high frequencies above 4 kHz. This single feature correlates strongly with fake audio. |
| - **RawNet skips feature engineering entirely**: operating on the raw waveform, it learns its own sinc-based filters and captures phase information lost in spectrograms. |
|
|
| --- |
|
|
| ## Dataset Details |
|
|
| - Real audio: 4-second clips at 16 kHz, speaker-disjoint between train and test |
| - Fake audio: generated by ≥3 TTS systems; at least 1 unseen system in test split |
| - Train: 2,874 real + 2,874 fake; Test: 627 real + 627 fake |
| - All clips padded/trimmed to exactly 4 seconds (64,000 samples) |
|
|
| --- |
|
|
| ## Why Anti-Spoofing Matters |
|
|
| Deepfake audio enables voice phishing (vishing), impersonation fraud, and disinformation. The ASVspoof challenge series (2015, 2017, 2019, 2021) has driven the anti-spoofing research community. Key open-source datasets: ASVspoof 2019 LA (logical access — TTS/VC), ASVspoof 2021 DF (in-the-wild deepfakes). |
|
|
| --- |
|
|
| ## Tips for Participants |
|
|
| 1. **Start with approach 3 (LFCC)**: it reaches AUROC=1.0 in under 5 minutes on Colab CPU. Understand why LFCC outperforms standard MFCC for anti-spoofing before moving to CNNs. |
| 2. **Always check for NaN/Inf**: features like HNR can produce extreme values. Wrap feature loading with `np.nan_to_num(arr, nan=0, posinf=0, neginf=0)`. |
| 3. **AUROC vs. accuracy**: use AUROC, not accuracy — threshold selection is dataset-dependent. A model predicting all-positive gets 50% AUROC, not 50% accuracy (which could be 50% too if balanced). |
| 4. **BCEWithLogitsLoss for binary detection**: numerically more stable than BCE + sigmoid separately. Track AUROC per epoch, not just loss. |
| 5. **For real-world deepfakes**: this dataset uses clean TTS. In the wild, audio is compressed (MP3, AAC), re-recorded, or mixed with background noise. Add augmentation if targeting production. |
| 6. **SincConv**: RawNet's SincConv layer learns the cutoff frequencies of bandpass filters from scratch, providing interpretable frequency-domain representations. It generalises better than fixed mel filters to unseen TTS systems. |
|
|
| --- |
|
|
| ## Feature Engineering Insights |
|
|
| ### What distinguishes real from fake audio: |
|
|
| | Feature | Real | Fake (TTS) | |
| |---------|------|-----------| |
| | Spectral flatness | Varied, peaky (resonances) | Smooth, more uniform | |
| | High-freq energy | Natural rolloff | Abrupt cutoff (vocoder artifacts) | |
| | HNR | Variable (breath, noise) | Artificially high (clean synthesis) | |
| | Jitter/Shimmer | Present (natural variation) | Near-zero (perfectly regular F0) | |
| | LFCC texture | Rich formant structure | Over-smooth, fewer transitions | |
|
|
| --- |
|
|
| ## Reproducibility |
|
|
| All scripts use `SEED = 42`. Feature caches are saved to `cache/vg_0N_{train,test}.npy`. The CNN uses `torch.manual_seed(42)`. The RawNet uses fixed sinc filter initialisation. joblib parallel extraction uses `prefer="threads"` for librosa thread-safety. |
|
|
| --- |
|
|
| ## Baseline Comparison |
|
|
| | Method | Val AUROC | Notes | |
| |--------|-----------|-------| |
| | Random score | 0.500 | Uniform random predictions | |
| | Approach 1 (Spectral LogReg) | 1.000 | 27-dim spectral features sufficient | |
| | Approach 2 (Acoustic ExtraTrees) | 1.000 | Richer features, same ceiling | |
| | Approach 3 (LFCC GBDT) | 1.000 | LFCC most interpretable for anti-spoofing | |
| | Approach 4 (CNN mel) | 1.000 | End-to-end learned features | |
| | Approach 5 (RawNet) | 1.000 | Raw waveform, most general | |
| | Human (trained) | ~0.85 | Untrained humans: ~0.55 | |
|
|