Repository navigation
fix(voxcpm2): correct the streaming decode rationale, drop right context - #623
Merged
0xShug0 merged 1 commit intoSep 20, 2026
Merged
Conversation
#622 fixed the clicks at every 160 ms patch boundary of the streaming path by decoding each patch inside a window of preceding patches, but it explained the cause as a non-causal AudioVAE decoder. That is wrong: the decoder is causal (causal_conv1d pads on the left only, causal_conv_transpose1d crops to the causal output length). The clicks came from invoking that causal decoder statelessly per patch, so its convolution history restarted from zero padding at every boundary. Left context rebuilds the history; right context cannot change anything, which the measurements in #620 already showed ("same as with 0" for every left value). - Correct the comments in types.h and generator.cpp and the docs/tts.md entry. - Remove voxcpm2.stream_right_context together with the tail flush and back trim it needed. The option never shipped in a release. - chunk.generated_patches is again the number of patches generated so far, as before #622 (the emitted-patch index that #622 assigned only coincided with it for right context 0). - Bound stream_left_context to [0, 8] (kVoxCPM2MaxStreamLeftContext), checked in validate_generation_options and in the request-option parsing. Every emitted patch re-decodes the whole window, so the cost grows with the value while the deviation is at its floor from 5 on. Measured on VoxCPM2 Q8 (48 kHz, Vulkan, seed 7, temperature 0.7, 8.80 s of audio, 54 boundaries) as streaming WAV against offline WAV, same method as #620; the offline reference has one natural step > 0.1 on the grid: left max deviation samples off by >0.01 boundary steps >0.1 RTF 0 0.5466 39.5 % 6 of 54 0.56 1 0.0835 2.7 % 1 of 54 0.59 3 0.0015 0.0 % 1 of 54 0.64 4 0.0005 0.0 % 1 of 54 0.71 8 0.0004 0.0 % 1 of 54 0.94 16 0.0004 0.0 % 1 of 54 1.44 Default (3) is unchanged and bit-identical to #622's output. 9 and -1 are rejected. The upstream VoxCPM release 2.0.3 replaced its equivalent 4-patch overlap decode with a stateful StreamingVAEDecoder (OpenBMB/VoxCPM#212); that is the long-term shape for this path and a separate change.
This was referenced Sep 20, 2026
Owner
|
Thanks for following up and continuing to improve this! PR merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #622 / #620.
Summary
#622 fixed the clicks at every 160 ms patch boundary of the VoxCPM2 streaming path, but I explained the cause wrongly there: the PR says the AudioVAE decoder is not causal. It is.
causal_conv1dpads on the left only andcausal_conv_transpose1dcrops to the causal output length. The clicks came from invoking that causal decoder statelessly per patch, so its convolution history restarted from zero padding at every boundary. Decoding the preceding patches in the same window rebuilds that history. Right context cannot change anything for a causal decoder, and the measurements in #620 already showed that ("same as with 0" for every left value).This PR corrects the rationale where #622 wrote it into the tree and removes what only made sense under the wrong explanation. Nothing in it has shipped in a release yet (last tag is v0.8.1).
Change
types.handgenerator.cppand thedocs/tts.mdentry state the real cause. Benchmark numbers are gone from the header.voxcpm2.stream_right_contextis removed, together with the tail flush and the back trim it needed. An unknown option is ignored by the server, so old configs that still set it keep working.VoxCPM2StreamingChunk::generated_patchesis again the number of patches generated so far, as before fix(voxcpm2): decode streaming patches with left context #622. fix(voxcpm2): decode streaming patches with left context #622 assigned the emitted-patch index, which only coincided with it for right context 0.stream_left_contextis bounded to[0, 8](kVoxCPM2MaxStreamLeftContext), checked invalidate_generation_optionsand in the request-option parsing. Every emitted patch re-decodes the whole window, so the cost grows with the value while the deviation sits at its floor from 5 on; 16 is already slower than real time on the hardware below.Default
3is unchanged.voxcpm2family plus its docs entry only, no framework code. 4 files, +58/−79.Validation
Build as in #622 (Vulkan, RelWithDebInfo,
AUDIOCPP_MODEL_SET=full),voxcpm2-q8_0.gguf, AMD Strix Halo (gfx1151), served throughaudiocpp_serverwith one streaming and one offline id on the same weights. Same method as #620: plain English text,seed7,temperature0.7, 8.80 s of audio, 54 patch boundaries, streaming WAV against offline WAV of the same fixed-seed features. The offline reference has one natural step > 0.1 on the grid.stream_left_context must be between 0 and 8Offline reference: RTF 0.51. The default's output is bit-identical to #622's. The CLI path (
--mode streaming --request-option voxcpm2.stream_left_context=9) rejects the same way throughvalidate_generation_options.Backend tested: Vulkan. CPU build of the family compiles; CUDA / HIP / Metal untested.
Follow-ups, not in this PR
StreamingVAEDecoderthat carries the causal-conv state between patches and decodes one patch per step (perf: stateful streaming VAE decode — eliminate redundant overlap OpenBMB/VoxCPM#212: 2× faster VAE decode, half the deviation). That is the long-term shape for this path; in ggml it means state tensors per causal convolution and priming from the prompt latents, so it is a separate change.community_models/voxcpm1has the same streaming structure; separate PR as suggested in fix(voxcpm2): decode streaming patches with left context #622.