Repository navigation
Description
The ggml MOSS audio tokenizer decoder agrees with the reference decoder on short inputs and drifts steadily from it as the input grows. What is left over is a roughly constant noise floor, which speech masks and silence does not — so the end of a long chunk, where the model has stopped talking, comes out as an audible rasp.
I am the author of VieNeu-TTS (#647, #658) and found this while embedding vieneu_v3_turbo in an application. The decoder is src/framework/codecs/moss_audio_tokenizer_codec_runtime.cpp, shared by moss_tts_nano, moss_tts_local, moss_tts_v15, moss_voicegen and vieneu_v3_turbo, so this is not a family-specific problem.
Measurement
Same codes, two decoders. The codes come from audio.cpp itself (codes_dump_file=), so nothing upstream of the decoder differs; the reference is the ONNX export of the same MOSS-Audio-Tokenizer-Nano checkpoint.
| generated frames | audio | C++ vs reference |
|---|---|---|
| 43 | 3.44 s | 63.2 dB |
| 94 | 7.52 s | 34.8 dB |
| 171 | 13.68 s | 13.0 dB |
About 25 dB lost per doubling. At 171 frames the last three frames, which the model generated as silence, come out as:
reference : 0.00001 0.00001 0.00001
audio.cpp : 0.00164 0.00126 0.00153 (~ -56 dB)
This is audible. In a blind listening test on six 0.8 s clips (three from each decoder, shuffled, unlabelled) the listener picked all three audio.cpp clips as "buzzy" and none of the reference ones.
Reproducing
# generate, and dump the codes the run decoded
audiocpp_cli --task tts --family vieneu_v3_turbo --backend cpu \
--model models/VieNeu-TTS-v3-Turbo-GGUF/vieneu-v3-turbo-q8_0.gguf \
--text "<a paragraph, ~14 s of speech>" \
--request-option max_tokens=400 --request-option frame_cap=false \
--request-option seed=1 --request-option codes_dump_file=dump.txt \
--out cpp.wavThen decode the generated_codes line from dump.txt with the reference decoder and compare against cpp.wav. A short utterance (~3 s) matches at 63 dB; a 14 s one at 13 dB. return_codes=true (in #658) returns the same codes directly if that is easier.
Ruled out
- Windowed attention. Rebuilt with
kAttentionQueryChunkset high enough to disable the windowed path entirely: output is bit-identical, so the chunked attention is not the source. - Decoder graph arena.
vieneu_v3_turbo.speech_decoder_graph_arena_mbat 32 (default) and at 1024: also bit-identical. - Weight precision as such is not settled: the codec is f16 in the published package, and the shape of the loss (growing with T rather than constant) does not look like plain quantisation noise, but I could not isolate it cleanly —
weight_type=f32changes the sampling too, so the run generates different codes and the comparison stops being like-for-like. A way to decode a fixed set of codes through the C++ decoder alone would settle it in one run.
So the cause is still open, and it is something that accumulates along the time axis inside the decoder.
Meanwhile
#658 adds return_codes=true to vieneu_v3_turbo, which hands the generated codes back and lets the host decode them. That is what my application now does, and it restores the 0.23 s of trailing silence the C++ decoder was burying. It is a way around the problem for a host that has another decoder, not a fix.
Happy to keep digging if you can point me at which part of the decode path you would suspect first — and to test any patch on this end, where the failure is reproducible.
Activity
moss codec: the Nano decoder attended over twice its intended window
christopherthompson81 commentedon Sep 23, 2026
Found it, and there is a fix in #664. Your report was good enough to work from directly — thank you for the ruled-out list in particular, it saved me from two of the wrong paths.
Cause: the Nano decoder's attention contexts were each exactly doubled
audio.cpp hardcodes each stage's attention context as a step count. The checkpoint states it as a duration per stage, which the reference turns into steps with
int(round(current_frame_rate * context_duration))— the rate being the one before that transformer, not after its patch.Nano's decoder durations are not uniform — 10, 8, 6 and 4 seconds down the stack — where v1's are a flat 10:
So the decoder attended over twice the intended window. It matches the reference while a sequence is shorter than the real context, and diverges as soon as it outgrows one — which is exactly your curve: exact at 43 frames, collapsing after.
Your "ruled out" list held up
kAttentionQueryChunkat 1e6: the bytes change, but the SNR is identical to a tenth of a dB at every length. Both paths were faithfully implementing the same wrong window.I also eliminated graph-cache reuse, causality, the mask formula (ours matches the reference's
(delta >= 0) & (delta < context)), the RoPE convention, and channel handling. The formula was right all along; the numbers fed into it were not.Scope
It is the Nano decoder alone.
tools/check_moss_codec_contexts.pyin the PR derives every context from each checkpoint and compares:Nano's encoder was already correct, which is why only decoding was affected. So the families you listed were not all exposed — but the two that were are yours and
moss_tts_nano, which is the pair that matters for you.The harness you asked for
tests/moss_tts_delay/codec_decode_length_sweepis the decode-only entry point: a fixed code matrix in, a list of lengths, decoding the same matrix as its own prefix at each, so the reference decodes exactly the same prefixes and nothing upstream differs.One thing worth checking on your side: write every channel. An early version of mine compared our channel 0 against the reference's L+R mix and reported 70.6 dB where the truth was 111.4 — a 40 dB error that would have sent me somewhere else entirely.
What I have not confirmed
Your audible symptom, the rasp in trailing silence. My source clip is continuous speech with no long silent tail, so its quietest window only moves from 0.000002 to 0.000001 against the reference's 0.000001 — the floor now matches exactly, but that is not the same as reproducing the rasp. If you can run your original reproducer against #664 I would value the confirmation, since yours is the case with real generated silence at the end. It should also mean
vieneu_v3_turbono longer needsreturn_codes=trueto get a clean tail.moss codec: the Nano decoder attended over twice its intended window (f…