File size: 7,687 Bytes
53c47af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# NII-SLT26-XLSR-FC β€” implementation notes

Plan: `speech-spoof-bench/docs/plans/2026-11-09-thirteen-model-batch-arena-submission.md` (model #4).
Sibling: `../NII-SLT26-Whisper-FC/` (#5, same code path, Whisper encoder).

## Source
- Code: github.com/nii-yamagishilab/AntiDeepfake-AudioLLM @ `2d445b525bb52518448b353fe1fee51d5f815af9` (BSD-3):
  `models/build_encoder_fc.py` (`EncoderClassificationModel`, `EncoderFCCollator`), `models/audio_encoders.py`
  (`TransformersAudioEncoder`), `models/output_heads.py` (`ClassificationHead`), `eval/score_protocols.py`,
  `eval/eval_utils.py`, `dataio/audio_loading.py`. Paper arXiv 2610.17617 (IEEE SLT 2026).
- Weights: HF nii-yamagishilab/slt2026-checkpoints @ `ae9d2bc72b670e49513f5bd125bf679095bf4b92`,
  `checkpoints.tar.gz` β†’ `xlsr-fc.ckpt` (3.79 GB, sha256 `0caa8335c5e5504d114f24415d20c8f0082a5b96c3b9c81dd3fe913d7db8a5bc`).
  CC BY-NC 4.0 β†’ re-hosted (the safetensors, not the pickle).
- Pickle inspection (`pickletools.genops` over `model/data.pkl`, no execution): globals only
  `collections.OrderedDict`, `torch._utils._rebuild_tensor_v2`, `torch.FloatStorage`, `builtins.set` β†’
  `torch.load(weights_only=True, mmap=True)` works, no allow-list unpickler needed.
- Contents: `{step 79205, epoch 5, model_state_dict (424 fp32 tensors, 315,440,770 params), optimizer_state_dict
  (AdamW, 424 states), config}`. Config: encoder facebook/wav2vec2-xls-r-300m, `model.family: xlsr_fc` (a pre-release
  name; the public code dispatches `encoder_fc`), labels real=0 / fake=1, head classification dropout 0.1,
  `precision: bf16` (training autocast), `eval_precision: fp32`, seed 2, protocol
  `CompSpoofV2/AnyFakeNoOriginal` (train/valid/test csv).
- `extract_ckpt.py` (run with `python -I`): sha256 of the ckpt, weights_only load, asserts key set / tensor counts,
  writes `nii_slt26_xlsr_fc.safetensors` (model_state_dict unchanged, 424 tensors, sha256
  `3dc2417582c6cac8287d7bdfe6fb5224de001dab19f46d38409e76dc2820c47a`) and `nii_slt26_xlsr_fc.json` (labels/ids,
  encoder name, head, precision, step, key counts, provenance). Files live in
  `_ckpt_dl/nii-yamagishilab__slt2026-checkpoints/extracted/`, symlinked here. The wrapper reads only these two.
- Base config vendored: `xlsr300m_config.json` / `xlsr300m_preprocessor_config.json` (facebook/wav2vec2-xls-r-300m @
  `1a640f32ac3e39899438a2931f9924c02f080a54`). `Wav2Vec2Model(config)` β€” no Hub download, no pretrained weights.

## Wrapper (`nii_slt26_xlsr_fc.py:NIISLT26XLSRFC`, `_net.py:XLSRFCNet`)
- Net = `EncoderClassificationModel` at eval: `Wav2Vec2Model(x).last_hidden_state` β†’ mean over all frames β†’
  Dropout (id) β†’ `Linear(1024, 2)`. Module names = checkpoint layout (`encoder.model.*`, `classifier.*`).
- Preprocessing = their collator: `Wav2Vec2FeatureExtractor(do_normalize=True)` per clip,
  `(x - mean) / sqrt(var + 1e-7)` in float32 numpy (unit test: bit-identical to the extractor), applied AFTER the
  Arena 4 s cap (first 64600 samples, repeat-pad shorter). No attention mask (all inputs are 64600 β†’ the
  processor's mask is all ones; equivalence checked by source parity, which passes the mask). Their loader decodes
  via ffmpeg to int16/32768 β€” identical to the runner's float32 for 16-bit sources.
- Deviation: the authors score whole clips (random 30 s crop if longer, `dataio/audio_loading.py`); Arena 4 s cap.
- Score: `score_protocols.py` (no `--components`) gives `Score_real βˆ’ Score_fake` on the softmax score vector; we
  return `logit[real] βˆ’ logit[fake]` (`p_real βˆ’ p_fake = tanh(d/2)`, same ranking, no saturation ties).
- Precision FP32 (their `eval_precision: fp32`; `Brain.evaluate` uses no autocast); TF32 off.
- Strict load: all 424 tensors used, `load_state_dict(strict=True)` 0/0. Params 315,440,770 loaded;
  **315,439,746 forward path** (minus `masked_spec_embed`, 1024, training-only SpecAugment) β†’ meta.

## Source parity (`source_parity.py SRC_DIR ORIG_CKPT`, `logs_source_parity.txt`)
Authors' `build_encoder_fc_components` (AutoModel/AutoProcessor `from_pretrained` patched to the pinned local
configs) + original ckpt `model_state_dict` (`weights_only`, strict=False as `util/checkpointing.py`: 0 missing / 0
unexpected) + `EncoderFCCollator.prepare_batch` + `ClassificationHead`, on 16 J-SPAW_LA clips + a 20000- and a
139944-sample clip:
- 4 s cap: max |Ξ” logit-diff| 2.4e-6 (their batch 1 and batch 8); |Ξ”(Score_realβˆ’Score_fake)| vs tanh(ours/2) 8e-8.
- window off (whole clip, batch 1): max |Ξ”| 0.0.

## Tests (`test_nii_slt26_xlsr_fc.py`): 8 passed
window crop / repeat-pad / empty, normalisation == Wav2Vec2FeatureExtractor, strict load (key set == net state dict,
nothing dropped), eval mode + param count + label ids, batch == single (atol 1e-3), determinism, bona fide > spoof.

## Batch sweep (`sweep.py`, 64600 samples, 2026-11-10)
| card | best | notes |
|---|---|---|
| RTX 4070 Ti SUPER (idx 2) | 122.6 utt/s @24 | plateau 16–64 β†’ `batch_size = 24` |
| RTX 5060 Ti (idx 0) | 46.4 utt/s @4 | ~31 at bs β‰₯ 8 β†’ 4 on 5060 |

## Sanity (PyTorch, RTX 5060 Ti idx 0)
- Full J-SPAW_LA: EER **36.756%** (2397 trials, 0 skipped). Not ~50, not inverted, but weak: the score range is
  very narrow (bona fide median βˆ’7.52, spoof median βˆ’7.53; nearly everything is called fake). Expected: every
  CompSpoof V2 training "real" clip is bona fide speech MIXED with a real environmental sound, and the unmixed
  "original" class was excluded, so clean studio speech is out of domain.

## Training data β†’ trained_on
CompSpoof V2 train (arXiv 2606.10791 Table II; HF dataset gated, no split info): bona fide speech CommonVoice,
LibriTTS, english-conversation-corpus; spoof speech ASVspoof 5, MLAAD; environment AudioCaps, TAU UAS, TUT SED,
UrbanSound, VGGSound (real), EnvSDD, VcapAV (fake). Splits unstated β†’ whole corpora (provenance convention).
Same-corpus matches in `arena-manifest/provenance.yaml`: LibriTTS (SONAR = LibriTTS:test, CD-ADD includes
LibriTTS:test, LibriSeVoc includes LibriTTS:train) and ASVspoof5 (ASVspoof5:eval). Common-Voice: no Arena dataset
lists it (CVoiceFake is its own corpus). MLAAD/EnvSDD: no Arena dataset. β†’ trained_on: ASVspoof5, SONAR, CD-ADD,
LibriSeVoc. Suggested provenance entry (maintainer):
`nii-slt26-*: {source: https://arxiv.org/abs/2606.10791, trained_on: [ASVspoof5, LibriTTS, Common-Voice, MLAAD, EnvSDD]}`
(+ `backbone: XLS-R` for this row, `Whisper` for #5).

## TensorRT (`trt_nii_slt26_xlsr_fc.py`, sidecar `trt_nii-slt26-xlsr-fc.json`, TRT 10.16.1.11)
Adapted from ProSDD-ASV19's script (config block; the TRT drop-in `load()` also sets `real_id/fake_id` from the JSON β€”
the first J-SPAW TRT run skipped every clip without it). Net input = the normalised (B, 64600) waveform.
GPU reassignment 2026-11-10 (coordinator): only idx 2 (RTX 4070 Ti SUPER) is available; **only the 4070 engine is
built**; on RTX 5060 Ti cards the lanes fall back to the PyTorch wrapper (batch 4).
| card | precision | best batch | utt/s (sweep) | build parity (64 ITW) | J-SPAW EER | J-SPAW Spearman vs PT / max Ξ” |
|---|---|---|---|---|---|---|
| RTX 4070 Ti SUPER (idx 2) | FP32 (FP16 build Spearman 0.99940 < 0.9999) | 32 | 175.0 | Spearman 0.99995, max Ξ” 5.0e-3 | 36.875 (PT 36.756, Ξ” 0.119) | 0.999981 / 0.0033 |

Accepted (|Ξ”EER| ≀ 0.25, Spearman β‰₯ 0.999). Note the PyTorch reference run was on idx 0 (RTX 5060 Ti, before the
reassignment) and the TRT run on idx 2. Unused FP16 engine deleted. Registered with the TRT class in
`EmoSpoofTTS/_score_emospoof.py`, `LRLspoof/_score_lrlspoof.py`, `LRLspoof/lrl_multi.py`.
Scripts: `run_pt.sh` (now pinned to idx 2), `run_trt_export.sh 2`, `run_trt_jspaw.sh 2`, `run_parity.sh xlsr-fc.ckpt`.