Listening while speaking
A voice assistant usually takes turns: speech recognition waits for the user to stop, a language model writes a reply, and text-to-speech reads it out. Every hand-over adds delay, and anything that is not words (a laugh, an interruption, a "mm-hm" while the other person talks) is lost. Moshi drops the turns. It models the user's audio and its own as two parallel streams of codec tokens, and at every 80 ms step it listens to the user's latest frame and writes its own next one, so it can talk while the user talks.
This tab records Kyutai's released Moshi with the Moshiko voice (kyutai/moshiko-pytorch-bf16, CC BY 4.0) for 10 s. The user's side is the LibriSpeech utterance the Tokenization tabs use, "where is my brother now", placed at 0.96–3.00 s in otherwise silent audio. The model has 7.69 B parameters: a 6.58 B temporal transformer across the steps, a 714 M depth transformer that writes the codes of one step, and 396 M in embeddings and the text head. It ran 126 steps in bfloat16 on a Mac's GPU, 32 s for the 10 s; the paper reports a latency of 160 ms in theory and 200 ms in practice.
Seventeen streams and their delays
The tokens are those of Mimi, Kyutai's speech codec (the Tokenization Explainer's Mimi tab): 12.5 frames a second, each a residual stack of codes from 2,048 values, of which Moshi uses the first 8. Mimi's first codebook is trained to match a self-supervised speech model, so it carries mostly what is said (the semantic code); the other 7 add how it sounds (the acoustic codes). At step Moshi reads 17 tokens: its own text token, its own 8 codes and the user's 8 codes. Their embeddings are simply added into one vector,
so the transformer sees one position per 80 ms, not one per token. The acoustic codes run one step behind the semantic one (the acoustic delay): a frame's semantic code is written first, and its acoustic codes at the next step, when that semantic code is already in the context. The Step n reads 17 streams grid shows this: the shaded column is what step reads, the outlined column what it writes, and each code is coloured with the frame it belongs to. Positions before a stream's delay hold an initial token (32,000 for text, 2,048 for codes). Kyutai's offline inference feeds the user's first frame twice, so the user's frame arrives at step , with Moshi's own frame .
The temporal transformer
The 17-token sum goes through 32 layers of width 4,096: RMS norm, causal self-attention with 32 heads and rotary positions, RMS norm and a SiLU-gated MLP of 11,264, each added back. A step attends to the last 3,000 steps, four minutes. The output gives two things: the logits of the next text token, through one linear layer over 32,000 SentencePiece pieces, and a 4,096-wide state for the depth transformer.
The bars under the grid show where step looks, averaged over the 32 heads, in the layer picked in the toolbar. Most layers look at the very first step. From step 20 on, the kept layers from 5 to 29 give it 67–86 % of their weight, though it holds nothing but initial tokens: it is an attention sink, a place to park weight. The first and last layers read the content. Layer 1 still gives 26 % of its weight to the user's question after it has ended (steps 45 onward), and layer 32 gives 44 % to the latest five steps.
The inner monologue
Moshi also writes text: one token per frame, aligned with its own speech, which the paper calls the inner monologue. Predicting the words just before their sound gives the audio a language model's knowledge to lean on. Words rarely fill every 80 ms frame, so the text stream pads: PAD between words, and EPAD on the step just before a word starts. Here, of the 125 frames, 61 are PAD, 22 EPAD and 42 hold pieces of 26 words.
What Moshi said is in What Moshi said, each word at the frames it was written: "Hey, what's going on? I' so sorry, I know he's missing, and I'm really worried about him. I'm trying to find him. I know he' in". It greets at 0.48 s, before the user starts, and says "what's going on?" over the user's question, which a turn-taking system cannot do. Its answer starts as the question ends. Text is drawn at temperature 0.7 from the top 25. The most likely piece was drawn in 89 % of steps, but not always: "I' so" is a draw of ▁so (14 %) where ▁sorry had 77 % and m 9 %. The Inner monologue panel shows each step's distribution.
The depth transformer
A frame's 8 codes depend on each other, the finer on the coarser, so they are not drawn at once. A small depth transformer, 6 layers of width 1,024 with 16 heads, writes them one after another within the step, an idea from the RQ-Transformer for images. Position 0 reads the text token just drawn and position the code drawn before it, each plus its own projection of the temporal state. Every position has its own weights in every layer, which is why it holds 714 M parameters while each code uses about an eighth of them.
Codes are drawn at temperature 0.8 from the top 250. The semantic code is much surer than the acoustic ones: over the run its distribution has an entropy of 0.67 nats and its most likely code was drawn 81 % of the time, against 1.3–1.75 nats and 51–65 % for codes 2–8. The Depth transformer card shows its attention for any step, layer and head. The position that reads code 1 and writes code 2 gives 52–59 % of its weight to the text position in every layer. In the first layer the positions reading codes 3 to 7 keep 84–98 % on themselves; later layers spread it over the codes before them.
Back to sound
Mimi's decoder turns Moshi's 8 codes per frame, 1.1 kbps, back into 24 kHz audio: the moshi clip. The user via Mimi clip is what Moshi actually hears of the user, the question decoded from the 8 codes it reads. Against the original, its waveform SNR over the clip is 5.6 dB: enough to keep the words, not the exact waveform. The mix clip plays both sides together, and the strip at the bottom draws both spectrograms on one time axis, with Moshi's words where they were written.
Moshi follows dGSLM, which first modelled both speakers of a dialogue as parallel streams of units, without text. Kyutai's Hibiki reuses the same multistream design to translate speech while the speaker is still talking.
How the recording was checked
Kyutai's moshi package was not used: the steps ran through transformers' Moshi modules, with Kyutai's weights converted into them, and the streams and delays were kept the way Kyutai's inference code keeps them. Feeding the whole recorded input back through the temporal transformer at once, in bfloat16, gives the same most likely text piece at every step, with logits within 0.44 at a scale of 28. The depth transformer, run again on the CPU in float32 over every step's 8 positions at once, gives the most likely code the loop's bfloat16 calls gave at 988 of the 1,008 positions, with logits within 0.62 at a scale of 72. A first version of this check made that one call in bfloat16 on the GPU and agreed at only 74 %; smaller calls of a dozen steps agree with float32 on both paths, so the stored check runs on the CPU.
The tab's PyTorch drawer is a separate implementation in Kyutai's layout that reads the original checkpoint's tensors. In float32 it gives the same embedding sum exactly, layer 0 to within , the text head to within and the depth transformer to within (at a scale of 59) on four steps before, during and after the question. Every one of the 1,134 draws, redrawn from the stored float32 probabilities and uniforms, gives the token Moshi wrote, and running the recorder twice gave the same tokens, probabilities, attention and audio, bit for bit.
Papers
- Moshi: a speech-text foundation model for real-time dialogue Moshi: full-duplex dialogue as parallel streams of Mimi codes for both speakers plus a text inner monologue, modelled by a temporal and a depth transformer; the model this tab records.
- Generative Spoken Dialogue Language Modeling dGSLM, the first model of two-channel spoken dialogue with both speakers' units in parallel streams, without text.
- Autoregressive Image Generation using Residual Quantization The RQ-Transformer: a large transformer across positions and a small one across a position's residual codes, Moshi's temporal and depth transformers.
- Simple and Controllable Music Generation MusicGen's delay pattern between codebooks, which Moshi uses as a one-step acoustic delay (see the MusicGen tab).
- RoFormer: Enhanced Transformer with Rotary Position Embedding Rotary position embedding, which Moshi's temporal transformer applies to queries and keys; the depth transformer uses no positions.
- WavLM: Large-Scale Self-Supervised Pre-Training for Full Stack Speech Processing The self-supervised speech model distilled into Mimi's first codebook, the semantic code each stream starts with.
- High-Fidelity Simultaneous Speech-To-Speech Translation Hibiki, which reuses Moshi's multistream architecture to translate speech while the speaker talks.