TAI BUI
Back to curriculum
LearnPython

Streaming Speech-to-Speech — Moshi, Hibiki, and Full-Duplex Dialogue

2024-2026 broke the old voice-agent pipeline. Moshi ships a single model that listens and speaks at once, at 200 ms latency. Hibiki translates speech to speech chunk by chunk. Both drop the ASR → LLM → TTS chain for one full-duplex model running on Mimi codec tokens. This is the new reference design.

TIME: ~75 minutesPREREQUISITES: Phase 6 · 13 (Neural Audio Codecs), Phase 6 · 11 (Real-Time Audio), Phase 7 · 05 (Full Transformer)

Learning Objectives

  • Explain why Moshi's full-duplex architecture, two parallel Mimi streams plus an inner-monologue text stream, breaks the 300-500 ms latency floor of a VAD → STT → LLM → TTS pipeline.
  • Describe how the Temporal Transformer and the Depth Transformer divide labor at each 80 ms step: predicting the next text token, then the 8 Mimi codebooks in sequence.
  • Distinguish Hibiki's streaming speech-to-speech translation and Sesame CSM's single-directional TTS from Moshi's full-duplex dialogue.
  • Pick between a full-duplex model and a pipelined voice-agent architecture for a given workload, and justify the choice against tool-calling and latency requirements.

The Problem

Every voice agent built from Lessons 11 and 12 hits the same latency floor: 300-500 ms, because VAD, STT, the LLM, and TTS each carry their own minimum processing time. Tune each stage, parallelize what you can, and you still can't escape the shape of the pipeline itself.

Moshi (Kyutai, 2024-2026) asks a different question: what if there's no pipeline at all? One model takes audio in and sends audio out, continuously, with text running alongside as an inner monologue instead of a required stage.

That's full-duplex speech-to-speech: 160 ms theoretical latency (an 80 ms Mimi frame plus an 80 ms acoustic delay), 200 ms in practice on a single L4 GPU. Half the latency of a best-in-class pipelined voice agent.

Warm-up0/3
1. In a cascaded voice assistant, what does the VAD stage do?Warm-up
A microphone waveform on top feeding a four box chain: VAD, STT, LLM, TTS. The VAD box is highlighted and a question mark below it asks what that stage does.
Typed schematic of the cascaded pipeline named in the question.
2. What does a neural audio codec produce from a raw waveform?Warm-up
A blue waveform labelled raw waveform in, an arrow into a box called neural audio codec, and an arrow out to a circled question mark labelled output.
Typed schematic.
3. How does an autoregressive transformer language model produce a sequence?Warm-up
A prompt of three tokens (Once upon a), an arrow into a box called transformer LM, and an arrow to five empty dashed slots. A question mark asks how the five positions get filled.
Typed schematic. The prompt words are illustrative.
Check: The Problem0/3
1. Why does a pipelined voice agent (VAD, STT, LLM, TTS) hit a latency floor of roughly 300-500 ms even after tuning?Explain
A chain of four boxes VAD, STT, LLM, TTS with a bracket underneath labelled roughly 300 to 500 ms from the user stopping to first audio out, and a question mark asking why it does not go lower.
Typed schematic.
2. What question does Moshi ask in place of tuning the pipeline further?Explain
A chain VAD, STT, LLM, TTS, then a line saying Moshi asks a different question, and a highlighted box with the sentence What if, a blank, and a question mark.
Typed schematic.
3. Moshi's theoretical latency is 160 ms. Where does that figure come from?Explain
Two horizontal bars on a shared scale. The upper bar, theoretical, is split into two halves each labelled with a question mark and 80 ms, totalling 160 ms. The lower bar is about 200 ms in practice on a single L4 GPU.
Typed bars drawn to scale from the lesson's numbers.

The Concept

Moshi architecture: two parallel Mimi streams + inner-monologue text

The Moshi architecture

