A caller stops for 700 ms to read the menu. A 300 ms silence timer cuts in. A 1,000 ms timer waits a full second after every answer. An agent that reads the words waits through the pause and answers 200 ms after the end.
Pick a listener, then drag the pause. Watch where each one starts to talk. Then we build, piece by piece, the voice detector, the endpointer, the trade-off curve, barge-in, backchannels and full-duplex models.
You need a little Python and what a probability is. It helps to know how audio becomes numbers. We build the rest from zero.
An illustrative timeline. The person answers after 200 ms: Stivers et al. (2009) found the most common answer delay between 0 and 200 ms in all ten languages they timed. The word reader is the toy endpointer from Chapter 4, with a 1,500 ms timeout.
Chapter 0
Feel why one silence timer must choose between cutting people off and leaving them in dead air
You call a pizza shop. A voice agent answers. You say "I'd like to order a" and stop to read the menu. After 700 ms of quiet the agent says "Great, placing that order now." You said five words.
The engineer raises the silence timer to 2 seconds. Now the agent never cuts in. But after every sentence you finish, you sit through 2 seconds of nothing. You say "Hello?", and that restarts the timer.
Turn detection is the decision that the other person has finished and that it is your turn to speak. The agent makes it on every turn, and both errors hurt. Too early is a cut-off: the agent talks over an unfinished sentence. Too late is dead air: silence the caller must sit through.
The agent waits for this much silence, then talks. Drag the threshold. Then make the caller pause longer or shorter.
An illustrative caller. Any threshold below the pause cuts in; any threshold above it costs its full length in dead air on every turn.
Set the pause to 0. Now a 200 ms threshold is perfect. That is the trap in testing: you read clean sentences to your own agent, and the timer works. Real callers stop to read card numbers, say "um" and think aloud.
How fast must the reply be? Stivers and colleagues (2009) timed answers to yes-or-no questions in ten languages. In every language the most common delay was between 0 and 200 ms. The mean ran from 7 ms in Japanese to 469 ms in Danish. People do not wait for the end and then plan. They predict the end and plan during the turn.
A cascaded agent runs speech recognition, then a language model, then speech synthesis. Each stage adds delay. The one delay the engineer chooses freely is the wait for the end of the turn. Chapter 5 counts it.
Failure. The symptom: callers often say "sorry, go on" or "hello?". Measure the silence before each agent reply, and count replies where the caller speaks again within one second. The fix is not a different timer. It is more evidence, from the sound (Chapter 3) and from the words (Chapter 4).
Chapter 1
Measure a real-shaped exchange with four words: speech run, pause, gap and overlap
Record one call. Mark when each person talks. Researchers who study conversation use four words for what they see. The Moshi paper (Défossez et al., 2024) uses the same four to score its dialogues.
| Word | What it is |
|---|---|
| IPU (inter-pausal unit) | A stretch of one person's speech with at least 0.2 s of silence on each side. |
| Pause | Silence between two IPUs of the same speaker. |
| Gap | Silence between IPUs of different speakers: the hand-over. |
| Overlap | Time when both speakers have an IPU running. |
One more word matters. A backchannel is a short sound such as "mm-hm" or "right" that means "keep going". It is speech, it overlaps, and it is not a bid for the turn.
Here is one exchange, in seconds from the start:
| Time (s) | Who | What |
|---|---|---|
| 0.00 to 1.35 | Caller | "Hi, I'd like to order a" |
| 2.05 to 3.40 | Caller | "large pepperoni pizza" |
| 3.62 to 6.10 | Agent | "Got it, one large pepperoni. Anything to drink?" |
| 5.40 to 5.66 | Caller | "mm-hm", during the agent |
The pause is 2.05 − 1.35 = 0.70 s. The gap is 3.62 − 3.40 = 0.22 s. How long do two speech runs overlap? Call the start and end of the first run a0 and a1, and of the second b0 and b1. Call the shared time O.
O equals the min of a-one and b-one, minus the max of a-zero and b-zero.
Shared time starts when the later run starts, at the max of a-zero and b-zero. It stops when the earlier run stops, at the min of a-one and b-one. Subtract to get O.
O = min(6.10, 5.66) − max(3.62, 5.40) = 5.66 − 5.40 = 0.26 s. Someone talks for 1.35 + 1.35 + 2.48 = 5.18 s, so the overlap is 0.26 / 5.18 = 5.0% of that time.
Teal is the caller, warm is the agent. Step through the labels. Then switch on the detector view.
The exchange from the table above, drawn to scale. The words and times are illustrative.
A pause and a gap are the same quiet air. Only what comes next tells them apart: the same speaker means pause, the other speaker means gap. Here the pause (0.70 s) is longer than the gap (0.22 s), so no silence threshold can tell them apart. The difference is in the words before each silence.
Overlap is normal. The Moshi paper cites 10 to 20% of spoken time in meetings as overlap (Çetin and Shriberg, 2006). A design that assumes people take strict turns ignores that share.
Failure. The symptom: the agent stops talking every time the caller says "mm-hm". Count agent stops that the caller answers with "go on" within two seconds. The fix is to treat short overlap as normal (Chapter 7).
Chapter 2
Turn each 10 ms of audio into one loudness number, threshold it, and hold the decision through short dips
Is there sound in this slice of audio? Answering that is voice activity detection (VAD). The oldest answer is a threshold on loudness.
Audio at 16 kHz is 16,000 numbers per second, and one number says nothing. So you cut the stream into frames of 10 to 30 ms. A 10 ms frame holds 160 numbers, and you make one decision per frame.
How loud is a frame? Call its numbers, the samples, x1 to xN, each between −1 and 1. Call its typical size RMS, the root mean square.
RMS equals the square root of one over N times the sum over i of x-i squared.
Square every sample x-i. Add the squares, then divide by N. Take the square root.
Frame 2 below: the squares add to 0.1320. Divided by N = 8 that is 0.0165. The square root gives RMS = 0.1285.
Loudness feels logarithmic, so convert RMS to decibels relative to full scale (dBFS). Call the level L.
L equals twenty times log ten of RMS.
Take log ten of RMS and multiply by 20. Each factor of 10 in RMS moves L by 20 dB.
RMS = 0.1285 gives L = 20 × (−0.891) = −17.83 dBFS. Frame 3, at −8.27 dBFS, is 30 dB above room tone.
Here are eight toy frames of 8 samples each. They hold room tone, a start, a vowel, the silent closure of a "p", a second vowel, then room tone. The threshold is −25 dBFS.
| Frame | Sum of squares | RMS | L (dBFS) | Loud? |
|---|---|---|---|---|
| 1 room | 0.0012 | 0.0122 | −38.24 | no |
| 2 start | 0.1320 | 0.1285 | −17.83 | yes |
| 3 vowel | 1.1904 | 0.3857 | −8.27 | yes |
| 4 "p" closure | 0.0044 | 0.0235 | −32.60 | no |
| 5 vowel | 0.6715 | 0.2897 | −10.76 | yes |
| 6 to 8 room | 0.0012, 0.0006 | 0.0122, 0.0087 | −38.24, −41.25 | no |
The raw decisions read 0 1 1 0 1 0 0 0. The word is cut in two at the "p". The fix is a hangover timer: after a loud frame, keep saying "speech" for H more frames. With H = 2, the detector holds frame 4 as speech and the word stays whole. The cost: the last loud frame is 5, but the detector declares silence only at frame 8. That is 2 frames of delay at the end of every turn.
Bars are the frame levels; the dashed line is the threshold. Raise the room noise.
Toy 8-sample frames stand in for real 160-sample frames. Noise adds power: the level becomes 10 × log ten of (10L/10 + 10N/10).
pythonimport numpy as np class EnergyVAD: def __init__(self, thr_db=-25.0, hangover=2): self.thr, self.H, self.h = thr_db, hangover, 0 def push(self, frame): # frame: float array, values in [-1, 1] rms = np.sqrt(np.mean(frame ** 2) + 1e-12) level = 20 * np.log10(rms) # dBFS loud = level > self.thr speech = loud or self.h > 0 # held if the countdown is still running self.h = self.H if loud else max(0, self.h - 1) return speech, level
Failure. The symptom: in a car the agent never answers. Room noise near −20 dBFS lifts every quiet frame over the threshold. Measure the level of frames you know are silent. Do not raise the threshold, or soft speech vanishes too. Track the noise floor and set the threshold 10 to 15 dB above it, or read shape (Chapter 3).
Chapter 3
Separate a fan from a voice by the shape of the spectrum, which does not change when the volume does
A fan and a vowel can be equally loud. You still hear the difference at once. Machinery puts most energy low. A voice puts strong energy in the middle band, where vowel shapes live, and turns on and off at the syllable rate.
A neural VAD reads that shape. A 30 ms frame at 16 kHz (480 samples) becomes 40 log-energy bands, shape (40,). Eight recent frames stack to (8, 40). A small network maps that to the probability of speech. Silero VAD, a common open model, is about two megabytes and handles a 30 ms chunk in under 1 ms on one CPU thread, per its README.
Here is a toy with four bands, b1 (lowest) to b4 (highest), in dBFS. Call the tilt t = b1 − b4: how much the low end beats the high end. Call the mid lift m: the mean of b2 and b3, minus b1. Both are band differences, so volume does not change them. Call the probability of speech p.
p equals sigma of zero point five m, minus zero point two five t, plus two.
Add half the mid lift m. Take away a quarter of the tilt t. Add 2. Squash the score with sigma to get p.
Fan bands −22, −31, −36, −41: m = −33.5 + 22 = −11.5 and t = 19. The score is −5.75 − 4.75 + 2 = −8.5, so p = 0.0002. Voice bands −24, −20, −23, −28: m = 2.5, t = 4, score 1.25 − 1 + 2 = 2.25, so p = 0.905.
An energy detector at −25 dBFS calls both frames speech: their loudest bands are −22 and −20. Turn the voice down 10 dB. Energy now says silence, but m and t do not move, so p stays 0.905. Quiet last syllables are where the end-of-turn decision lives.
Left: four bands. Right: the frame as a point; the line is p = 0.5. Drag the level.
An illustrative four-band toy with hand-set weights. A real VAD learns its weights from labelled audio.
A probability is not yet a decision. Real systems add hysteresis: enter speech when p rises above 0.5, leave only when it falls below 0.35, so a frame near the line does not flicker. They also drop speech shorter than about 100 ms (a click) and keep a hangover.
pythonimport math def p_speech(b1, b2, b3, b4): # four band levels in dBFS t = b1 - b4 # tilt: 19 for the fan, 4 for the voice m = (b2 + b3) / 2 - b1 # mid lift: -11.5 and 2.5 return 1 / (1 + math.exp(-(0.5 * m - 0.25 * t + 2))) def hysteresis(ps, on=0.5, off=0.35): # ps: per-frame probabilities speech, out = False, [] for p in ps: speech = p > off if speech else p > on out.append(speech) return out
Failure. The symptom: the VAD is excellent and callers are still cut off. A perfect VAD reports that "I'd like to order a" ended at 1.35 s, and it is right. Measure cut-offs per hundred turns, not VAD accuracy. The fix is the next chapter.
Chapter 4
Read the words for completeness, and let the bar for firing drop as the silence grows
Endpointing is the decision that ends the caller's turn and starts the reply. It takes VAD output as one input. The classic version counts silence and fires at a threshold. It fails on these:
| Words so far | Then silence, because | Silence timer |
|---|---|---|
| "I'd like to order a" | they read the menu | cuts in |
| "my account number is, um" | they find the card | cuts in |
| "it's four one seven" | digits come in chunks | cuts in |
| "yes" | they are done | waits its full length anyway |
A person knows the turn is ending before the silence starts. The cues, roughly strongest first:
A semantic endpointer reads the running transcript and outputs P(complete): the chance that the turn is over. Here is a toy built from five cues. Each cue is 1 if present and 0 if not, and the score goes through the sigma from Chapter 3.
| Cue | Weight | "I'd like to order a" | "...pepperoni pizza" | "my number is, um" |
|---|---|---|---|---|
| bias | −0.8 | −0.8 | −0.8 | −0.8 |
| ends on a word that needs more | −2.6 | −2.6 | 0 | 0 |
| ends on a complete word | +2.1 | 0 | +2.1 | 0 |
| has a main verb | +1.3 | +1.3 | +1.3 | +1.3 |
| ends on a filler | −1.7 | 0 | 0 | −1.7 |
| score, then P(complete) | −2.1, so 0.109 | 2.6, so 0.931 | −1.2, so 0.231 |
The fifth cue, a question form, adds +0.9. How sure must the model be? Early in a silence, demand a lot. As the silence grows, accept less. Call the silence so far s and the bar τ(s).
Tau of s equals zero point nine minus zero point six times the min of one and s over twelve hundred milliseconds.
Divide the silence s by 1,200 ms and cap it at 1. Multiply by 0.6 and subtract from 0.9. Fire when P(complete) beats tau of s, after at least 200 ms of silence. Fire anyway at a hard timeout of 1,500 ms.
At s = 200 ms, tau = 0.9 − 0.6 × 0.167 = 0.80. "Pizza" has P = 0.931, so it fires at 200 ms. "Order a" (0.109) and "is, um" (0.231) stay below the floor of 0.3. They wait for the 1,500 ms timeout.
Pick a sentence. Add words, then let the silence grow. The purple line is P(complete); the blue curve is the bar.
The cue weights are a hand-set toy, tagged by hand for these four sentences. Real turn models are neural networks that read the transcript, the audio, or both.
Research models also skip the words. Voice Activity Projection (Ekstedt and Skantze, 2022) predicts, from audio, both speakers' voice activity over the next 2 seconds. It uses 4 bins per speaker (200, 400, 600 and 800 ms), so 256 possible patterns.
pythonclass Endpointer: def __init__(self, frame_ms=20, min_sil=200, timeout=1500): self.f, self.min_sil, self.timeout = frame_ms, min_sil, timeout self.s, self.p = 0, 0.0 def on_partial(self, text): # streaming ASR text so far self.p = turn_model.p_complete(text) def on_frame(self, is_speech): # one VAD decision per frame self.s = 0 if is_speech else self.s + self.f if self.s < self.min_sil: return False # never fire inside a word tau = 0.9 - 0.6 * min(1, self.s / 1200) return self.p > tau or self.s >= self.timeout # the timeout fires even if the model fails
Failure. The symptom: median reply time is fast, but a cluster of replies sits at exactly the timeout. The callers had finished, but the model said "not done", often on accents or a bad line. Measure the reply-time histogram per turn and look for a spike at 1,500 ms. Fix the model on that audio, or shorten the timeout.
Chapter 5
Price cut-offs and waiting in one unit, find the cheapest threshold, and see what better evidence buys
Log the silences that happen while callers are not finished. It sets your threshold, and it changes with the task. Here is an illustrative table of the share of turns with a mid-turn pause of length L or longer.
| L | 200 ms | 400 | 600 | 800 | 1,000 | 1,400 |
|---|---|---|---|---|---|---|
| Share of turns | 0.35 | 0.18 | 0.09 | 0.04 | 0.02 | 0.008 |
With a threshold, every turn with a pause that long is cut off, and every turn pays the threshold as delay. Put both in one unit. Call the threshold T, the table's share S(T), the price of one cut-off wcut and the price of one second of waiting wwait. Call the expected cost per turn C(T).
C of T equals w-cut times S of T, plus w-wait times T.
Multiply S of T by w-cut. Multiply the wait T by w-wait. Add them, and pick the T with the smallest C of T.
T = 0.2 s: 0.35 + 0.10 = 0.45. T = 0.4 s: 0.18 + 0.20 = 0.38. T = 0.6 s: 0.09 + 0.30 = 0.39. T = 1.0 s: 0.02 + 0.50 = 0.52. The bottom sits at 400 to 600 ms, and the bowl is shallow.
The prices set the answer. For a crisis line, set wcut = 4: 400 ms costs 0.92 and 800 ms costs 0.56, the best in the table. For a quiz game, wcut = 0.3: 200 ms costs 0.205 and wins.
Now add the semantic endpointer at T = 200 ms. Say it catches 80% of mid-turn pauses: its recall is 0.8. On 10% of finished turns it wrongly waits for the 1,500 ms timeout. Cut-offs: 0.35 × 0.2 = 0.07. Mean wait: 0.9 × 200 + 0.1 × 1,500 = 330 ms. Cost: 0.07 + 0.165 = 0.235, 38% below the best timer. A timer alone needs about 680 ms to reach 0.07 cut-offs.
Left: the chance of a cut-off. Right: total cost, red for cut-offs and yellow for waiting. The purple dot is the semantic endpointer. Lower its recall.
The pause table is illustrative, joined by straight lines. Waiting costs 0.5 per second. The semantic point sends 10% of finished turns to a 1,500 ms timeout.
Look at percentiles. The semantic system replies at 200 ms on 90% of turns and at 1,500 ms on 10%. Its 95th percentile (p95) is 1,500 ms.
Where does a cascaded reply spend its time? Typical ranges, illustrative:
| Stage | Fast | Slow |
|---|---|---|
| End-of-turn wait | 200 ms | 800 ms |
| Speech recognition final | 30 ms | 80 ms |
| Language model first token | 150 ms | 300 ms |
| Speech synthesis first audio | 100 ms | 200 ms |
| Network and buffers | 40 ms | 150 ms |
| Total | 520 ms | 1,530 ms |
The wait is 38% of the fast total and 52% of the slow one: the largest line, and the only choice. If you can cancel every later stage cleanly, you can start them early and drop the work when the caller goes on. Chapter 6 builds that cancel.
Chapter 6
Tear down four running systems in the right order, and keep only the words the caller heard
Barge-in is the caller's power to cut into the agent's reply and be heard. Picture the moment. The agent is 1.2 s into an 8 s reply, and four things are running:
The usual first bug is to stop synthesis and nothing else. The caller hears the agent for hundreds of milliseconds more, the model keeps billing tokens, and the order goes through. The teardown, in order:
Step 5 is the one teams forget. The model wrote "Your order is one large pepperoni pizza, a garlic bread and a cola." The caller heard "Your order is one large pepperoni" and said "no, make it margherita". If the full text goes into history, the model believes it announced the bread and the cola. To cut the text, you need the playout position: how much audio reached the speaker. Call the audio sent Asent and the audio still in buffers Abuf.
A-played equals A-sent minus A-buf.
Take what you sent, A-sent, and subtract what never left the buffers, A-buf. Keep each word whose start time is below A-played. Mark the reply as cut.
With made-up numbers: A-sent = 1,700 ms and A-buf = 460 ms. So A-played = 1,240 ms. The words start at 0, 230, 520, 640, 810, 1,090 and 1,600 ms. Six start before 1,240: "Your order is one large pepperoni". A cut at A-sent would keep "pizza", which the caller never heard.
pythonasync def on_barge_in(s): played = s.sent_ms - s.buffered_ms # read before the flush await s.transport.clear_output() # 1. audible first s.tts_task.cancel(); s.llm_task.cancel() # 2, 3. stop paying for call in s.inflight_tools: # 4. reads drop, writes are idempotent if not call.mutating: call.cancel() heard = " ".join(w.text for w in s.word_times if w.start_ms < played) s.history[-1] = {"role": "assistant", "content": heard + " [interrupted]"} # 5. repair s.state = "LISTEN"
Now play the caller. The agent runs the policy you pick. Speak, more to come says an unfinished phrase. Pause, then finish waits 700 ms and completes it. Mm-hm is a backchannel. Interrupt is a real takeover.
Pick a policy and press a caller button, or Run the scenario. The row of states on top lights as the agent moves through them.
A toy simulator. Phrases last 1.2 s and replies 2.4 s. The cascaded pipeline adds 300 ms after the endpoint, and a cascaded stop takes 300 ms; full duplex stops in one 80 ms frame. The full-duplex policy is an ideal, not a measured model.
Try this. Under Timer 200 ms, press Speak, more to come, then Pause, then finish: the agent cuts in. While the agent talks, press Mm-hm: both timers stop dead. Then press Interrupt and compare how fast each policy goes quiet.
Failure. The symptom: the agent mentions things the caller never heard, three turns later. Measure by comparing the saved assistant text with the playout log for cut replies. The fix is step 5, using A-played and not A-sent.
Chapter 7
Score an overlapping sound for takeover, then set the stop line from the two costs, not at one half
The agent is talking. The microphone lights up. Within a few hundred milliseconds you must decide: "stop, I want the turn" or "keep going, I follow". Wait too long and you talk over a person who is correcting you. Stop too easily and you freeze at every "mm".
| Signal | Backchannel | Takeover |
|---|---|---|
| Duration | short, about 0.2 to 0.4 s | keeps going |
| Loudness, against the caller's own normal | quiet | louder |
| First word | "mm-hm", "yeah", "right" | "wait", "no", "hold on" |
| Where in your sentence | at a phrase break | right after something wrong |
A toy score uses three of them. Call the burst's duration in seconds d. Call its loudness e, from 0 (much quieter than usual) to 1 (much louder). Let b be 1 if the first word is a backchannel word. The score is z = −2.4 + 3.0d + 1.6e − 2.2b, and P(takeover) is sigma of z.
| Case | d | e | b | z | P(takeover) |
|---|---|---|---|---|---|
| A: soft "mm-hm" | 0.25 | 0.35 | 1 | −3.29 | 0.036 |
| B: loud "wait, no" | 0.55 | 0.85 | 0 | 0.61 | 0.648 |
| C: loud, long "yeah, but" | 0.80 | 0.90 | 1 | −0.76 | 0.319 |
Case C is unsure. Should you stop at 0.319? Price the two mistakes. Call the cost of talking over a real takeover Cmiss and the cost of stopping for a backchannel Cfalse. Stop when the expected cost of going on, P × Cmiss, beats the expected cost of stopping, (1 − P) × Cfalse. Solve for the line P*.
P-star equals C-false over C-miss plus C-false.
Add the two costs. Divide the cost of a false stop, C-false, by that total. The cheaper a false stop is, the lower P-star sits and the sooner you stop.
With made-up costs C-miss = 5 and C-false = 1: P-star = 1 / 6 = 0.167. Case A (0.036) keeps talking. Cases B (0.648) and C (0.319) stop. At equal costs P-star would be 0.5, and C would keep talking over the caller.
Shaded red is where the agent stops. The ring is your burst. Flip the backchannel word and drag the cost ratio.
Illustrative weights and costs. Dots A, B and C are the table's cases. A hollow dot has a different first word from the toggle.
A softer move than a hard stop is to duck: drop the agent's volume by about 12 dB while the evidence comes in. If it was "mm-hm", fade back up. If it was a takeover, the stop lands smoothly. People do the same when someone starts to talk over them.
Failure. The symptom: callers repeat "wait, wait" louder while the agent keeps talking. Measure overlaps where the caller speaks for over a second while the agent goes on. The fix is to write down the two costs and set P* from them; do not leave the line at 0.5.
Chapter 8
Model both voices as token streams that never stop, and count where Moshi's 160 ms comes from
We built seven parts, and all of them rebuild turn boundaries that the design made. The agent can only listen or speak, so it must decide when to switch. People hear while they talk.
A full-duplex model listens and speaks at the same time, always. Kyutai's Moshi (Défossez et al., 2024) is a clear case. Its audio codec, Mimi, turns speech into tokens at 12.5 frames per second, so one frame is 80 ms. Each frame has 8 tokens from 8 codebooks. Training makes the first carry meaning, distilled from WavLM; the others carry the sound of the voice.
Moshi models two audio streams together: the caller's and its own. Both advance every 80 ms. At each frame it predicts its own next tokens from both streams. Silence is a token like any other, and nothing decides "the turn ended".
It also writes text tokens a little ahead of its own audio: the Inner Monologue, which improves quality. A large Temporal Transformer runs once per frame; a small Depth Transformer makes the 8 tokens inside it.
Where does the latency come from? Call the frame length f and the acoustic delay, the number of frames the voice tokens lag the meaning token, d. Call the theoretical latency L.
L equals f times one plus d.
Wait one frame f for the sound to arrive. Then wait d more frames for the voice tokens. Add them: f times one plus d.
f = 80 ms and d = 1 give L = 80 × 2 = 160 ms, the paper's theoretical figure; it reports 200 ms in practice. The paper's ablation lists 80 ms for d = 0 and 240 ms for a delay of 2.
The paper compares this with a 230 ms average gap in natural conversation, citing Stivers et al. (2009). With no end-of-turn wait, the agent works inside human timing.
Each cell is one 80 ms frame. Filled cells are speech; hollow cells are silence tokens, still predicted. Move the playhead, then change the delay.
The layout follows the Moshi paper: two audio streams, text tokens, and voice tokens trailing the meaning token by d frames. Which frames hold speech is an illustrative exchange with one barge-in. The drawing folds the 7 voice codebooks into one row.
| Property | Cascaded | Full duplex |
|---|---|---|
| End-of-turn wait | yes, tuned | none |
| Overlap and backchannels | added with classifiers | learned from data |
| Tone, emotion, laughter | lost at the text step | kept |
| Readable transcript at every step | yes | only the text stream, if there is one |
| Swap one part | easy | retrain |
Failure. The symptom: a full-duplex agent talks on when the caller interrupts, or jumps into pauses. Measure pause handling and interruption handling as separate scores, as Full-Duplex-Bench does (see the PersonaPlex lesson). The fix is in the training data and objective.
Chapter 9
Keep the numbers, the symptoms, the checklist and the code in one place
A VAD finds speech in each frame. An endpointer decides the caller is done, from silence plus the words. A threshold trades cut-offs for dead air; new evidence moves the whole trade. Barge-in is five steps, ending with the context repair. Full-duplex models remove the switch but still must learn when to yield.
| Term | Rule or number |
|---|---|
| Frame | 10 to 30 ms; 160 to 480 samples at 16 kHz |
| Level | L = 20 × log ten of RMS, in dBFS |
| Energy threshold | noise floor plus 10 to 15 dB, with a hangover |
| Neural VAD | on at p > 0.5, off at p < 0.35 |
| Endpoint bar | τ(s) = 0.9 − 0.6 × min(1, s / 1200 ms), at least 200 ms of silence, timeout 1,500 ms |
| Threshold cost | C(T) = wcut × S(T) + wwait × T |
| Playout position | A-played = A-sent − A-buf |
| Stop line | P* = Cfalse / (Cmiss + Cfalse); 0.167 at 5 : 1 |
| Human answer delay | most common 0 to 200 ms in ten languages; means 7 to 469 ms (Stivers et al., 2009) |
| Moshi latency | 80 ms × (1 + 1) = 160 ms theoretical, 200 ms in practice |
| Symptom | Usual cause and fix |
|---|---|
| Cuts callers off mid-sentence | Threshold below the pause tail. Add semantic endpointing before you raise T. |
| Never answers in a car | Energy VAD rides the noise. Use a neural VAD; do not raise the threshold. |
| p95 reply time equals the timeout | The turn model says "not done" too often. Measure its recall on your audio. |
| Talks 300 ms after the caller cuts in | Generation stopped but buffers were not flushed. |
| Stops at every "mm-hm" | No overlap check. Add duration, loudness and the first word, and duck. |
| Refers to things it never said | No context repair. Cut the reply at A-played. |
| Double orders after interruptions | A write fired before the confirmation was spoken. Make writes idempotent and late. |
| A word split into two turns | No hangover, or a minimum silence shorter than a consonant closure. |
pythonimport math sigma = lambda z: 1 / (1 + math.exp(-z)) def should_reply(p_complete, silence_ms, min_sil=200, timeout=1500): if silence_ms < min_sil: return False tau = 0.9 - 0.6 * min(1, silence_ms / 1200) return p_complete > tau or silence_ms >= timeout def should_stop(dur_s, loud, is_backchannel_word, c_miss=5.0, c_false=1.0): p = sigma(-2.4 + 3.0 * min(dur_s, 1.5) + 1.6 * loud - 2.2 * is_backchannel_word) return p > c_false / (c_miss + c_false) # 0.167, not 0.5 print(should_reply(sigma(2.6), 200)) # True: "...pepperoni pizza" fires at 200 ms print(should_stop(0.80, 0.90, 1)) # True: case C, P = 0.319 > 0.167
| Lesson | What it adds |
|---|---|
| Moshi | The full paper: Mimi, the RQ-Transformer, delays and Inner Monologue |
| PersonaPlex | Voice and role control for full-duplex models, and Full-Duplex-Bench |
| The Voice Agent Stack | The product view: the whole latency ledger, telephony, evals |
| Streaming Speech | Real-time recognition and synthesis, the stages around the endpoint |
| Audio Representations | Frames, spectra and mel bands under every VAD |
| Neural Audio Codecs | How a waveform becomes 12.5 Hz tokens |
| TTS Architectures | Why first-audio time behaves as it does |
| Whisper | The recognition side |
| Agents and Tool Use | Cancellation and idempotent tools in general |
| VALL-E | Where speech tokens for language models began |
Stivers et al., Universals and cultural variation in turn-taking in conversation, PNAS 106(26), 2009, doi:10.1073/pnas.0903616106. Défossez et al., Moshi: a speech-text foundation model for real-time dialogue (2024). Ekstedt and Skantze, Voice Activity Projection: Self-supervised Learning of Turn-taking Events, 2022. Çetin and Shriberg, Analysis of overlaps in meetings by dialog factors, hot spots, speakers, and collection site (2006), as cited by the Moshi paper. The Silero VAD README.
Now press Present or Teach. Explain from memory why a timer cannot win, how the bar falls, and the five barge-in steps. Then go back to the four listeners and say why the word reader can wait through a 1,200 ms pause but not a 1,600 ms one.