Speech-to-Speech and Expressive Voice › The latency budget of a conversational speech agent

Michael BrenndoerferDecember 1, 20266 min read
Language AI HandbookAll chapters
Part 52 of 67Omni-Modal and Embodied Language Systems
Chapter 402Speech-to-Speech and Expressive Voice › The latency budget of a conversational speech agent
Reading section 4 of 14 · The latency budget of a conversational speech agent · 6 minSection 4 of 14 · 6 min

Section 4 of 14 · 6 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Three measurements help locate a delay in a voice interaction.

  • End-of-turn detection delay. How long after the user stops talking the system decides the user is done.
  • Time to first audio byte (TTFAB). Measure when the first audio bytes reach a named boundary. Separately measure when the first sample plays. State whether the clock starts at the true end of the user's speech or at the detector's decision.
  • Real-time factor (RTF). The ratio of processing time to audio duration for the rest of the response.

A short silence threshold may cut off users who pause within a sentence. A longer threshold makes the detector wait longer after a complete turn. Measure both outcomes on the users, languages and noise conditions the product supports.

The end-of-turn threshold is a single number that controls two competing failures: cutting the user off (a false end-of-turn) and adding dead air to every turn. Two quantities summarize the tradeoff:

  • False-cutoff rate: the fraction of utterances where an intra-sentence pause exceeds the threshold.
  • Added dead air: the wait introduced after a clean end of turn.

We can make that tradeoff explicit by sweeping the threshold and counting, over a simulated set of utterances with mid-sentence pauses, how often we cut in and how much delay we add.

We simulate utterances as a sequence of speech spans separated by intra-utterance pauses drawn from a fixed distribution. The end-of-turn rule is: declare the turn over when the observed silence exceeds the threshold. A pause above the threshold counts as a false cutoff; the final silence is a true cutoff. All sampling uses default_rng(11) so the numbers reproduce exactly.

PythonIn [8]
CollapseExpand
rng_eot = np.random.default_rng(11)
n_utt = 4000

# Each utterance has 1-4 mid-sentence pauses; the last gap is the true end.
n_pauses = rng_eot.integers(1, 5, size=n_utt)
pause_seconds = rng_eot.gamma(shape=2.0, scale=0.18, size=n_pauses.sum())

thresholds_ms = np.arange(100, 1001, 25)
false_cutoff_rate = []
mean_added_delay_ms = []

idx = 0
per_utt_pauses = []
for k in n_pauses:
    per_utt_pauses.append(pause_seconds[idx : idx + k])
    idx += k

for thr in thresholds_ms:
    cut = 0
    for pauses in per_utt_pauses:
        # A pause longer than the threshold triggers a premature end-of-turn.
        if np.any(pauses > thr / 1000.0):
            cut += 1
    false_cutoff_rate.append(cut / n_utt)
    # Added dead air on a clean turn is just the threshold itself.
    mean_added_delay_ms.append(float(thr))

false_cutoff_rate = np.array(false_cutoff_rate)
mean_added_delay_ms = np.array(mean_added_delay_ms)
VisualizationOut [9]
CollapseExpand
Line chart of false-cutoff fraction decreasing while added delay increases linearly with threshold.
Longer toy silence thresholds flag fewer utterances as prematurely ended and add more wait after a true end. The rates follow the fixture’s generated pause distribution.

In the generated sample, a 200 ms rule cuts off about 89% of utterances and a 700 ms rule cuts off about 22%. A cutoff means that at least one mid-turn pause exceeds the threshold. The threshold equals the added wait after a clean end under this toy rule. More cues may help, so compare them with the threshold rule on the same examples.

A cascade can overlap recognition, text generation and synthesis when its modules accept partial inputs. Partial transcripts can change before commitment. Measure actual first audio time after any buffering and keep the endpoint policy explicit.

Real-time factor divides wall-clock generation time by audio duration. A factor of 0.1 means a generator produces ten seconds of audio per second in the stated measurement interval. Streaming playback and generation may overlap. A low average factor can still hide a late chunk, so record individual playout deadlines.

The following code computes these numbers for a toy streamed response so you can see how they compose. We'll model the audio production as a sequence of chunks arriving at fixed wall-clock intervals.

PythonIn [10]
CollapseExpand
# All times use the true end of the user's speech as zero.
chunk_audio_ms = 300
n_chunks = 40
eot_detection_ms = 400
first_ready_after_detection_ms = 600
startup_buffer_ms = 400
processing_ms_per_chunk = 80

first_ready_ms = eot_detection_ms + first_ready_after_detection_ms
arrival_ms = first_ready_ms + np.arange(n_chunks) * processing_ms_per_chunk
playout_ms = (
    first_ready_ms + startup_buffer_ms + np.arange(n_chunks) * chunk_audio_ms
)
margins = (playout_ms - arrival_ms) / 1000
on_time = arrival_ms <= playout_ms
ConsoleOut [11]
CollapseExpand
Chunks on time: 40/40
Audio duration: 12.00 s
First playable sample after the true end: 1.40 s
Last chunk ready after the true end: 4.12 s
Playback ends after the true end: 13.40 s
Generation RTF after first chunk: 0.27

The first chunk's arrival completes at 1.00 s and it plays at 1.40 s after the 400 ms startup buffer. All 40 chunks meet their deadlines. The last chunk is ready (arrival complete) at 4.12 s, while playback of the 12-second response finishes at 13.40 s.

VisualizationOut [12]
CollapseExpand
Line chart of playout time minus arrival time across chunk index, staying positive throughout the streamed response.
Playout deadline minus arrival time for each synthetic chunk. Generation takes 80 ms per 300 ms of audio, so this margin grows from the configured 400 ms buffer.

The initial margin is the 0.40 s startup buffer. Each deadline advances by 0.30 s and each arrival advances by 0.08 s, adding 0.22 s of margin per chunk. A negative margin would indicate a missed playout deadline.

Why latency is part of modeling, not just engineering

Measure first audio from the same starting event when comparing systems. A favorable model-generation number can coexist with a long gap at the listener if a detector waits for silence or the player buffers before starting.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy