Skip to content

🚨 Use shared Mimi decoding for PocketTTS and correct streaming history - #1320

Merged
0xShug0 merged 1 commit into
mainfrom
refactor/pocket-tts-mimi-runtime
Nov 17, 2026
Merged

0xShug0 merged 1 commit into
mainfrom
refactor/pocket-tts-mimi-runtime

Conversation

@0xShug0

@0xShug0 0xShug0 commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Summary

Move PocketTTS onto the existing session-owned MimiLatentDecoderRuntime used by PocketTTS Small, removing its model-local Mimi decoder and AudioDecoder wrapper. Keep normalization and text-chunk resets in the model session, and reuse compatible decoder graphs instead of discarding them at the start of every offline request.

No framework, GGML, kernel, model-spec or public-option changes. Production precision, AR execution, RNG, voice preparation and text chunking remain unchanged. Gradium Phonon continues using the shared PocketTTS session.

The migration retains in-graph KV updates, per-text-chunk state resets, protected constant/state lifetimes, CUDA graph ELU and CPU depthwise upsampling from the earlier decoder fixes and optimizations.

Upstream attention correction

Original PocketTTS and Small use the same upstream attention implementation. Its causal window includes every key satisfying 0 <= query_position - key_position < context.

The old PocketTTS port retained context - block_frames previous positions: 234 for context 250 and a 16-frame block. After the cache fills, early queries lose up to 15 valid keys. The existing framework runtime already retains the correct 249-position prefix, so no alternative layout or compatibility option is added.

Controlled FP32 replay uses identical package weight values expanded to F32 and the exact C++ denormalized latent inputs, with unmodified official Python code. It crosses the cache-fill boundary:

Backend Main cosine vs Python PR cosine vs Python
CPU 0.999649909 0.999997066
CUDA 0.999653488 0.999995148
Vulkan 0.999621139 0.999979210

CPU/CUDA now pass cosine >0.99999. Vulkan improves but remains below that strict gate, with numerical differences also present before the history boundary; strict Vulkan/Python waveform parity is not claimed. Streaming/bounded output changes are the intended attention correction, rather than a claim of byte-identical output against the defective path.

Performance

Main 28a6fe7bb versus this PR, Debug builds, eight threads, matching published English BF16/Q8 packages and seed 42. Sequential warmed A→B→B→A; each block has two excluded warmups and ten measured requests, giving 20 measurements per condition. CUDA: RTX 5090. CPU: Ryzen 9 7900X.

Offline rows use default full-sequence decoding. Streaming rows use true SSE audio. RTFs are pooled medians; process peak memory includes preparation and is sampled every 20 ms.

Backend Package Mode Main RTF PR RTF Process peak memory, main → PR
CUDA BF16 Offline 0.00989 0.00973 1,152 → 1,152 MiB VRAM
CUDA Q8 Offline 0.01002 0.00936 1,068 → 1,068 MiB VRAM
CUDA BF16 Streaming 0.02408 0.01559 1,070 → 1,048 MiB VRAM
CUDA Q8 Streaming 0.02478 0.01603 988 → 966 MiB VRAM
CPU BF16 Offline 0.17083 0.14673 1,049.2 → 756.0 MiB RSS
CPU Q8 Offline 0.14816 0.12258 993.6 → 666.6 MiB RSS
CPU BF16 Streaming 0.19891 0.18552 697.9 → 667.3 MiB RSS
CPU Q8 Streaming 0.17533 0.16411 610.4 → 579.8 MiB RSS

CUDA streaming RTF decreases about 35%; CPU offline decreases 14–17%, and CPU streaming 6–7%. Default CUDA BF16 offline is effectively unchanged. Explicit bounded decoding (pocket_tts.use_full_mimi=false) also improves: approximately 39% on CUDA and 7–9% on CPU. Both run orders improve in all 12 measured configurations, with no observed RTF or peak-memory regression.

Warmed streaming TTFA, cold-start excluded:

Backend Package Main PR
CUDA BF16 5.74 ms 4.95 ms
CUDA Q8 5.94 ms 5.19 ms
CPU BF16 27.53 ms 27.48 ms
CPU Q8 26.13 ms 25.49 ms

Regression and lifecycle validation

  • All 36 matched ASR transcript pairs agree exactly (72 recognitions), with weighted WER unchanged at 0.377%. Coverage includes English long-form narration, voice changes/cloning, Spanish, German and Gradium Phonon across CPU/CUDA/Vulkan and offline/streaming paths.
  • Nemotron diarization finds one speaker in all 24 checked long outputs.
  • The repeated-chunk reproducer produces eight copies matching the isolated sentence, with cosine effectively 1.0 and stable RMS. The previous quiet/altered-voice failure does not recur.
  • Long→short reuse, changed seeds, voice changes and restored requests cover 42 non-warmup outputs per condition. No clipping is detected. Existing long quiet intervals occur at the same positions and durations as main; overall RMS differs by at most 0.16%.
  • Decoder lifecycle checks pass on CPU/CUDA/Vulkan: changed/restored inputs, shape reuse, resets and cache recreation. CPU additionally checks that identical latents partitioned into one-, two- and five-step calls agree above cosine 0.99999 after the cache fills, using both native-package and FP32-control weights.
  • Default full-sequence CUDA/Vulkan outputs remain byte-identical to main; CPU full-sequence comparisons exceed cosine 0.99999.
  • All 24 matched default-path PocketTTS Small outputs are byte-identical. Shared framework runtime source and PersonaPlex's separate Mimi interface are unchanged.

Metal/HIP execution and forced-OOM recovery were not tested in this pass.

@0xShug0 0xShug0 changed the title Use shared Mimi decoding for PocketTTS and correct streaming history 🚨 Use shared Mimi decoding for PocketTTS and correct streaming history Nov 17, 2026
@0xShug0
0xShug0 merged commit bf76684 into main Nov 17, 2026
7 checks passed
@0xShug0
0xShug0 deleted the refactor/pocket-tts-mimi-runtime branch November 17, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant