korallll's picture
Wrapper code (speech-spoof-bench)
5182c89 verified
Raw History Blame Contribute Delete
3.51 kB
system:
name: "DeepFense-CodecFake-W2V2-MLP"
slug: "deepfense-codecfake-w2v2-mlp"
description: >
DeepFense (Kheir et al., 2026) CodecFake recipe: a fully fine-tuned wav2vec 2.0
XLS-R 300M front-end (last transformer layer, features_only) followed by an MLP
back-end (Linear 1024->128, LayerNorm, ReLU, mean pooling over time) and a 2-way
linear CrossEntropy head. Trained on the Codecfake corpus (Xie et al.,
AISHELL-3/VCTK-based codec re-synthesis) without data augmentation, seed 42; the
released best_model.pth (epoch 2) as is. Input as the DeepFense eval pipeline:
raw float waveform (no normalisation), first 64000 samples (4 s), shorter clips
repeat-padded. score = logit(bonafide) - logit(spoof); FP32.
code: "https://github.com/Yaselley/deepfense-framework/tree/3f2fe1146c48ea4bacc480dd96d806b6c72c09cf"
checkpoint: "https://huggingface.co/DeepFense/CodecFake_Wav2Vec2_MLP_NoAug_Seed42/blob/c08bd2125c83e6c8fdc64566bfbfda18dff4dfb4/best_model.pth"
params_millions: 317.522306 # counted from the loaded net (317,522,306 parameters incl. the unused XLS-R quantizer/project_q/final_proj, 2026-11-07)
paper:
arxiv_id: "2604.08450"
url: "https://arxiv.org/abs/2604.08450"
bibtex: |
@article{kheir2026deepfense,
title={DeepFense: A Unified, Modular, and Extensible Framework for Robust Deepfake Audio Detection},
author={Kheir, Yassine El and Das, Arnab and Xiao, Yixuan and Wang, Xin and Kallel, Feidi and Erdogan, Enes Erdem and Vu, Ngoc Thang and Polzehl, Tim and Moeller, Sebastian},
journal={arXiv preprint arXiv:2604.08450},
year={2026}
}
# trained_on omitted: Codecfake (Xie et al.) is not an Arena dataset.
notes: >
DeepFense-CodecFake-W2V2-MLP = HF DeepFense/CodecFake_Wav2Vec2_MLP_NoAug_Seed42 @
c08bd2125c83e6c8fdc64566bfbfda18dff4dfb4, best_model.pth (sha256
1d4bf44afd0f7e887266c8dc49875b0ddb60a07fb16279fa2d56598519ea3c1a; a training checkpoint
with model_state + Adam optimizer_state, epoch 2, step 46298). The HF repo states no weight
license, so the weights are linked, not re-hosted; the wrapper loads only model_state, saved
unchanged as model_state.safetensors (sha256
5c97bd4ae3a2075aa8df309bde8b7dd7f9ce540a50df969d4ff0ba7a74a560a5, 435 fp32 tensors).
Code: Yaselley/deepfense-framework @ 3f2fe11 (Apache-2.0) + the checkpoint's config.yaml
(StandardDetector: wav2vec2 fairseq frontend on xlsr2_300m.pt, MLP backend projection [128],
layer norm, ReLU, mean pooling; CrossEntropy n_classes 2; label_map bonafide=1, spoof=0).
XLS-R 300M is the fairseq Wav2Vec2Model built from the xlsr2_300m.pt model config; all 435
checkpoint tensors load strictly (the 7 pre-training quantizer/project_q/final_proj tensors
are unused on the features_only path). Eval preprocessing = StandardDataset + pad: soundfile
float mono, first 64000 samples, np.tile repeat-pad, no normalisation; no resampling; FP32.
Score = logit1 - logit0 (higher = bona fide). The authors' test.py EER uses get_score =
logit1 only (a different, non-monotone-equivalent score); see implementation-notes.md.
Verified against the authors' ModularDetector + fairseq_local loader on 12 clips: max |d logits|
4.8e-6. Training: Codecfake, no augmentation, seed 42. Self-reported EER (DeepFense
deepfense-results Space): Codecfake 10.71, In-the-Wild 8.10, ASVspoof2019 LA 4.15,
ASVspoof2021 DF 6.10, ASVspoof2021 LA 15.46, ASVspoof5 29.93, ODSS 11.51, HABLA 7.82,
ADD22 track 3 7.48.