Model Card: deepfake-audio-detector-wav2vec2

Model Description

  • Repository: https://huggingface.co/Bgeorge/deepfake-audio-detector-wav2vec2
  • Author: Bgeorge
  • License: Please select (Apache-2.0 or MIT recommended β€” the base model inherits Meta's wav2vec 2.0 license terms)
  • Architecture: Wav2Vec2ForSequenceClassification (wav2vec 2.0 backbone, sequence classification head with 2 labels)
  • Language(s): Language-independent β€” operates on raw audio waveform (16 kHz), not text. Trained and evaluated on English speech; generalization to other languages is not guaranteed.
  • Task: Binary audio deepfake detection (real vs. synthetic/TTS-generated speech)

Intended Use

Primary use cases:

  • Detecting AI-generated (TTS / voice-cloning) speech in audio files
  • Moderation pipelines for user-uploaded audio
  • Research on audio deepfake detection

Out of scope:

  • Real-time / low-latency streaming detection (model processes fixed 1-second windows)
  • Speaker verification or identification
  • Detection of manipulated (edited) real recordings β€” the model distinguishes fully synthetic speech from genuine speech
  • Use as sole, definitive evidence in legal or forensic settings

Training Data

  • Dataset: adarshsingh0903/audio-deepfake-detection-dataset (Kaggle)
  • Structure: folder real_samples β†’ label 0 (REAL); all remaining folders (synthetic/TTS samples) β†’ label 1 (FAKE)
  • Split: 80/20 train/test, seed 42 β†’ 3,557 training examples / 890 test examples

Training Procedure

Fine-tuned from MelodyMachine/Deepfake-audio-detection-V2.

Preprocessing:

  • Resampling to 16 kHz with librosa (audioread/ffmpeg backend)
  • Fixed 1-second windows: max_length=16000, truncation + zero padding
  • Feature extraction with Wav2Vec2FeatureExtractor

Hyperparameters:

Parameter Value
Epochs 8
Per-device batch size 8
Precision fp16 (mixed precision)
Evaluation strategy per epoch
Optimizer default (AdamW, Trainer)
Hardware NVIDIA Tesla P40 24GB, cuDNN disabled (Pascal compatibility)
Training time ~485 s (1,192 steps)

Evaluation Results

Test set: 890 examples

Metric Real Fake
Precision 0.98 1.00
Recall 1.00 0.98
F1-score 0.99 0.99
  • Accuracy: 0.99
  • Macro / weighted F1: 0.99
  • Final validation loss (epoch 8): 0.0467
  • Validation accuracy trajectory: 0.9506 (ep. 1) β†’ 0.9910 (ep. 8)

Quickstart

import torch
import librosa
from transformers import AutoFeatureExtractor, AutoModelForAudioClassification

MODEL_ID = "Bgeorge/deepfake-audio-detector-wav2vec2"
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
LABELS = ["REAL", "FAKE/DEEPFAKE"]

processor = AutoFeatureExtractor.from_pretrained(MODEL_ID)
model = AutoModelForAudioClassification.from_pretrained(MODEL_ID).to(DEVICE)
model.eval()

def predict(audio_path: str) -> str:
    speech, _ = librosa.load(audio_path, sr=16000)
    inputs = processor(
        speech,
        sampling_rate=16000,
        max_length=16000,
        truncation=True,
        padding="max_length",
        return_tensors="pt",
    )
    inputs = {k: v.to(DEVICE) for k, v in inputs.items()}
    with torch.no_grad():
        logits = model(**inputs).logits
        scores = torch.nn.functional.softmax(logits, dim=-1)
        prediction = torch.argmax(logits, dim=-1).item()
    return f"{LABELS[prediction]} ({scores[0][prediction].item():.2%})"

print(predict("example.wav"))

Limitations

  • 1-second window: predictions are based on the first second of audio; long files are truncated, so deepfake cues appearing later in the recording are ignored.
  • Dataset bias: evaluation is based on a single Kaggle dataset; performance on unseen TTS systems (e.g., newer vocoders or commercial voice cloning products) has not been measured and may be substantially lower.
  • Adversarial robustness: the model has not been adversarially tested; post-processing (re-encoding, noise addition, pitch shifting) may evade detection.
  • Confidence miscalibration: softmax outputs near 100% on in-distribution data do not translate to calibrated probabilities on out-of-distribution audio.
  • Class semantics: "FAKE" covers fully synthetic speech; partially manipulated recordings (e.g., splicing of real audio) were not part of the training distribution.

Ethical Considerations

  • Detection scores are probabilistic and can be wrong; they should support, not replace, human review in high-stakes decisions (journalism, legal, hiring).
  • False accusations of synthetic speech can cause real harm; always report results with uncertainty.
  • The model may perform unevenly across speakers, languages, and recording conditions β€” avoid deploying it as the sole automated decision-maker.

Citation

@misc{bgeorge2025deepfakeaudio,
  author = {Bgeorge, Provalue},
  title = {deepfake-audio-detector-wav2vec2},
  year = {2026},
  publisher = {Hugging Face},
  url = {https://huggingface.co/Bgeorge/deepfake-audio-detector-wav2vec2}
}

Base architecture: Baevski et al., wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations, NeurIPS 2020.

Downloads last month
119
Safetensors
Model size
94.6M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using Bgeorge/deepfake-audio-detector-wav2vec2 1