Sub topic 15
Realtime speech models versus a cascaded pipeline
This chapter assumes you have built the turn-based voice loop from earlier chapters: transcribe with a speech-to-text (STT) call, send the text to a chat model, then synthesize the reply with a text-to-speech (TTS) call. Here you compare that design with a realtime speech-to-speech model and decide which one fits your app.
Two architectures
A cascaded pipeline chains three separate models. Each stage finishes its work and passes text to the next stage.
A realtime speech-to-speech model takes audio in and produces audio out through one model, usually over a persistent connection such as WebSocket or WebRTC. The model hears the audio directly, so it can react to tone, pauses, and interruptions. It does not have to wait for a finished transcript.
Comparing the trade-offs
| Concern | Cascaded pipeline | Realtime model |
|---|---|---|
| Latency | Sum of three stages, often one to several seconds per turn | Often a few hundred milliseconds to first audio |
| Interruptions | You must build voice activity detection and cancel playback yourself | Usually handled by the session |
| Control | Pick each model, voice, and prompt separately | One vendor model and a fixed set of voices |
| Inspection | Full text between stages, easy to log, filter, and test | Less visible, though most services can also return a transcript |
| Cost | Per-stage pricing, cheap models possible | Audio tokens, often higher per minute |
| Accuracy checks | Measure STT with word error rate on its own | Harder to isolate one stage |
| Tool use | Standard text tool calling | Supported, but the details vary by service |
Treat the figures as typical, not guaranteed. Measure your own latency with the budget method from the earlier chapter.
Why the cascade still matters
The cascade gives you a text checkpoint between stages. You can:
- Run a moderation or policy check on the transcript before the LLM sees it.
- Redact personal data before the text is stored.
- Swap in a different chat model without changing audio code.
- Replay logged transcripts as regression tests.
Realtime models reduce those checkpoints. Transcripts from a realtime session are still untrusted input, and any tool the model can call needs the same permission limits you set in a cascaded design.
Deciding which to use
Use a decision order that starts with your hardest requirement.
- If users expect natural back-and-forth and will interrupt, such as a phone agent, start with a realtime model.
- If you must audit, filter, or edit text before the model acts, use a cascade.
- If you need a specific voice, language, or reasoning model that no realtime service offers, use a cascade.
- If turns are naturally batch-like, such as voicemail summaries or dictated notes, a cascade is simpler and cheaper.
- If you are unsure, prototype both on ten real recordings and compare latency, cost, and answer quality.
You can also mix them. Some apps use a realtime model for the conversation and run a separate STT pass on the saved audio for accurate records.
Common mistakes
- Choosing realtime only because it sounds newer. If your users tolerate a two-second pause, the extra cost may buy nothing.
- Comparing a realtime demo with an unoptimized cascade. Stream the TTS output and use a fast chat model first.
- Dropping disclosure and consent practices. Synthetic voices still need disclosure, and recordings still need consent.
Exercise
A hospital wants a voice assistant that books appointments. Legal requires that the system remove patient names from text before any model processes it, and that every turn is logged as text. Which architecture fits, and why?
Show answer
A cascaded pipeline. It produces a text transcript between stages, so you can redact names and write the log before the LLM sees the content. A realtime model processes audio directly, which makes this checkpoint harder to enforce. If latency later proves too high, optimize the cascade with streaming and faster models before switching.
Exercise
Your cascaded voice agent takes about 2.5 seconds to start replying, and users complain it feels slow. Name two changes you could try before moving to a realtime model.
Show answer
Stream the TTS output so playback starts before synthesis finishes, and use a faster, smaller chat model with a short-answer system prompt. Streaming the LLM reply into TTS sentence by sentence is also valid.