Turn-Taking, Endpointing and Barge-In

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.

Choose who decides when to talk

700 ms

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

The Two-Second Silence

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.

Find a threshold that never fails

The agent waits for this much silence, then talks. Drag the threshold. Then make the caller pause longer or shorter.

300 ms
700 ms

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).

The road

  1. What a turn is: speech runs, pauses, gaps and overlaps.
  2. Energy detection: is this 10 ms loud?
  3. Neural detection: is this 10 ms speech?
  4. Endpointing: is this person finished?
  5. The trade-off curve: price cut-offs and dead air in one unit.
  6. Barge-in: stop talking cleanly when the caller cuts in. The showcase.
  7. Backchannel or interrupt: "mm-hm" is not a takeover.
  8. Full duplex: a model that listens while it talks.
  9. Field guide: numbers, symptoms, code and links.
Why can no single silence threshold fix the pizza call?

Chapter 1

What Is a Turn?

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.

WordWhat it is
IPU (inter-pausal unit)A stretch of one person's speech with at least 0.2 s of silence on each side.
PauseSilence between two IPUs of the same speaker.
GapSilence between IPUs of different speakers: the hand-over.
OverlapTime 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)WhoWhat
0.00 to 1.35Caller"Hi, I'd like to order a"
2.05 to 3.40Caller"large pepperoni pizza"
3.62 to 6.10Agent"Got it, one large pepperoni. Anything to drink?"
5.40 to 5.66Caller"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.

Say it aloud

O equals the min of a-one and b-one, minus the max of a-zero and b-zero.

O
O the overlap in seconds. If the result is below zero, the runs do not touch and the overlap is 0.
min
the min of the smaller of two numbers: the run that ends first.
a1
a-one the end of the first run: the agent's reply, 6.10 s.
b1
b-one the end of the second run: the "mm-hm", 5.66 s.
max
the max of the larger of two numbers: the run that starts last.
a0
a-zero the start of the first run, 3.62 s.
b0
b-zero the start of the second run, 5.40 s.
In plain words

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.

With numbers

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.

Label the silences

Teal is the caller, warm is the agent. Step through the labels. Then switch on the detector view.

pause

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).

A caller speaks, is quiet for 0.7 s, then goes on with the same sentence. What is that 0.7 s?

Chapter 2

Energy Detection, Built by Hand

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.

Say it aloud

RMS equals the square root of one over N times the sum over i of x-i squared.

√
the square root of undoes the squaring.
1/N
one over N divide by the number of samples N to get the mean. Here N = 8.
Σi
the sum over i add one term for each sample, i from 1 to N.
xi2
x-i squared sample i times itself, so negative swings count too.
In plain words

Square every sample x-i. Add the squares, then divide by N. Take the square root.

With numbers

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.

Say it aloud

L equals twenty times log ten of RMS.

L
L the frame level in dBFS; 0 is the loudest the format holds.
20
twenty 20, not 10, because RMS is an amplitude and power is amplitude squared.
log10
log ten of the power of ten that gives the number: log ten of 0.01 is −2.
RMS
RMS the frame's root mean square from above.
In plain words

Take log ten of RMS and multiply by 20. Each factor of 10 in RMS moves L by 20 dB.

With numbers

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.

FrameSum of squaresRMSL (dBFS)Loud?
1 room0.00120.0122−38.24no
2 start0.13200.1285−17.83yes
3 vowel1.19040.3857−8.27yes
4 "p" closure0.00440.0235−32.60no
5 vowel0.67150.2897−10.76yes
6 to 8 room0.0012, 0.00060.0122, 0.0087−38.24, −41.25no

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.

Tune the threshold, the hangover and the room

Bars are the frame levels; the dashed line is the threshold. Raise the room noise.

−25 dB
2 frames
off

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).

A hangover of H frames holds "speech" after the level drops. What does it buy, and what does it cost?

Chapter 3

From Loud to Speech

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.

Say it aloud

p equals sigma of zero point five m, minus zero point two five t, plus two.

p
p the probability that this frame is speech, from 0 to 1.
σ
sigma of the logistic squash, 1 / (1 + e−z): it maps any score z to a number between 0 and 1.
0.5
zero point five the weight on mid lift.
m
m the mid lift in dB: the mean of b-two and b-three, minus b-one.
0.25
zero point two five the weight on tilt, subtracted: bass-heavy sound counts against speech.
t
t the tilt in dB: b-one minus b-four.
2
two the bias.
In plain words

