KatInterview

Build a High-Throughput Audio ML Pipeline

Machine LearningModel answer
MediumModel answerMachine Learningml-systemsdistributed-systemsgpu-scheduling

Last updated

Design a distributed backend that runs multi-stage audio AI workloads at scale, handling both real-time and batch requests with efficient GPU use and granular recovery.

Context

You're building the backend infrastructure for an audio intelligence service. The platform runs AI models on user-provided audio to deliver transcription, speaker identification, audio source separation, and language translation. Your system must handle two workload types:

  1. Real-time requests: Short audio clips (under 1 minute) that need results in under 2 seconds for live use cases like meeting transcription or voice commands
  2. Batch processing: Large audio files (up to 2 hours, 1.5 GB each) for offline analysis of recorded calls, podcasts, or archived content

The processing itself is a multi-stage pipeline: audio is split into manageable pieces, cleaned up, fed through various models, and post-processed to produce final outputs.

System Requirements

Workload characteristics:

  • Handle 50,000 hours of audio daily with peak load of 10,000 simultaneous streams
  • Real-time path: sub-2-second end-to-end latency for clips under 60 seconds
  • Batch path: process files up to 2 hours long efficiently

Core capabilities:

  • Execute configurable multi-step pipelines (e.g., voice activity detection → separation → transcription → formatting)
  • Track processing state at a granular level so failures only require reprocessing small segments, not entire files
  • Automatically evaluate output quality and re-run low-confidence segments through more accurate models
  • Keep GPUs busy through intelligent batching while guaranteeing real-time request latency

Architectural focus areas:

  1. Overall system structure: How do requests enter the system, where does audio data live, how is work coordinated, and what does the compute layer look like?

  2. Efficient large file handling: How do you ingest, store, split, and deliver audio to workers without overwhelming memory or network?

  3. GPU resource management: How do you batch variable-length audio intelligently, separate real-time from batch workloads, and prevent one from starving the other?

  4. State tracking and recovery: What entities and relationships do you need to enable retrying individual segments without redoing work, and how do you ensure idempotency?

Walk through your design decisions with concrete choices for technologies, data flows, and failure handling strategies.

Hints

Hint 1

Start with capacity math to understand the scale of GPU and storage resources needed

Hint 2

Consider keeping real-time audio in memory throughout processing instead of writing to object storage on the hot path

Hint 3

Design segment identifiers that are deterministic and content-addressable for natural idempotency