M9-033M9: Senior ML & AI System DesignLLM Serving, RAG & Agent SysDesignHard
⚡Flashcard Drill➔Mastery:

Design a Sub-350ms Full-Duplex Audio/Voice Pipeline with Instant Barge-In

🎯 Active Recall Self-Check (Draft First, Verify After)
Login-free practice tracker: recall core answer, audit pitfalls, and log review status.
Step 1 · Draft your concise answer & assumptions
Step 2 · Check Pitfalls & Follow-up Inquiries
Next: M9-034 →
📐 Mathematical Definition
Mouth-to-Ear=TRTP+TAEC+VAD+TASR+TTTFT+TTTS_1st≤350ms\text{Mouth-to-Ear} = T_{\text{RTP}} + T_{\text{AEC+VAD}} + T_{\text{ASR}} + T_{\text{TTFT}} + T_{\text{TTS\_1st}} \le 350\text{ms}
⚡ One-Sentence Core Answer
Combine WebRTC UDP transport, acoustic echo cancellation, semantic End-of-Turn detection, and instant TTS/KV-playback rollback for sub-350ms natural barge-in voice agents.

📌 Key Takeaways

  • •
    L1 Transport & AEC: run Opus 20ms frames over WebRTC UDP with strict Acoustic Echo Cancellation before VAD so agent speech never self-triggers
  • •
    L2 Dual Turn-Taking: pair Silero VAD with a fast semantic End-of-Utterance (EoU) classifier to separate mid-thought pauses from completed turns
  • •
    L2 Instant Barge-In: upon 150ms confirmed user speech, emit immediate client audio-buffer flush and cancel in-flight LLM/TTS streams
  • •
    L3 Spoken-Offset Alignment: truncate unplayed LLM tokens from conversation history using client playback-ack timestamps so context matches what the user heard

📐 Mathematical Derivations

Hysteresis gating requires m≥3m \ge 3 consecutive non-echo frames above θhigh=0.75\theta_{\text{high}}=0.75 to fire interrupt; sentence-prefix chunking pipelines LLM token streaming directly into TTS vocoder frames.

🏭 Production Trade-offs

1) Semantic EoU adapts wait windows (250ms on complete questions vs 900ms on trailing conjunctions); 2) Keep LLM inference text-only vs native Speech-to-Speech depending on tool-calling reliability.
⚠️ Common Interview Pitfalls
  • ✕
    Leaving unplayed post-barge-in assistant tokens inside multi-turn prompt history
  • ✕
    Streaming raw PCM over TCP WebSockets, suffering multi-second head-of-line stalls on packet loss
🎯 Interviewer Follow-up Inquiries
  • ?
    How do you prevent background speakers in a noisy cafe from triggering false barge-in interrupts?
  • ?
    How should the orchestrator handle mid-tool-call user corrections arriving during a 1.5s API wait?
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
🎯 Drill This Card Now➔
📚

Associated Knowledge Base Guides & Mindmaps

← PreviousM9-032: Design a Multi-Tenant Distributed LoRA Adapter Hot-Swapping Serving Engine📋 Back to BankNext →M9-034: Design a Hybrid Real-Time Risk + Asynchronous Graph Fraud Ring Detection System