Add half the mid lift m. Take away a quarter of the tilt t. Add 2. Squash the score with sigma to get p.

With numbers

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.

Turn the volume and watch which verdict holds

Left: four bands. Right: the frame as a point; the line is p = 0.5. Drag the level.

0 dB

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.

A fan and a vowel have the same frame energy. What lets a neural VAD separate them?

Chapter 4

Endpointing Is Not VAD

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 farThen silence, becauseSilence timer
"I'd like to order a"they read the menucuts in
"my account number is, um"they find the cardcuts in
"it's four one seven"digits come in chunkscuts in
"yes"they are donewaits 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.

CueWeight"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.600
ends on a complete word+2.10+2.10
has a main verb+1.3+1.3+1.3+1.3
ends on a filler−1.700−1.7
score, then P(complete)−2.1, so 0.1092.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).

Say it aloud

Tau of s equals zero point nine minus zero point six times the min of one and s over twelve hundred milliseconds.

τ(s)
tau of s the bar: fire when P(complete) is above it.
0.9
zero point nine the bar at the first instant of silence.
0.6
zero point six how far the bar falls in total, so it ends at 0.3.
min
the min of the smaller of two numbers. It stops the fall at 1, so the bar never drops below 0.3.
s
s the silence so far, in milliseconds, counted by the VAD.
1200 ms
twelve hundred milliseconds how long the bar takes to fall all the way.
In plain words

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.

With numbers

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.

Speak word by word and watch when it fires

Pick a sentence. Add words, then let the silence grow. The purple line is P(complete); the blue curve is the bar.

5
400 ms

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.

Why can a semantic endpointer be faster on easy turns and safer on hard ones, when a silence timer cannot?

Chapter 5

The Trade-off Curve

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.

L200 ms4006008001,0001,400
Share of turns0.350.180.090.040.020.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).

Say it aloud

C of T equals w-cut times S of T, plus w-wait times T.

C(T)
C of T the expected cost of one turn.
wcut
w-cut the price of one cut-off. Here 1.0.
S(T)
S of T the chance of a cut-off: the table's share for T.
wwait
w-wait the price of one second of waiting: 0.5, so a cut-off hurts like 2 s of dead air.
T
T the threshold in seconds, paid on every turn.
In plain words

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.

With numbers

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.

Walk the threshold and price the turns

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.

500 ms
1.0
0.80

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:

StageFastSlow
End-of-turn wait200 ms800 ms
Speech recognition final30 ms80 ms
Language model first token150 ms300 ms
Speech synthesis first audio100 ms200 ms
Network and buffers40 ms150 ms
Total520 ms1,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.

A semantic endpointer has a median reply of 200 ms and a p95 of 1,500 ms, the same as its timeout. What does that tell you?

Chapter 6

Barge-In: Stop Talking Cleanly

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:

  1. Audio sits in buffers. Synthesis made 3 s of sound; about 1.2 s has reached the ear. The rest waits in send queues, the network and the phone's jitter buffer.
  2. Speech synthesis is still making audio.
  3. The language model is still writing tokens.
  4. A tool call may be running, such as a request that places an order.

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:

  1. Flush the outgoing audio first. It is the only step the caller hears.
  2. Cancel the synthesis request.
  3. Cancel the model stream. Check that cancel reaches the server.
  4. Cancel tools you can. A read is safe to drop. A write is not; give it an idempotency key and fire it only after the agent has said the confirmation.
  5. Repair the context. Keep only what the caller heard.

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.

Say it aloud

A-played equals A-sent minus A-buf.

Aplayed
A-played milliseconds of reply audio that reached the caller's ear.
Asent
A-sent milliseconds of reply audio the server has sent.
Abuf
A-buf milliseconds still waiting in queues and jitter buffers. The flush throws it away.
In plain words

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 numbers

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.

Play the caller against four policies

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.

Which teardown step is most often forgotten, and what does that break?

Chapter 7

Backchannel or Interrupt?

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".

SignalBackchannelTakeover
Durationshort, about 0.2 to 0.4 skeeps going
Loudness, against the caller's own normalquietlouder
First word"mm-hm", "yeah", "right""wait", "no", "hold on"
Where in your sentenceat a phrase breakright 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.

