TL;DR
When Qwen3-Omni was released, its speech generator came without the audio encoder needed to create training labels, leaving engineers guessing how to fine-tune new voices. Through clever model forensics, Yuxuan Chen pinpoints the exact unreleased setup—Kyutai’s moshi Mimi encoder running in bf16 precision—while uncovering a sneaky padding bug in Hugging Face’s transformers library that causes half of fine-tuned sentences to end in a loud burst of static.
What Problem Does This Paper Address?
Modern speech-capable AI models don't generate raw audio waves directly; instead, they predict discrete "audio codes" (think of them as musical notes for speech) which a decoder then turns into sound. Qwen3-Omni generates speech using a module called the Talker (plus a multi-token predictor), which outputs 16 layers of audio codes per 80 ms frame, and a Code2Wav decoder that turns them into 24 kHz audio.
However, the Qwen team didn't release the encoder that originally turned raw training audio into those discrete target labels. Without knowing the exact encoder, you can't reliably fine-tune the Talker on new voices. The open-source community noticed that Kyutai’s public Mimi codec could decode Qwen’s audio codes, and started using Mimi to make training labels. Yet, "it decodes" doesn't mean the encoding matches: running bf16 vs. fp32 precision flips 12% of early codes, switching between the reference moshi library and the transformers port flips ~15%, and audio preprocessing like loudness normalization alters 67%. Worse, naive community fine-tuning scripts were mysteriously producing speech that ended in harsh noise bursts.
Methods
To reverse-engineer the missing encoder ($E_Q$) without falling for statistical illusions, the author designed three forensic probes—and crucially, calibrated them by training 13 small control models on known label variants first to prove the tests actually work.
- White-Box Embedding Regression: Using 5-fold cross-validated ridge regression to test if Qwen3-Omni’s internal lookup tables can be linearly predicted from Mimi’s public codebook vectors layer-by-layer.
- A Decoder-Based Swap Test (that failed calibration): Swapping individual audio codes and measuring how much Code2Wav resists the change. While it ranked the
fp32reference encoder first, control decoders trained on perturbed labels also rankedfp32first, proving the test is uninformative. - Calibrated Teacher-Forced Likelihoods: Feeding audio encoded by 22 candidate implementations (varying precision, libraries, weights, and preprocessing) into Qwen’s Talker and measuring cross-entropy log-likelihood ($\Lambda$) against an
fp32baseline. Comparing Qwen's preference profile against the 13 calibrated control models revealed an unmistakable implementation fingerprint.
Datasets
- Calibration & Probing: 107.6 hours of English and Chinese speech from VCTK (mic1) and AISHELL-3 across 263 speakers (cut into 10s chunks at 24 kHz), plus 512 held-out utterances from 64 unseen speakers for Talker likelihood tests.
- Multilingual Verification: FLEURS across all 10 of Qwen3-Omni’s speech languages.
- Downstream LoRA Fine-Tuning: ~23.5 minutes each from AISHELL-3 speaker
SSB0033(Chinese) and VCTK speakerp239(English). - Released Artifacts: The author open-sourced a Hugging Face collection containing test-set codes across all variants, log-likelihoods, the 13 calibration models, and sample fine-tuned voices.
Key Insights and Ideas
- Always calibrate your forensic probes: Had the author stopped at the intuitive decoder test, they would have falsely concluded Qwen used
fp32weights. Training ground-truth calibration models exposed that decoders barely remember encoder quantization boundaries. - Precision leaves a behavioral fingerprint: In residual vector quantization, a tiny rounding difference in codebook 0 cascades into every subsequent codebook. Qwen’s Talker strongly prefers systematic
bf16weight-rounding patterns specifically from Kyutai’smoshipackage overtransformersorautocast. - The "Last-Frame Pitfall" in
transformers: Unless an audio clip’s length is an exact multiple of 1920 samples,transformers'MimiModelzero-pads inside each strided convolution layer, whereas Kyutai’smoshipads the raw audio input beforehand. Because silence stops being zero after passing through early neural layers,transformerscorrupts the final frame's hidden states—encoding a harsh static burst that fine-tuned models dutifully learn to copy!
Key Results
- Exact Codec Match: Mimi’s first 16 codebooks predict Qwen’s Talker, MTP, and Code2Wav embedding tables with cross-validated $R^2$ up to 0.77–0.89 (for MTP), while shuffled rows and an identical-architecture control codec (
Qwen3-TTS-Tokenizer-12Hz) score $R^2 \le 0$. - Pinpointing
moshi bf16: Excluding the last frame, Qwen’s Talker prefersmoshi bf16codes by $-1.212$ nats/frame over thefp32reference—matching the exact ranking order of a calibration model trained onmoshi bf16labels ($-1.955$ nats/frame). Loudness normalization is heavily penalized ($+2.77$ nats/frame), and band-limiting $\ge 20\%$ of training data is ruled out. - Eliminating End-of-Sentence Noise Bursts: On earlier frames,
transformersandmoshiagree on 99.99% of tokens, but on the final frame they agree on just 5.5%. LoRA fine-tuning Qwen3-Omni on unpaddedtransformerslabels causes 44–55% of generated sentences to end in a loud noise burst (a $+21.4$ to $+22.3$ dB jump in Chinese). Simply tail-padding the audio drops burst rates to 0–0.3% while maintaining strong intelligibility (~3.1% CER / 1.2% WER) and speaker similarity (~0.96–0.97). The same bug was confirmed in Sesame’s CSM-1B (46–50% loud endings reduced to 0% with padding).
Limitations and Future Work
- Behavioral, not bit-exact: Likelihood tests cannot detect weight perturbations orthogonal to tested directions (random weight changes flipping 2–10% of early codes go undetected). Furthermore,
bf16codes naturally vary by ~24% across all 16 codebooks depending on GPU hardware and batching, though this did not hurt LoRA voice quality. - Fine-tuning scope and voice drift: Downstream experiments only tested LoRA voice adaptation (not full fine-tuning, new languages, or expressive speech). Additionally, adapting shared LoRA weights overwrites Qwen’s preset voices, and training with only one speaker per language causes English spoken-question responses to drift toward the Chinese speaker's voice (requiring multiple speakers per gender/language or spoken turns to mitigate).
Summary updated