RawBMamba
RawBMamba: End-to-End Bidirectional State Space Model for Audio Deepfake Detection (Chen et al., Interspeech 2024). A sinc/Res front-end feeds a bidirectional Mamba (selective state-space) backbone with attention pooling and an angular-margin (A-softmax) head, operating directly on the raw waveform. The model returns a score where higher = more bona fide.
- Original code: https://github.com/cyjie429/RawBMamba
- Paper: https://arxiv.org/abs/2406.06086
- Parameters: 720,180 (0.72 M)
- Checkpoint:
rawbmamba_best.pt(the authors' released pretrained model)
This repo is self-contained for inference: the vendored mamba_ssm backbone and
network are in mamba_ssm/ + _net.py, and the exact
wrapper used to produce the Arena scores is in rawbmamba.py.
Arena results
EER% (lower is better); EmoSpoofTTS and LRLspoof are spoof-only and use 1-SRR% at the model's DeepVoice EER threshold. Per-dataset scores are under .eval_results/.
Architecture & inference notes
- Input: raw float32 mono @ 16 kHz, deterministic first-64600-sample (β4 s) window (tile-repeat if shorter, no random crop). FP32.
- Score =
cos_theta[:, 1] - cos_theta[:, 0](the AngleLinear head output the repo's evaluation uses). - Selective-scan path: the vendored
mamba_ssmrequires thecausal_conv1dandselective_scan_cudaCUDA extensions for its fused fast path. We make those optional and run the pure-PyTorch reference selective-scan (use_fast_pathoff,fused_add_normoff) β numerically faithful to the fused kernels and, importantly, traceable for ONNX/TensorRT export.
ONNX / TensorRT
ONNX export + drop-in TensorRT inference class in
trt_rawbmamba.py (RawBMambaTRT). Export required making
the CUDA kernels optional, replacing the triton RMSNorm with a pure-PyTorch
equivalent, and precomputing the AngleLinear renormalized weight (avoids the
unsupported aten::renorm). The ONNX is uploaded here; the GPU-arch-specific
engine is built locally (sidecar trt_rawbmamba.json).
Credits
All model design and weights are the work of the original RawBMamba authors (https://github.com/cyjie429/RawBMamba). This repository only packages their released checkpoint for the Speech Anti-Spoofing Arena.
@inproceedings{chen2024rawbmamba,
title = {RawBMamba: End-to-End Bidirectional State Space Model for Audio Deepfake Detection},
author = {Chen, Yujie and Yi, Jiangyan and Tao, Jianhua and others},
booktitle = {Interspeech 2024},
year = {2024}
}