CasedebzP(takeover)
A: soft "mm-hm"0.250.351−3.290.036
B: loud "wait, no"0.550.8500.610.648
C: loud, long "yeah, but"0.800.901−0.760.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*.

Say it aloud

P-star equals C-false over C-miss plus C-false.

P*
P-star the stop line: stop talking when P(takeover) is above it.
Cfalse
C-false the cost of stopping for a mere backchannel: a short gap, then you resume. Here 1.
Cmiss
C-miss the cost of talking over a person who wants the turn. Here 5.
+ Cfalse
plus C-false the two costs together set the scale.
In plain words

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 numbers

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.

Move the burst and price the mistakes

Shaded red is where the agent stops. The ring is your burst. Flip the backchannel word and drag the cost ratio.

0.25 s
0.35
5 : 1

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.

Talking over a real takeover costs 5. Stopping for a backchannel costs 1. At what P(takeover) should the agent stop?

Chapter 8

Full Duplex: No Turns to Detect

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.

Say it aloud

L equals f times one plus d.

L
L the theoretical latency of a reply.
f
f the frame length: 80 ms for Mimi. Mimi needs the whole frame before it can encode it.
d
d the acoustic delay in frames: how far the voice tokens trail the meaning token. Moshi uses 1 after fine-tuning.
In plain words

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.

With numbers

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.

Scrub the streams and set the delay

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.

1.52 s

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.

PropertyCascadedFull duplex
End-of-turn waityes, tunednone
Overlap and backchannelsadded with classifierslearned from data
Tone, emotion, laughterlost at the text stepkept
Readable transcript at every stepyesonly the text stream, if there is one
Swap one parteasyretrain

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.

Why does a full-duplex model like Moshi need no VAD and no endpointer?

Chapter 9

Field Guide

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.

TermRule or number
Frame10 to 30 ms; 160 to 480 samples at 16 kHz
LevelL = 20 × log ten of RMS, in dBFS
Energy thresholdnoise floor plus 10 to 15 dB, with a hangover
Neural VADon 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 costC(T) = wcut × S(T) + wwait × T
Playout positionA-played = A-sent − A-buf
Stop lineP* = Cfalse / (Cmiss + Cfalse); 0.167 at 5 : 1
Human answer delaymost common 0 to 200 ms in ten languages; means 7 to 469 ms (Stivers et al., 2009)
Moshi latency80 ms × (1 + 1) = 160 ms theoretical, 200 ms in practice

Symptom to cause

SymptomUsual cause and fix
Cuts callers off mid-sentenceThreshold below the pause tail. Add semantic endpointing before you raise T.
Never answers in a carEnergy VAD rides the noise. Use a neural VAD; do not raise the threshold.
p95 reply time equals the timeoutThe turn model says "not done" too often. Measure its recall on your audio.
Talks 300 ms after the caller cuts inGeneration 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 saidNo context repair. Cut the reply at A-played.
Double orders after interruptionsA write fired before the confirmation was spoken. Make writes idempotent and late.
A word split into two turnsNo hangover, or a minimum silence shorter than a consonant closure.

Checklist before you ship

  1. Log mid-turn pause lengths on real callers for your task.
  2. Write down the price of a cut-off and of a second of waiting.
  3. Keep a raw-silence timeout under any smart endpointer.
  4. Report p50 and p95 reply time, and look for a spike at the timeout.
  5. Test barge-in: buffer flush time, cancelled tools and the repaired history.
  6. Set the overlap stop line from the two costs.
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

Keep going

LessonWhat it adds
MoshiThe full paper: Mimi, the RQ-Transformer, delays and Inner Monologue
PersonaPlexVoice and role control for full-duplex models, and Full-Duplex-Bench
The Voice Agent StackThe product view: the whole latency ledger, telephony, evals
Streaming SpeechReal-time recognition and synthesis, the stages around the endpoint
Audio RepresentationsFrames, spectra and mel bands under every VAD
Neural Audio CodecsHow a waveform becomes 12.5 Hz tokens
TTS ArchitecturesWhy first-audio time behaves as it does
WhisperThe recognition side
Agents and Tool UseCancellation and idempotent tools in general
VALL-EWhere speech tokens for language models began

Sources

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.

The takeaway. When you fight over a threshold, look for evidence instead. When a problem needs seven patches, check whether your design created it.
An agent's median reply is 400 ms and its p95 is 1,500 ms. Which change helps most?

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.

Turn-Taking, Endpointing and Barge-In
Back to Gleams