feat(diarizer): Nemotron 3 Diarization support (8-speaker streaming Sortformer) - #883
feat(diarizer): Nemotron 3 Diarization support (8-speaker streaming Sortformer)#883Alex-Wengg wants to merge 3 commits into
Conversation
…ortformer) Swift runtime for NVIDIA's Nemotron 3 Diarization (early access): 8 speakers, arrival-order output, 10 ms frame resolution, streaming and offline profiles. - Nemotron3Diarizer / Nemotron3StateUpdater: port of NeMo streaming_update_async at batch 1 — fixed-capacity speaker-cache/FIFO state, score-based cache compression with the checkpoint's learned silence embedding, first-vs-later compression prediction freezing, NeMo-exact tail chunking, and 10 ms high-resolution output extracted before state mutation. Closed-loop output verified against the NeMo reference (99.995% frame agreement on a 120 s fixture). - Nemotron3Models: local-directory CoreML loading (no HF path until the model's public release), stride-aware vDSP_mmov output readback (the outputs are fp16 with padded rows; naive reads silently scramble or run 40x slower), per-chunk autoreleasepool (long ANE runs otherwise exhaust the IOSurface pool), and an optional split-graph mode that runs feature stacking + the 1024->512 projection host-side for a 100% ANE-resident pure-fp transformer graph. - Presets for the model-card profiles (offline/low/verylow/ultra) plus chunk-ladder profiles (fast/fast24/fast32/fast128/efficient) and int8/split selectors; optional VAD gating via a per-frame speech mask for sparse audio. - CLI: nemotron3-diarize, nemotron3-benchmark (AMI/VoxConverse harness with compute-unit routing and sweep flags), nemotron3-batch (concurrent GPU workers). - Tests: state updater semantics (FIFO pop/flush, compression, silence slots), feature loader tail handling, and padded-stride tensor layout regressions. Model weights are not distributed with this change; they load from a local directory and will move to HuggingFace auto-download after NVIDIA's public release.
Supertonic3 Smoke Test ✅
Runtime: 0m27s Note: CI VMs lack a physical Neural Engine; the ANE-bucketed VectorEstimator falls back to CPU here. This validates download + variant resolution + synthesis, not ANE residency/perf. |
PocketTTS Smoke Test ✅
Runtime: 0m6s Note: PocketTTS uses CoreML MLState (macOS 15) KV cache + Mimi streaming state. CI VM lacks physical GPU — audio quality and performance may differ from Apple Silicon. |
Parakeet EOU Benchmark Results ✅Status: Benchmark passed Performance Metrics
Streaming Metrics
Test runtime: 1m14s • 08/30/2026, 05:36 PM EST RTFx = Real-Time Factor (higher is better) • Processing includes: Model inference, audio preprocessing, state management, and file I/O |
Speaker Diarization Benchmark ResultsSpeaker Diarization PerformanceEvaluating "who spoke when" detection accuracy
Diarization Pipeline Timing BreakdownTime spent in each stage of speaker diarization
Speaker Diarization Research ComparisonResearch baselines typically achieve 18-30% DER on standard datasets
Note: RTFx shown above is from GitHub Actions runner. On Apple Silicon with ANE:
🎯 Speaker Diarization Test • AMI Corpus ES2004a • 1049.0s meeting audio • 53.9s diarization time • Test runtime: 2m 43s • 08/30/2026, 05:37 PM EST |
Preset chooser table (size / audio chunk / latency / pros / cons), quick start, CLI reference, and implementation notes. Accuracy and throughput figures are deferred to the model's public release per the early-access evaluation terms.
Offline VBx Pipeline ResultsSpeaker Diarization Performance (VBx Batch Mode)Optimal clustering with Hungarian algorithm for maximum accuracy
Offline VBx Pipeline Timing BreakdownTime spent in each stage of batch diarization
Speaker Diarization Research ComparisonOffline VBx achieves competitive accuracy with batch processing
Pipeline Details:
🎯 Offline VBx Test • AMI Corpus ES2004a • 1049.0s meeting audio • 130.6s processing • Test runtime: 2m 18s • 08/30/2026, 05:37 PM EST |
VAD Benchmark ResultsPerformance Comparison
Dataset Details
✅: Average F1-Score above 70% |
Sortformer High-Latency Benchmark ResultsES2004a Performance (30.4s latency config)
Sortformer High-Latency • ES2004a • Runtime: 3m 9s • 2026-08-30T21:44:02.825Z |
ASR Benchmark Results ✅Status: All benchmarks passed Parakeet v3 (multilingual)
Parakeet v2 (English-optimized)
Streaming (v3)
Streaming (v2)
Streaming tests use 5 files with 0.5s chunks to simulate real-time audio streaming 25 files per dataset • Test runtime: 8m21s • 08/30/2026, 05:50 PM EST RTFx = Real-Time Factor (higher is better) • Calculated as: Total audio duration ÷ Total processing time Expected RTFx Performance on Physical M1 Hardware:• M1 Mac: ~28x (clean), ~25x (other) Testing methodology follows HuggingFace Open ASR Leaderboard |
Route both prediction paths through MLPredictionOptions.outputBackings with preallocated contiguous fp16 arrays. Latency is unchanged (the residual ~1ms predict-vs-benchtool gap lives inside CoreML's dispatch, not output allocation), but per-call output IOSurface allocation is gone — removing the root cause of pool exhaustion on long ANE runs (the per-chunk autoreleasepool remains as defense in depth). Output verified bit-identical on the parity fixture for the split path and DER-identical on AMI for the monolithic path.
Summary
Swift runtime for NVIDIA's Nemotron 3 Diarization (early-access preview on HF): 8 speakers, arrival-order channels, 10 ms output resolution, streaming and offline profiles. Code-only — model weights are not included; they load from a local directory and move to HuggingFace auto-download once NVIDIA's public release lands (converted models are staged and ready).
What's included
Nemotron3Diarizer/Nemotron3StateUpdater— port of NeMostreaming_update_asyncat batch 1: fixed-capacity speaker-cache/FIFO state, score-based cache compression using the checkpoint's learned silence embedding, first-vs-later compression prediction freezing, NeMo-exact tail chunking, 10 ms high-resolution output extracted before state mutation. Closed-loop output verified against the NeMo/PyTorch reference (99.995% frame agreement on a 120 s fixture; remaining deltas are file-tail padding alignment).Nemotron3Models— local-dir CoreML loading; stride-awarevDSP_mmovoutput readback (model outputs are fp16 with padded rows — naive reads either scramble or run ~40x slower); per-chunk autoreleasepool (long ANE-route runs otherwise exhaust the IOSurface pool — same failure class as Diarization benchmark reports 80.8% DER on AMI ES2004a (target <30%) #752); optional split-graph mode (feature stacking + the 1024→512 projection run host-side via onecblas_sgemm) yielding a 100% ANE-resident pure-fp transformer graph that avoids an ANECCompile limit on long chunk inputs.offline/low/verylow/ultra) plus chunk-ladder profiles (fast,fast24,fast32,fast128,efficient) and-int8/-splitselectors. Optional VAD gating (speechMask) skips inference across silence for sparse audio while preserving the output timeline.nemotron3-diarize,nemotron3-benchmark(AMI/VoxConverse harness, compute-unit routing, config sweep flags),nemotron3-batch(concurrent GPU workers).Notes
AudioMelSpectrogram(same 128-mel / 10 ms family as Nemotron ASR).Testing
swift build -c releaseclean; swift-format lint clean.