Repository navigation
Closed
Labels
maintainerLane: High-risk, cross-system changesp2Priority: Important (score 14-21)understandLayer: Speech-to-text, language detection
Description
Problem
Omi's parakeet batch transcription currently processes requests one at a time using model.transcribe() on the request thread. This leaves significant GPU throughput on the table — benchmark data from beastoin/NeMo#2 shows the same L4 GPU can sustain 43 RPS with proper batching vs ~1 RPS serial.
Key issues in current implementation:
- No dynamic batching — each request runs
model.transcribe()alone, wasting GPU parallel compute - No GC management — Python's automatic GC can trigger on the async event-loop thread and free CUDA pinned-memory tensors cross-thread, causing segfaults under sustained load
- No torch.compile — missing 20-30% throughput gain from kernel fusion
- No CUDA optimizations —
cudnn.benchmarkandset_float32_matmul_precision('high')not set - No result serialization — NeMo result objects cross thread boundaries with live CUDA tensor references
Solution
Apply the optimizations from beastoin/NeMo#2 (zen's thread-safety + high-perf batch server):
- Dedicated GPU worker thread — all inference isolated on a single thread, no CUDA context contention
- Dynamic batching engine — collect concurrent requests, flush by batch size (32) or timer (2ms)
- GC management —
gc.disable()+gc.collect(0)per batch on GPU thread + fullgc.collect()every 50 batches - torch.compile — compile the batch model for +20-30% throughput
- CUDA optimizations —
cudnn.benchmark=True,set_float32_matmul_precision('high') - Result serialization — convert NeMo results to plain Python dicts on GPU thread before crossing boundaries
- CUDA graphs control — configurable disable for T4 compatibility
- Backpressure — 503 when queue full (4096 depth), prevents OOM under burst
Acceptance Criteria
- GPU worker thread handles all batch model inference
- Dynamic batching collects concurrent requests into GPU-efficient batches
- GC disabled globally, managed manually on GPU thread
- torch.compile enabled via env var (default on)
- CUDA optimizations applied at startup
- Results serialized to plain dicts before crossing thread boundary
- Existing v1/v2 API contracts preserved (same request/response format)
- v3 streaming unaffected (uses separate stream_handler.py)
- NIM fallback path preserved
- Health endpoint remains available during model loading (returns loading status)
- Backpressure returns 503 when overloaded
References
- Thread-safe ASR inference server: 43 RPS on L4, 6.9 RPS on T4 beastoin/NeMo#2 — zen's thread-safety fixes + high-perf batch server (43 RPS on L4)
- NeMo docs(python-cli): add Danish (da) agent quickstart guide #15771 — freeze/unfreeze thread-safety bug report
- feat: production-grade NVIDIA Parakeet/Nemotron ASR — batch path, NIM deployment, diarization #7651 — Parakeet ASR tracking issue
Metadata
Metadata
Assignees
Labels
maintainerLane: High-risk, cross-system changesp2Priority: Important (score 14-21)understandLayer: Speech-to-text, language detection
Activity
Parakeet batch: GPU worker + dynamic batching (36 RPS on L4, ~36x thr…
Add GPU worker + dynamic batching for parakeet batch transcription