Skip to content

Parakeet batch transcription: apply high-performance GPU worker + dynamic batching #7936

Closed

Description

@beastoin

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:

  1. No dynamic batching — each request runs model.transcribe() alone, wasting GPU parallel compute
  2. 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
  3. No torch.compile — missing 20-30% throughput gain from kernel fusion
  4. No CUDA optimizations — cudnn.benchmark and set_float32_matmul_precision('high') not set
  5. 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):

  1. Dedicated GPU worker thread — all inference isolated on a single thread, no CUDA context contention
  2. Dynamic batching engine — collect concurrent requests, flush by batch size (32) or timer (2ms)
  3. GC management — gc.disable() + gc.collect(0) per batch on GPU thread + full gc.collect() every 50 batches
  4. torch.compile — compile the batch model for +20-30% throughput
  5. CUDA optimizations — cudnn.benchmark=True, set_float32_matmul_precision('high')
  6. Result serialization — convert NeMo results to plain Python dicts on GPU thread before crossing boundaries
  7. CUDA graphs control — configurable disable for T4 compatibility
  8. 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

Activity

  1. added
    understand
    p2
    maintainer
    on Jun 15, 2026
  2. added a commit that references this issue on Jun 15, 2026
    c6bc49d
  3. added a commit that references this issue on Jun 15, 2026
    48c48ea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintainerp2understand

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions