feat(asr/v3): opt-in int8-linear Encoder_v2 encoder precision (#760) - #872
Conversation
…coder (#760) The shipped v3 Encoder.mlmodelc (labeled int8, actually Mixed Float16 + 6-bit LUT palettization) corrupts tokens under specific right-context: on the issue #760 Ukrainian repro, a 15s single-window cut deterministically decodes 'фоновий процес' as the non-word 'фоновиц'. Component-swap elimination (NeMo fp32/fp16, parakeet-mlx, CoreML fp16/fp32/int8-linear/int4 encoders against identical stock companions) isolates the corruption to the 6-bit palettization noise; every variant >= int8-linear decodes all repro cuts identically to fp32 and MLX, while int4 shows its own error sites on two of three cuts. The re-quantized encoder (int8 per-channel linear from the fp16 export, 568M vs 425M) is published as Encoder_v2.mlmodelc alongside the immutable original. Swift resolution for .int8 requests: - local Encoder_v2.mlmodelc wins when present - existing caches with only Encoder.mlmodelc keep it (no surprise download) - fresh installs and force-downloads try Encoder_v2 first and fall back to Encoder.mlmodelc for mirrors/pinned dirs that predate the file New ParakeetEncoderPrecision.int8V2 ('int8-v2') carries the resolution through the ModelHub variant string so required-model sets, modelsExist, and isModelValid stay consistent; it is also directly selectable via --encoder-precision int8-v2.
PocketTTS Smoke Test ✅
Runtime: 0m20s 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. |
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. |
VAD Benchmark ResultsPerformance Comparison
Dataset Details
✅: Average F1-Score above 70% |
Parakeet EOU Benchmark Results ✅Status: Benchmark passed Performance Metrics
Streaming Metrics
Test runtime: 1m40s • 08/19/2026, 04:38 PM EST RTFx = Real-Time Factor (higher is better) • Processing includes: Model inference, audio preprocessing, state management, and file I/O |
Sortformer High-Latency Benchmark ResultsES2004a Performance (30.4s latency config)
Sortformer High-Latency • ES2004a • Runtime: 3m 27s • 2026-08-19T20:50:10.778Z |
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 • 143.5s processing • Test runtime: 2m 30s • 08/19/2026, 04:41 PM EST |
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 • 64.9s diarization time • Test runtime: 3m 55s • 08/19/2026, 04:48 PM EST |
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: 12m48s • 08/19/2026, 04:58 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 |
- Resolution now requires a load-ready compiled bundle (ModelCache layout check + no .partial staging files) before preferring Encoder_v2.mlmodelc: an interrupted v2 download left for resume must not outrank a valid original encoder. - Both fallback catches rethrow cancellation (RetryPolicy.isCancellation) instead of treating a caller abort as v2 unavailability, which would have kicked off a second multi-hundred-MB fetch. - Tests: place() now creates complete bundles (coremldata.bin), added incomplete-v2 preference cases (bare dir + .partial) and the both-incomplete resume case.
…ault Drop the auto-resolution/fallback machinery: .int8 always means the original Encoder.mlmodelc, including fresh installs. The int8-linear rebuild is selected only by an explicit .int8V2 / --encoder-precision int8-v2. AsrModels.swift reverts to main verbatim; the new precision case rides the existing generic encoderPrecision plumbing.
Root cause (#760)
The shipped v3
Encoder.mlmodelc(labeled "int8", actually Mixed Float16 + 6-bit LUT palettization) corrupts tokens under specific right-context. On the reporter's Ukrainian repro, a ≤15s single-window cut deterministically decodesфоновий процес→ non-wordфоновиц(confidence 0.885 — silently wrong). Not a window-composition/seam issue: all three cuts decode in a single window.Full encoder-substitution sweep on identical audio with identical stock companions (Swift CLI):
фоновицEncoderInt4)фіновий+ deleted clauseафоновийEach quantization level has its own error sites — int4 passing B in isolation was rounding luck.
Change (strictly opt-in — defaults unchanged)
The re-quantized encoder (int8 per-channel linear, data-free
cto.linear_quantize_weightson the fp16 export, +143MB) is published asEncoder_v2.mlmodelcalongside the untouched original (merged on HF)..int8(default) continues to mean the originalEncoder.mlmodelceverywhere, including fresh installs. No behavior change for any existing caller.ParakeetEncoderPrecision.int8V2("int8-v2") selectsEncoder_v2.mlmodelc, via the API parameter or--encoder-precision int8-v2. It rides the existing genericencoderPrecisionplumbing —AsrModels.swiftis untouched; the diff is the enum case, a filename constant, CLI help text, and tests.config.jsonon HF now records the true weight format of each encoder file (the original ispalettized_lut6_mixed_fp16, not int8), so the historical mislabel can't recur.Verification
фоновиц, proving no silent preference change);--encoder-precision int8-v2loads v2 and B decodesфоновий процес✅. Fresh-download of the v2 file from live HF verified.modelsExistdistinguishing the two precisions.swift build -c releaseclean, swift-format lint clean.Follow-ups (before recommending int8-v2 broadly)
Closes #760
🤖 Generated with Claude Code