Skip to content

docs(asr): document parallel chunk processing in LongTranscription.md#626

Merged
Alex-Wengg merged 2 commits into
mainfrom
docs/long-transcription-parallel
May 19, 2026
Merged

docs(asr): document parallel chunk processing in LongTranscription.md#626
Alex-Wengg merged 2 commits into
mainfrom
docs/long-transcription-parallel

Conversation

@Alex-Wengg
Copy link
Copy Markdown
Member

@Alex-Wengg Alex-Wengg commented May 19, 2026

Summary

Brings Documentation/ASR/LongTranscription.md up to date with the parallel chunked Parakeet batch transcription work (PR #507, commit fcd80f10) and with the surrounding long-transcription history that was only documented in source comments and commit messages.

Added sections

  • Chunk Geometry — concrete values from ASRConstants (encoder window 240k samples, encoder frame 1280 samples / 80 ms, mel hop 160 samples, visible chunk ≈ 14.96 s, 2.0 s overlap, frame-aligned stride, 6-frame minimum seam overlap) and why the visible window is smaller than maxModelSamples.
  • Boundary Search — fixed-stride vs silence-aligned (±4 s) + valley fallback (±0.5 s) + speech-tail-compression guard, including the adaptive 0.05× medianScore / 0.35× medianScore thresholds.
  • Warmup Prefix vs Mel Context — clarifies the two prefix mechanisms: mel context (80 ms, decoder-skipped) vs warmup prefix (0–7 frames, decoded from frame 0 with emitted tokens suppressed up to chunk start), and documents the shouldUseWarmupPrefix quiet-lookahead gate (≥ 200 ms of rms < 0.003).
  • Why This Helps rewrite — traces the real issue history end-to-end:
  • Parallel Chunk ProcessingASRConfig.parallelChunkConcurrency (default 4, clamped >= 1), worker-pool construction via AsrManager.makeWorkerClone(), ThrowingTaskGroup dispatch with the availableWorkers backpressure list, ordered merge via TaskResult { index, tokens, workerIndex }, and a callout that StreamingAsrManager / SlidingWindowAsrManager are intentionally unaffected. Tuning notes cover the 2.2–2.8× wall-clock speedup on M3 with a 1-hour file, ~19–31 MiB extra resident memory, and parallelChunkConcurrency = 1 as the closest-to-serial / lowest-memory configuration.
  • Overlap Merge — the actual mergeChunks ladder: disjoint shortcut → contiguous time-tolerant SequenceMatcher (must cover ≥ half the overlap) → LCS fallback → midpoint fallback. Emphasizes that the merger is token-id-keyed with a overlapSeconds / 2 time tolerance and never re-runs the decoder.
  • Streaming Threshold for Large FilesASRConfig.streamingEnabled / streamingThreshold (480k samples ≈ 30 s) and how they compose with parallelChunkConcurrency for memory-constrained environments.

Updated sections

  • Current Paths table — adds the Parallel chunk workers row.
  • Relevant CodeASRConstants geometry constants; ASRConfig.streaming*; AsrManager.makeWorkerClone() / parallelChunkConcurrency; ChunkProcessor boundary helpers (regularChunkStarts, silenceAlignedChunkStarts, bestBoundaryCandidate, shouldUseWarmupPrefix, wouldCompressSpeechTail); merge helpers (mergeChunks, mergeUsingMatches, mergeByMidpoint); makeWorkerPool and static transcribeChunk(...); TokenDeduplication/SequenceMatcher.swift.
  • Focused Tests — adds ASRConfigTests (covers parallelChunkConcurrency default, clamp, override).

Pure documentation change — no source files touched.

Commits

  • f1e8694 docs(asr): document parallel chunk processing in LongTranscription.md
  • b013476 docs(asr): expand LongTranscription.md with geometry, boundary search, merge, streaming

Test plan

  • Render Documentation/ASR/LongTranscription.md and visually confirm the section ordering and tables.
  • Verify the referenced symbols exist on main:
    • ASRConstants.maxModelSamples, samplesPerEncoderFrame, melHopSize, secondsPerEncoderFrame
    • ASRConfig.parallelChunkConcurrency, melChunkContext, dualDecodeArbitration, streamingEnabled, streamingThreshold
    • AsrManager.makeWorkerClone(), AsrManager.parallelChunkConcurrency
    • ChunkProcessor.chunkLayout, regularChunkStarts, silenceAlignedChunkStarts, bestBoundaryCandidate, shouldUseWarmupPrefix, wouldCompressSpeechTail, mergeChunks, mergeUsingMatches, mergeByMidpoint, makeWorkerPool, transcribeChunk
    • TokenDeduplication/SequenceMatcher.swift exposing findContiguousMatches and findLongestCommonSubsequence
  • swift test --filter ASRConfigTests and swift test --filter ChunkProcessorTests.

Adds a Parallel Chunk Processing section covering ASRConfig.parallelChunkConcurrency
(default 4, clamped to >= 1), the worker-pool / ThrowingTaskGroup dispatch in
ChunkProcessor, AsrManager.makeWorkerClone(), and the tuning notes from the
parallelization benchmarks (2.2-2.8x on M3, ~19-31 MiB extra resident memory).
Also extends the Current Paths table, the Relevant Code list (AsrManager and
ChunkProcessor entries), and the focused-test list to include ASRConfigTests.

The parallel path is orthogonal to mel-context / no-mel / dual-decode arbitration
and applies to all stateless chunked batch TDT routes. Streaming and sliding-
window paths are explicitly called out as unaffected because they need
persistent decoder/encoder state.
…, merge, streaming

Adds the long-transcription details that were only living in ChunkProcessor
comments, source-side constants, and the issue #594 / #507 / #594-followup
commit history:

- Chunk Geometry section with concrete values from ASRConstants
  (encoder window, encoder frame, mel hop, visible chunk, overlap, stride,
  minimum seam overlap) and a note on why visible windows are smaller than
  the 240k-sample encoder window.
- Boundary Search section explaining regular fixed-stride vs the
  silence-aligned (±4s) + valley fallback (±0.5s) + speech-tail-compression
  guard used on the v3 no-mel path, including the adaptive thresholds
  (0.05x and 0.35x medianScore).
- Warmup Prefix vs Mel Context section clarifying that mel context (80ms)
  is decoder-skipped while warmup prefix (0-7 frames) is decoded from frame 0
  with emitted tokens suppressed, and documenting the
  shouldUseWarmupPrefix quiet-lookahead gate (>=200ms below rms 0.003).
- Why This Helps rewrite that traces the actual issue history:
  PR #264 (mel-context prepend for English blank-boundary failures),
  issue #594 (v3 multilingual English-prior drift),
  the persisted-decoder-state attempt in eb9c19f and why it was
  superseded once PR #507 parallelized chunk decoding, and the
  sentence-final BLANK-trap that the per-chunk SOS reset now masks.
- Overlap Merge section documenting the merge ladder used by
  ChunkProcessor.mergeChunks: disjoint shortcut, contiguous time-tolerant
  SequenceMatcher (>= half overlap), LCS fallback, midpoint fallback;
  emphasizing that the merger is token-id-keyed and never re-decodes.
- Streaming Threshold section covering ASRConfig.streamingEnabled and
  streamingThreshold, including how they compose with
  parallelChunkConcurrency for memory-constrained environments.
- Relevant Code list extended with ASRConstants, the new
  ASRConfig.streaming* fields, the boundary/merge helper functions in
  ChunkProcessor.swift, and the TokenDeduplication SequenceMatcher.

Pure documentation, no source changes.
@Alex-Wengg Alex-Wengg merged commit 66baf21 into main May 19, 2026
11 checks passed
@Alex-Wengg Alex-Wengg deleted the docs/long-transcription-parallel branch May 19, 2026 03:28
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

PocketTTS Smoke Test ✅

Check Result
Build
Model download
Model load
Synthesis pipeline
Output WAV ✅ (146.3 KB)

Runtime: 0m36s

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.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

Qwen3-ASR int8 Smoke Test ✅

Check Result
Build
Model download
Model load
Transcription pipeline
Decoder size 571 MB (vs 1.1 GB f32)

Performance Metrics

Metric CI Value Expected on Apple Silicon
Median RTFx 0.04x ~2.5x
Overall RTFx 0.04x ~2.5x

Runtime: 5m23s

Note: CI VM lacks physical GPU — CoreML MLState (macOS 15) KV cache produces degraded results on virtualized runners. On Apple Silicon: ~1.3% WER / 2.5x RTFx.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

ASR Benchmark Results ✅

Status: All benchmarks passed

Parakeet v3 (multilingual)

Dataset WER Avg WER Med RTFx Status
test-clean 0.57% 0.00% 5.19x
test-other 1.35% 0.00% 3.81x

Parakeet v2 (English-optimized)

Dataset WER Avg WER Med RTFx Status
test-clean 0.80% 0.00% 6.20x
test-other 1.00% 0.00% 3.68x

Streaming (v3)

Metric Value Description
WER 0.00% Word Error Rate in streaming mode
RTFx 0.65x Streaming real-time factor
Avg Chunk Time 1.385s Average time to process each chunk
Max Chunk Time 1.525s Maximum chunk processing time
First Token 1.687s Latency to first transcription token
Total Chunks 31 Number of chunks processed

Streaming (v2)

Metric Value Description
WER 0.00% Word Error Rate in streaming mode
RTFx 0.61x Streaming real-time factor
Avg Chunk Time 1.447s Average time to process each chunk
Max Chunk Time 1.763s Maximum chunk processing time
First Token 1.434s Latency to first transcription token
Total Chunks 31 Number of chunks processed

Streaming tests use 5 files with 0.5s chunks to simulate real-time audio streaming

25 files per dataset • Test runtime: 5m47s • 05/18/2026, 11:59 PM EST

RTFx = Real-Time Factor (higher is better) • Calculated as: Total audio duration ÷ Total processing time
Processing time includes: Model inference on Apple Neural Engine, audio preprocessing, state resets between files, token-to-text conversion, and file I/O
Example: RTFx of 2.0x means 10 seconds of audio processed in 5 seconds (2x faster than real-time)

Expected RTFx Performance on Physical M1 Hardware:

• M1 Mac: ~28x (clean), ~25x (other)
• CI shows ~0.5-3x due to virtualization limitations

Testing methodology follows HuggingFace Open ASR Leaderboard

@github-actions
Copy link
Copy Markdown

Speaker Diarization Benchmark Results

Speaker Diarization Performance

Evaluating "who spoke when" detection accuracy

Metric Value Target Status Description
DER 15.1% <30% Diarization Error Rate (lower is better)
JER 24.9% <25% Jaccard Error Rate
RTFx 26.18x >1.0x Real-Time Factor (higher is faster)

Diarization Pipeline Timing Breakdown

Time spent in each stage of speaker diarization

Stage Time (s) % Description
Model Download 9.111 22.7 Fetching diarization models
Model Compile 3.905 9.7 CoreML compilation
Audio Load 0.053 0.1 Loading audio file
Segmentation 12.020 30.0 Detecting speech regions
Embedding 20.033 50.0 Extracting speaker voices
Clustering 8.013 20.0 Grouping same speakers
Total 40.080 100 Full pipeline

Speaker Diarization Research Comparison

Research baselines typically achieve 18-30% DER on standard datasets

Method DER Notes
FluidAudio 15.1% On-device CoreML
Research baseline 18-30% Standard dataset performance

Note: RTFx shown above is from GitHub Actions runner. On Apple Silicon with ANE:

  • M2 MacBook Air (2022): Runs at 150 RTFx real-time
  • Performance scales with Apple Neural Engine capabilities

🎯 Speaker Diarization Test • AMI Corpus ES2004a • 1049.0s meeting audio • 40.1s diarization time • Test runtime: 2m 37s • 05/18/2026, 11:41 PM EST

@github-actions
Copy link
Copy Markdown

VAD Benchmark Results

Performance Comparison

Dataset Accuracy Precision Recall F1-Score RTFx Files
MUSAN 92.0% 86.2% 100.0% 92.6% 331.2x faster 50
VOiCES 92.0% 86.2% 100.0% 92.6% 315.6x faster 50

Dataset Details

  • MUSAN: Music, Speech, and Noise dataset - standard VAD evaluation
  • VOiCES: Voices Obscured in Complex Environmental Settings - tests robustness in real-world conditions

✅: Average F1-Score above 70%

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

Parakeet EOU Benchmark Results ✅

Status: Benchmark passed
Chunk Size: 320ms
Files Tested: 100/100

Performance Metrics

Metric Value Description
WER (Avg) 7.03% Average Word Error Rate
WER (Med) 4.17% Median Word Error Rate
RTFx 9.39x Real-time factor (higher = faster)
Total Audio 470.6s Total audio duration processed
Total Time 52.1s Total processing time

Streaming Metrics

Metric Value Description
Avg Chunk Time 0.052s Average chunk processing time
Max Chunk Time 0.104s Maximum chunk processing time
EOU Detections 0 Total End-of-Utterance detections

Test runtime: 1m9s • 05/18/2026, 11:46 PM EST

RTFx = Real-Time Factor (higher is better) • Processing includes: Model inference, audio preprocessing, state management, and file I/O

@github-actions
Copy link
Copy Markdown

Sortformer High-Latency Benchmark Results

ES2004a Performance (30.4s latency config)

Metric Value Target Status
DER 30.3% <35%
Miss Rate 28.2% - -
False Alarm 0.9% - -
Speaker Error 1.2% - -
RTFx 7.8x >1.0x
Speakers 4/4 - -

Sortformer High-Latency • ES2004a • Runtime: 3m 54s • 2026-05-19T03:50:48.371Z

@github-actions
Copy link
Copy Markdown

Offline VBx Pipeline Results

Speaker Diarization Performance (VBx Batch Mode)

Optimal clustering with Hungarian algorithm for maximum accuracy

Metric Value Target Status Description
DER 10.4% <20% Diarization Error Rate (lower is better)
RTFx 11.38x >1.0x Real-Time Factor (higher is faster)

Offline VBx Pipeline Timing Breakdown

Time spent in each stage of batch diarization

Stage Time (s) % Description
Model Download 10.917 11.8 Fetching diarization models
Model Compile 4.679 5.1 CoreML compilation
Audio Load 0.055 0.1 Loading audio file
Segmentation 22.226 24.1 VAD + speech detection
Embedding 92.016 99.7 Speaker embedding extraction
Clustering (VBx) 0.100 0.1 Hungarian algorithm + VBx clustering
Total 92.249 100 Full VBx pipeline

Speaker Diarization Research Comparison

Offline VBx achieves competitive accuracy with batch processing

Method DER Mode Description
FluidAudio (Offline) 10.4% VBx Batch On-device CoreML with optimal clustering
FluidAudio (Streaming) 17.7% Chunk-based First-occurrence speaker mapping
Research baseline 18-30% Various Standard dataset performance

Pipeline Details:

  • Mode: Offline VBx with Hungarian algorithm for optimal speaker-to-cluster assignment
  • Segmentation: VAD-based voice activity detection
  • Embeddings: WeSpeaker-compatible speaker embeddings
  • Clustering: PowerSet with VBx refinement
  • Accuracy: Higher than streaming due to optimal post-hoc mapping

🎯 Offline VBx Test • AMI Corpus ES2004a • 1049.0s meeting audio • 114.3s processing • Test runtime: 1m 56s • 05/18/2026, 11:55 PM EST

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant