|
Download implementation-notes.md from SpeechAntiSpoofingBenchmarks/RawNetLite: direct link, hf CLI and curl.
- Browser
- Download file 4.52 kB
-
https://huggingface.co/SpeechAntiSpoofingBenchmarks/RawNetLite/resolve/main/implementation-notes.md
- Command line
-
hf download hf://SpeechAntiSpoofingBenchmarks/RawNetLite/implementation-notes.md
-
curl -L -o implementation-notes.md https://huggingface.co/SpeechAntiSpoofingBenchmarks/RawNetLite/resolve/main/implementation-notes.md
4.52 kB
| # RawNetLite — implementation notes | |
| Plan: `speech-spoof-bench/docs/plans/2026-11-09-thirteen-model-batch-arena-submission.md` (model #13). | |
| ## Source | |
| - github.com/adipiz99/RawNetLite @ `fcb0fe8d0f40146d110e322c00a0723ba27d5520` (MIT, `LICENSE.source`), clone in | |
| `_ckpt_dl/gh__adipiz99__RawNetLite/`. Vendored into `_net.py`: `RawNetLite.py` (ResBlock, RawNetLite) and | |
| `audio_preprocessor.py:preprocess_audio`. Read but not needed: tester.py, trainer.py, *_dataset.py, Mixed_dataset.py. | |
| - Checkpoint `models/triple_cross_domain_focal_rawnet_lite.pt` (963.8 KB, sha256 | |
| `6154d91f34f0a49d58e30bac602915f6b6853419419804be63b5274603891a9b`): plain state_dict, 61 tensors, loads with | |
| `weights_only=True`. Symlinked here. (The repo also has rawnet_lite / cross_domain(_focal) / augmented_triple variants.) | |
| - Paper: arXiv 2504.20923 (Di Pierno, Guarnera, Allegra, Battiato; IJCNN 2025 VERIMEDIA workshop). | |
| ## Wrapper (`rawnetlite.py:RawNetLite`, `_net.py`) | |
| - Preprocessing = `preprocess_audio` for 16 kHz mono input: `x / max|x|` over the whole clip, then first 48000 samples | |
| (3 s, authors' fixed length; under the 4 s cap so kept), right zero-pad. Authors' target_sr is 16 kHz → no resampling | |
| ever. Silent/empty clip: source divides by 0 (NaN) → wrapper feeds zeros. | |
| - Net input [B, 1, 48000] (DataLoader stacks the [1, 48000] tensors). Output: source applies sigmoid → P(fake) | |
| (tester.py: probs > 0.5 = fake, EER with pos_label=1; label 0 = real, 1 = fake). Wrapper returns **−logit(fake)** | |
| (fc2 output before the sigmoid, negated): identical ranking to 1 − P(fake), no saturation ties. | |
| - Strict load: `load_state_dict(strict=True)`, 0 missing / 0 unexpected, all 61 tensors used (no allow-list needed). | |
| Params **240,769** trainable (+ BN running stats). FP32, TF32 off. | |
| ## Parity / tests | |
| - `source_parity.py`: authors' `RawNetLite` (imported from the pinned clone) + `preprocess_audio` + tester.py's | |
| `model(waveforms).squeeze()` per clip vs the wrapper batched, 16 J-SPAW_LA clips + a short and a long clip: | |
| max |Δ P(fake)| 8.5e-8, max |Δ score| (vs −logit of the source P) 8.6e-7. Log: `logs_source_parity.txt`. | |
| - `test_rawnetlite.py`: peak-norm-then-crop, zero-pad, silent clip, sha256, strict load, params + eval, | |
| sigmoid(forward_logit) == forward, batch == single (atol 1e-4), determinism, scale invariance. 9 passed. | |
| ## Training data → trained_on | |
| - Paper Tables I–III: FakeOrReal 25,600 + 25,600 train; "AVSpoof2021" 6,400 real + 6,400 fake train (test: 22,616 / | |
| 25,000 disjoint); CodecFake 6,400 + 6,400 train (triple / augmented models only). The released checkpoint is the | |
| triple-domain focal model (README). | |
| - "AVSpoof2021": README links asvspoof.org/index2021.html; the paper never names a track, describes it as containing | |
| "replay attacks, TTS, and VC", and cites the ASVspoof 2019 overview (Todisco et al.) for it. ASVspoof 2021 only | |
| released evaluation data, so the training clips come from 2021 eval → ASVspoof2021_LA **and** ASVspoof2021_DF marked | |
| trained_on (track unknown). Note: their test real count 22,616 is one short of DF eval's 22,617 bona fide, but the | |
| 6,400 extra training reals rule out a DF-only pool — so the pool likely mixes tracks (PA too?). ASVspoof 2019 data | |
| cannot be excluded (citation) but is not marked — maintainer decision. | |
| - CodecFake: README links roger-tseng/CodecFake (Wu et al., VCTK-based); the paper cites Xie et al.'s Codecfake | |
| (arXiv 2405.04880, VCTK + AISHELL-3). Neither is the Arena's CD-ADD (Li et al., arXiv 2404.04904, LibriTTS-based codec | |
| TTS; provenance `CD-ADD: {parts: [train, test]}`) → no CD-ADD overlap. FakeOrReal is not an Arena set. | |
| - Eval-subset EERs with this wrapper (`subset_eer.py 2000 <DS>`, shard 0, seed 0): ASVspoof2019_LA 13.82%, | |
| ASVspoof2021_LA 20.24%, ASVspoof2021_DF 21.25% (paper AVSpoof2021 test: 19.96%). | |
| ## Sanity (PyTorch, RTX 5060 Ti idx 3) | |
| - Full J-SPAW_LA (`run_pt.sh`, run at batch_size 64 before the sweep set it to 1; batch-invariant to ~1e-6): EER | |
| **34.189%** (2397 trials, 0 skipped). Weak, as expected for this 0.24 M-param model; not inverted. | |
| ## Batch sweep (`sweep.py`, 48000-sample input) | |
| | card | result | choice | | |
| |---|---|---| | |
| | RTX 5060 Ti (idx 3), 2026-11-09, run twice (idle-ish, then shared with the LaST-Net lane) | 238–240 utt/s @1; 165–200 utt/s @8–192 (best batched 200 @64); 256 OOM | `batch_size = 1` | | |
| | RTX 4070 Ti SUPER (idx 2) | not swept (not assigned) | same 1 | | |
| ## TensorRT | |
| Not attempted (plan: no TRT for the 1 MB row). | |