This is a brief guide to my project AIRealNet-Audio: a minimalist, production-ready audio deepfake detector built on Wav2Vec. It is small enough to understand in one sitting, yet strong enough to keep equal error rates well under 6% across a range of hard evaluation sets.
The entire design is optimized for one stubborn failure mode I kept seeing in public detectors: models quietly learn to cheat by looking at the length of the embedding vector instead of the actual acoustic content. I decided to kill that shortcut completely. The result is a dual L1 unit-norm architecture that forces every feature onto the hypersphere twice—once before the projector and once before the classification head. Only direction remains. I think it is beautiful 🥹.
Dual-Hypersphere Constrained Wav2Vec for Real vs AI Speech —
Links & Resources
- Model: AIRealNet-Audio
- Live Demo: Hugging Face Space
- Previous work: AIRealNet (the image counterpart that started this journey)
The problem I kept seeing
Most audio deepfake detectors work surprisingly well on paper and then quietly fall apart in the wild. When I dug into the embeddings I noticed the same pattern again and again: synthetic speech tends to live in a particular region and has a characteristic vector magnitude. Models quickly learn the cheap heuristic—“if the embedding is this long, call it fake”—instead of learning genuine synthesis artifacts.
That is the exact failure mode GenD tried to address with a single L1 normalization onto the unit hypersphere. I pushed the idea one step further.
Dual L1 unit-norm
The architecture is deliberately simple:
- Wav2Vec 2.0 encoder at 16 kHz → frame-level features
[T, 768] - Mean-pool → L1-normalize → project to 256 dimensions
- L1-normalize the 256-d vector again
- Single linear head → 2 logits
Because every vector is forced onto the unit hypersphere twice, magnitude is completely removed as a usable signal. The classifier is left with only angular (directional) information. No more length shortcuts. No more region-specific clustering cheats.
When I trained without the dual normalization I saw the classic early-peak-then-collapse curve. With the dual-hypersphere constraint the opposite happens: steady upward trend in both accuracy and loss, even after many thousands of steps.
Training data & behavior
- AI speech from >100 different TTS / voice-cloning systems
- Real human speech from varied recording conditions
- Aggressive on-the-fly augmentations (codecs, bitrates, noise)
- Balanced eval and development sets for monitoring
The model operates on fixed 12-second chunks. Very short utterances need padding or repetition. Default decision threshold is 0.5 (tune it for your domain).
After only two epochs we already sit at ~0.99 accuracy on the held-out sets, and subsequent checkpoints keep improving.
Performance snapshot
| Evaluation Dataset | EER (%) |
|---|---|
| ASVspoof5 | 1.21 |
| Voxness | 1.48 |
| Malaad | 2.11 |
| ASVspoof2019 DF | 3.14 |
| In-the-Wild | 3.64 |
(We dropped files shorter than 3 s because the model is trained on 12-second windows.)
These numbers look strong on controlled sets. Real-world performance still depends on the generators and acoustic conditions you actually meet in production—always calibrate the threshold on data that matches your target domain.
Quick start
from transformers import pipeline
pipe = pipeline(
"audio-classification",
model="Modotte/AIRealNet-Audio",
trust_remote_code=True
)
result = pipe("path/or/url/to/audio.wav")
print(result)
Typical output:
[
{'score': 0.9979, 'label': 'AIVoice'},
{'score': 0.0021, 'label': 'HumanVoice'}
]
AIVoice→ AI-generated / spoofHumanVoice→ real human speech
For production: resample to 16 kHz mono, cut into 12-second chunks, then aggregate the scores however you like.
Limitations (honest ones)
- Very short clips (< ~3–4 s) need careful handling.
- Nano-edits and highly adversarial modifications remain hard.
- Completely unseen generators or extreme telephony distortion can still hurt.
- This is a probabilistic detector. Do not treat it as sole evidence in high-stakes forensic or legal settings.
Why I built it this way
I wanted the audio counterpart to AIRealNet—the same philosophy of removing the easy cheats so the model is forced to learn something real. Dual hypersphere normalization is simple, almost embarrassingly so, yet it removes an entire class of failure modes that keep showing up in public detectors.
The code is open, the model is on Hugging Face, and the Space is live. If you try it on your own data and notice something interesting (or something that breaks), I’d love to hear about it.
Citation
@misc{Modotte_AIRealNet_Audio_2025,
title = {AIRealNet-Audio: Dual-Hypersphere Constrained Wav2Vec for Detecting AI-Generated vs Real Speech},
author = {Parvesh Rawal},
year = {2025},
url = {https://huggingface.co/Modotte/AIRealNet-Audio}
}
Huge thanks to Sujal for running all the evaluations.