One 7B-parameter Temporal Transformer reads two Mimi audio streams (the user's and its own) plus a running text stream, and at every 80 ms step it writes back the next chunk of both text and audio.

Inputs. Two Mimi codec streams, both at 12.5 Hz × 8 codebooks:

  • Stream 1: user audio (Mimi-encoded, constantly arriving)
  • Stream 2: Moshi's own audio (generated by Moshi)

The transformer. At each 80 ms step, it:

  1. Consumes the latest user Mimi tokens (8 codebooks).
  2. Reads the most recent Moshi Mimi tokens (8 codebooks, as produced).
  3. Generates the next Moshi text token (inner monologue).
  4. Generates the next Moshi Mimi tokens (8 codebooks via a small Depth Transformer).

All three streams (user audio, Moshi audio, Moshi text) run in parallel, so Moshi can hear the user while it's still speaking, interrupt itself when the user interrupts, and back-channel with an "mhm" without breaking its main utterance.

The depth transformer. Within a frame, the 8 codebooks can't be predicted in parallel: they have inter-codebook dependencies. A small 2-layer "depth transformer" predicts them sequentially inside that same 80 ms window. It's the standard factorization for autoregressive codec LMs, the same one VALL-E and VibeVoice use.

Why inner-monologue text helps

Without explicit text, the model would have to model language implicitly, buried inside its acoustic stream. Moshi's fix: force it to emit text tokens alongside the audio, so the text stream doubles as a live transcript of what Moshi is saying. That one design choice improves semantic coherence, makes it easier to swap out the language-model head, and hands you a transcript for free.

Hibiki: streaming speech-to-speech translation

Same architecture, trained on translation pairs instead of dialogue: source audio in, target-language audio out, continuously. Hibiki-Zero (Feb 2026) drops the need for word-level aligned training data entirely. It trains on sentence-level data plus GRPO reinforcement learning for latency optimization instead.

Five language pairs ship out of the box; adapting the model to a new language takes roughly 1000 hours of data.

The broader Kyutai stack (2026)

  • Moshi: full-duplex dialogue (French first, English well-supported)
  • Hibiki / Hibiki-Zero: simultaneous speech translation
  • Kyutai STT: streaming ASR (500 ms or 2.5 s look-ahead)
  • Kyutai Pocket TTS: 100M-param TTS runs on CPU (Jan 2026)
  • Unmute: full pipeline combining these on public servers

Throughput on an L40S GPU: 64 concurrent sessions at 3× real-time.

Sesame CSM: the cousin

Sesame CSM (2025) runs a similar idea: a Llama-3 backbone with a Mimi codec head. But CSM is single-directional, taking context plus text and producing speech, rather than full-duplex. It's the best "voice presence" TTS on the market, just not the same thing as Moshi's ability to listen and speak at once.

2026 performance numbers

ModelLatencyUse caseLicense
Moshi200 ms (L4)full-duplex English / French dialogueCC-BY 4.0
Hibiki12.5 Hz framerateFrench ↔ English streaming translationCC-BY 4.0
Hibiki-Zerosame5 language-pairs, no aligned dataCC-BY 4.0
Sesame CSM-1B200 ms TTFAcontext-conditioned TTSApache-2.0
GPT-4o Realtime~300 msclosed, OpenAI APIcommercial
Gemini 2.5 Live~350 msclosed, Google APIcommercial
Check: The Concept0/17
1. What two Mimi codec streams does the Moshi Temporal Transformer consume at each 80 ms step?Define
A box called Temporal Transformer, 7B parameters, with two arrows coming in from chips labelled Mimi stream with a question mark, each at 12.5 Hz with 8 codebooks, and one arrow going out to the next step's output.
Typed schematic from the lesson's Concept section.
2. What does full-duplex mean for a speech model like Moshi?Define
A person box on the left with one arrow into a box called Moshi, one model, and one arrow back to the person, and a line asks what full-duplex means.
Typed schematic.
3. What is Moshi's inner monologue?Define
A box called Moshi with audio coming in and audio going out, and a dashed line from the box down to a chip labelled inner monologue, with a question mark beside it.
Typed schematic.
4. What is the depth transformer's job in Moshi's architecture?Define
A dashed frame labelled one 80 ms frame holding two boxes joined by an arrow: Temporal Transformer, 7B parameters, and Depth Transformer with the job shown as a question mark.
Typed schematic.
5. What is Mimi in the Moshi system?Define
A panel labelled Moshi containing chips Temporal Transformer (7B), Depth Transformer and a highlighted chip Mimi with a question mark beside it.
Typed schematic. Only names and numbers given in the lesson are used.
6. What does streaming speech-to-speech mean?Define
A blue audio-in waveform, an arrow into a highlighted box labelled model, streaming S2S, an arrow to a green audio-out waveform, and a question mark below asking what happens in the middle.
Typed schematic.
7. What is back-channeling in a conversation with Moshi?Define
A user audio lane with one long block and below it a Moshi audio lane with three short dashed blocks marked with question marks during the user's block. A line asks what this is called.
Typed timeline. Block positions are illustrative.
8. Within the Kyutai stack, which component combines streaming STT, TTS and other pieces into a pipeline rather than a single end-to-end model?Define
Two panels. Left: a single model, audio in and audio out, one network end to end. Right: a chain of components such as streaming STT and TTS joined together. A question mark under the right panel asks which Kyutai component is that kind.
Typed schematic.
9. Why does the lesson say Moshi's inner-monologue text stream helps, beyond producing a transcript?Explain
Two panels. Left: audio streams only, user audio and Moshi audio. Right: audio plus a text stream, which adds Moshi text tokens called the inner monologue. A question mark sits between them and a line asks what the text stream buys besides a transcript.
Typed comparison. Wording follows the lesson's Concept section.
10. Why does Moshi use a depth transformer instead of predicting all 8 codebooks of a frame at once?Explain
A dashed frame labelled frame t holding eight empty dashed slots cb0 to cb7, each with a question mark below, and a line asking why not all at once.
Typed schematic.
11. Why can Moshi interrupt itself when the user starts talking over it?Explain
A Moshi audio lane with a block for Moshi speaking followed by a dashed block with a question mark, above a user audio lane whose block starts before Moshi's speaking block ends. A dashed vertical line marks when the user starts.
Typed timeline, illustrative positions.
12. How does the lesson distinguish Sesame CSM from Moshi?Explain
Two side by side panels. Sesame CSM from 2025 with a Llama-3 backbone, and Moshi with a 7B Temporal Transformer. Each panel shows direction of flow as a question mark.
Typed comparison with figures from the lesson.
13. What does Hibiki-Zero change compared to the original Hibiki training approach?Explain
A source audio waveform feeding a highlighted Hibiki box with the note same architecture, and out to a target-language audio waveform. Below, a dashed box Hibiki-Zero with a question mark, and a line asking what changes in its training.
Typed schematic.
14. A team must use a closed commercial speech-to-speech API and wants the lowest latency in the lesson's performance table. Which one fits?Apply
A requirements card: must be a closed commercial speech-to-speech API, optimise for lowest latency, compare using the lesson's performance table of six models. A question mark asks which one fits.
Typed summary of the question's requirements.
15. A teammate proposes predicting all 8 codebooks of each frame in one parallel pass to save time. What assumption is wrong?Analyze
A box labelled model, one pass, with eight arrows fanning out to eight chips cb0 to cb7. A line asks what assumption is wrong.
Typed schematic of the proposal in the question.
16. To simplify training, a team drops the text stream and trains only on the two audio streams. What does the lesson say they lose?Analyze
Three lanes: user audio and Moshi audio both marked kept, and Moshi text drawn dashed and struck through, marked dropped. A line asks what the lesson says they lose.
Typed schematic.
17. You need a live translation feature for a language pair Hibiki does not ship with, and you have no word-aligned data. What does the lesson suggest planning for?Design
A requirements card: language pair not one that Hibiki ships with, no word-aligned data, goal live speech translation. A question mark asks what the lesson suggests planning for.
Typed summary of the question's situation.

Build It

Step 1: the interface

Moshi exposes a WebSocket server that takes in 80 ms chunks of Mimi-encoded audio and sends 80 ms chunks back out. Both directions, running the whole time.

python
import asyncio
import websockets
from moshi.client_utils import encode_audio_mimi, decode_audio_mimi
 
async def moshi_chat():
    async with websockets.connect("ws://localhost:8998/api/chat") as ws:
        mic_task = asyncio.create_task(stream_mic_to(ws))
        spk_task = asyncio.create_task(stream_from_to_speaker(ws))
        await asyncio.gather(mic_task, spk_task)

Step 2: the full-duplex loop

Neither direction can wait on the other: the mic keeps capturing while playback keeps draining, so each has to run as its own concurrent task instead of a request/response pair.

python
async def stream_mic_to(ws):
    async for chunk_80ms in mic_stream_at_12_5_hz():
        mimi_tokens = encode_audio_mimi(chunk_80ms)
        await ws.send(serialize(mimi_tokens))
 
async def stream_from_to_speaker(ws):
    async for msg in ws:
        mimi_tokens, text_token = deserialize(msg)
        audio = decode_audio_mimi(mimi_tokens)
        await play(audio)

Both directions run at the same time. Python asyncio or Rust futures are the standard transport for this.

Step 3: the training objective (conceptual)

For every 80 ms frame t:

  • Input: user_mimi[0..t], moshi_mimi[0..t-1], moshi_text[0..t-1]
  • Predict: moshi_text[t], then moshi_mimi[t, codebook_0..7]

Text comes first (the inner monologue), then audio, predicted codebook by codebook inside the depth transformer.

Step 4: where Moshi wins and where it doesn't

Moshi wins:

  • Sub-250 ms end-to-end on cheap hardware.
  • Natural back-channels and interruptions.
  • No pipeline glue code.

Moshi does not win:

  • Tool calling. It isn't trained for that, so you need a separate LLM path.
  • Long reasoning. Moshi is a 7B dialogue model, not Claude or GPT-4.
  • Factual accuracy on niche topics.
  • Most production enterprise use cases, which still run pipelines in 2026.
Check: Build It0/7
1. Why do most production enterprise voice agents still use pipelines instead of Moshi in 2026?Explain
A box for an enterprise voice agent with a thick arrow to a pipeline box (VAD, STT, LLM, TTS) marked most production use in 2026, and a thin arrow to a Moshi box marked less common in production. A line asks why most teams pick the top one.
Typed schematic. The usage note follows the lesson's Build It section.
2. In stream_mic_to, the mic yields chunks at 12.5 Hz. How many chunks does the loop send to the server per second?Apply
A left to right chain: mic at 12.5 Hz, encode_audio_mimi, ws.send, server. Under it a bracket marks one second and a question mark asks how many chunks are sent in that second.
Typed schematic of the Build It step 1 and 2 code.
3. Each Mimi stream runs at 12.5 Hz with 8 codebooks. How many codebook tokens does one stream carry per second?Apply
A grid sketch of one Mimi stream: columns are frames, eight rows are codebooks, the grid is cut off with dots. Beside it, frame rate 12.5 Hz and 8 codebooks per frame, and a question mark asking tokens per second in one stream.
Typed schematic. Only four columns are drawn.
4. For frame t, the training objective lists user_mimi[0..t], moshi_mimi[0..t-1] and moshi_text[0..t-1] as inputs. Which of these is a target to predict, not an input?Apply
Three chips user_mimi[0..t], moshi_mimi[0..t-1] and moshi_text[0..t-1] with arrows into a box labelled Moshi, frame t, and a question mark. A line asks which listed item is a target, not an input.
Typed schematic of the inputs named in the question.
5. Within one frame, in what order does Moshi make its predictions?Apply
A dashed frame with two shuffled chips, codebooks 0 to 7 and text token, a question mark and the word order, and a note that both predictions happen inside the same frame.
Typed schematic. The chips are shown in a shuffled order.
6. A client sends one 80 ms chunk, waits for the reply, plays it, then captures the next chunk. The conversation feels turn-based and the model cannot be interrupted. What is wrong?Analyze
A single timeline of boxes in sequence: capture, send, wait for reply (dashed), play, capture. Text below says the conversation feels turn-based and cannot be interrupted, with a question asking what is wrong.
Typed timeline of the loop in the question; widths are illustrative.
7. A product needs Moshi's natural conversational feel but must also look up live data mid-call. What is the sensible design?Design
A requirements card: feel is Moshi's natural conversation, also needs a live data lookup mid-call. A question mark asks what a sensible design is.
Typed summary of the question.

Use It

SituationPick
Lowest-latency voice companionMoshi
Live translation callHibiki
Voice demo / researchMoshi, CSM
Enterprise agent with toolsPipeline (Lesson 12), not Moshi
Custom-voice TTS in contextSesame CSM
Speech-to-speech, any languagesGPT-4o Realtime or Gemini 2.5 Live (commercial)
Check: Use It0/4
1. Which pair matches the Use It table: a live translation call, and custom-voice TTS in context?Apply
Two cards, Live translation call and Custom-voice TTS in context, each with a question mark and the words pick, question mark below.
Typed schematic, situations as written in the lesson's Use It table.
2. Which pair matches the Use It table: an enterprise agent with tools, and speech-to-speech in any language?Apply
Two cards, Enterprise agent with tools and Speech-to-speech, any languages, each with a question mark and the words pick, question mark below.
Typed schematic, situations as written in the lesson's Use It table.
3. You are building a support agent that looks up orders in a database and reasons over several turns. Which architecture fits?Design
A requirements card: looks up orders in a database, reasons over several turns. A question mark asks which architecture fits.
Typed summary of the question.
4. You are building a voice companion for cheap hardware where natural interruptions and back-channels matter most and no tools are needed. Which choice fits?Design
A requirements card: cheap hardware, natural interruptions and back-channels matter most, no tools needed. A question mark asks which choice fits.
Typed summary of the question.

Pitfalls

  • Limited tool calling. Moshi is a dialogue model, not an agent framework. Combine it with a pipeline when you need tools.
  • Specific-voice conditioning. Moshi uses a single trained persona; cloning it is a separate training run.
  • Language coverage. French and English are excellent, others limited. Hibiki-Zero helps, but you still need training data.
  • Resource cost. A full Moshi session holds a GPU slot for the whole conversation, which rules out cheap shared-tenant deployment.
Check: Pitfalls0/4
1. What do the pitfalls say about Moshi's voice and language coverage?Explain
Two side by side cards. Request 1: speak in our brand's own voice. Request 2: serve users in another language. A question mark sits under each and a line asks what the pitfalls say about each.
Typed schematic.
2. What do the pitfalls say about Moshi's resource cost and tool calling?Explain
Two side by side cards. Cost: what one running session costs the team. Tools: look something up in an outside system mid-call. A question mark sits under each.
Typed schematic.
3. A Moshi demo is asked to check the user's calendar and answers with an invented schedule. What is the cause?Analyze
Two panels. Left: a typed example calendar with a dentist appointment and a review on Tuesday and nothing on Wednesday. Right: a typed spoken exchange in which the user asks what's on tomorrow and Moshi answers with a lunch with Sam at noon. A question mark asks what is the cause.
Typed example, illustrative, not model output.
4. A startup plans to serve thousands of casual, mostly idle chat users on shared GPUs with one Moshi session each. Which pitfall hits them hardest?Analyze
Two rows of small blue circles for users labelled thousands of casual, mostly idle chat users, an arrow down to four boxes labelled shared GPU, one Moshi session each. A line asks which pitfall hits them hardest.
Typed schematic. The number of circles and GPUs drawn is illustrative.

Ship It

Save as outputs/skill-duplex-pipeline.md. Pick pipeline vs. full-duplex architecture for a voice-agent workload, and say why.

Author's Note

The demos of Moshi are genuinely startling the first time you hear them: a model interrupting itself, back-channeling, talking over you the way a person does. It's easy to walk away thinking the ASR-LLM-TTS pipeline is obsolete. It isn't, not yet. Moshi is a dialogue model with a small parameter count and no tool-calling story; the moment your product needs to check a calendar, hit a database, or reason past a couple of turns, you're back to a pipeline, just one with a much lower latency bar to clear. Full-duplex is the right architecture for a genuinely conversational companion. It is not yet the right architecture for an agent that has to get things done. Watch which gap closes first, tool-use in full-duplex models or latency in pipelines. That's the race that decides what you're building on in two years.

Exercises

  1. Easy. Run code/main.py. It simulates the two-stream plus inner-monologue architecture symbolically.
  2. Medium. Pull Moshi from HuggingFace, run the server, and test one conversation. Measure wall-clock latency from end-of-user-speech to start-of-Moshi-response.
  3. Hard. Take your Lesson 12 pipeline agent and compare P50 latency against Moshi on 20 matched test utterances. Write up the cases where a pipeline still wins architecturally.

Key Terms

TermWhat people sayWhat it actually means
Full-duplexHear-and-speak at onceTwo audio streams active simultaneously on the same model.
Inner monologueModel's text streamMoshi emits text tokens alongside its audio output.
Depth transformerInter-codebook predictorSmall transformer that predicts 8 codebooks within one 80 ms frame.
MimiKyutai's codec12.5 Hz × 8 codebooks; semantic+acoustic; powers Moshi.
Streaming S2SAudio → audio liveChunk-by-chunk translation/dialogue, no pipeline stages.
Back-channeling"Mhm" reactionsMoshi can emit small acknowledgments without breaking its turn.

Further Reading

Code

Ships With