Skip to content

Add PocketTTS Small with streaming and acoustic batching - #1194

Merged
0xShug0 merged 3 commits into
mainfrom
feature/pocket-tts-small
Nov 4, 2026
Merged

0xShug0 merged 3 commits into
mainfrom
feature/pocket-tts-small

Conversation

@0xShug0

@0xShug0 0xShug0 commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Adds English PocketTTS Small 18M, 7M, and 2M checkpoints, including ReFL variants, as an independent pocket_tts_small family. Supports offline/streaming TTS, reference-audio cloning, predefined/exported voice states, and offline acoustic batching through the existing C++ batch-session API. CLI multi-text requests remain sequential; acoustic batching is not yet exposed in the main CLI or WebUI.

Ordinary GGML requests use the same acoustic runtime with batch size 1. Text conditioning and waveform decoding remain per request. Frequently used graphs are session-owned and reused. Offline waveform decoding defaults to bounded four-frame causal blocks on every backend; streaming emits one latent frame (80 ms of audio) per event. Both acoustic and Mimi state reset at each independent text-chunk boundary.

Attention defaults to auto, KV storage to f32; attention and kv_cache_type are independent explicit controls. Native CPU flow resolves automatic attention to eager and requires F32 KV; it is available with ENGINE_ENABLE_NEON=ON. Six GGUF packages are defined under audio-cpp/audio.cpp-gguf/PocketTTS-Small-GGUF, with documentation, routing/README/license entries and model validation tools.

Shared changes are additive: batched RoPE with independent row positions, and a configurable transformer GELU approximation retaining ExactErf for existing callers. Original PocketTTS code and GGML kernels are unchanged.

Performance versus official Python

RTX 5090, F32 weights, eight CPU threads, seed 42 per utterance. Eight English requests (seven distinct passages), 150–480 characters, with one full excluded warmup pass followed by one measured pass. Runs were sequential. C++ uses the current default auto attention (resolved flash), F32 KV, and bounded offline decoder. RTF is measured generation wall time divided by generated audio duration; lower is faster.

Model Python RTF audio.cpp RTF Speedup Python peak VRAM audio.cpp peak VRAM Python peak RAM audio.cpp peak RAM
18M 0.09412 0.01974 4.8× 940 MiB 855 MiB 1,704 MiB 886 MiB
7M 0.09735 0.01873 5.2× 880 MiB 789 MiB 1,694 MiB 820 MiB
2M 0.08179 0.01420 5.8× 798 MiB 757 MiB 1,673 MiB 802 MiB
18M-REFL 0.09441 0.01926 4.9× 940 MiB 855 MiB 1,705 MiB 887 MiB

CPU 18M: Python RTF 0.11985, audio.cpp 0.04615; peak RAM 1,266 → 622 MiB.

Memory is whole-process peak including loading and warmup: per-process GPU usage and host high-water RSS, sampled every 20 ms. Bounded decoding trades some GPU throughput for lower memory than the optional full-utterance graph. These memory comparisons do not apply to arbitrary larger-block/full-decoder settings.

Python: Kyutai pocket-tts commit 4cc5753319ceddc5cbf70598d9011f1f22858ba0; checkpoints: kyutai/pocket-tts revision db04f0e653473e5c7333c69686ac92b7460b0c1d.

Streaming

Same eight-case corpus, threads, weights and seed. TTFA is timestamped at the first nonempty audio event through the same application streaming runner used by CLI/server. Initial model/voice preparation is excluded. First-request TTFA includes graph initialization; warm TTFA is the mean of the eight requests after the excluded full warmup pass. First-request figures do not guarantee a cold shader/disk cache. These are GGML results; optional native CPU flow was not part of this streaming campaign.

Model Backend First TTFA Warm mean TTFA RTF Peak RAM
18M CUDA 143.9 ms 8.3 ms 0.02895 893 MiB
7M CUDA 135.2 ms 4.5 ms 0.02660 824 MiB
2M CUDA 133.0 ms 3.4 ms 0.01924 814 MiB
18M-REFL CUDA 143.3 ms 7.9 ms 0.02827 892 MiB
18M VULKAN 135.7 ms 9.6 ms 0.04865 558 MiB
7M VULKAN 27.5 ms 7.3 ms 0.04978 500 MiB
2M VULKAN 20.0 ms 5.3 ms 0.03510 489 MiB
18M CPU 41.7 ms 14.9 ms 0.06417 591 MiB
7M CPU 29.3 ms 8.2 ms 0.05315 477 MiB
2M CPU 14.6 ms 4.6 ms 0.03348 464 MiB

Streaming peak VRAM: CUDA 18M/7M/2M/18M-ReFL 837/771/741/837 MiB; Vulkan 18M/7M/2M 201/121/92 MiB. Every request emitted incremental audio, and concatenating events exactly reproduced the final WAV.

Validation and lifecycle

  • Debug build, model-spec validation and generic batched RoPE tests passed. Six GGUF contracts were refreshed without changing tensor hashes, shapes or dtypes.
  • Eight teacher-forced final-waveform comparisons passed cosine >0.99999 across selected variants/backends. Ordinary requests and explicit batch 1 were byte-identical across eight requests; independent row stopping, mixed voices and batch-to-single reuse were checked. CUDA reference-audio cloning was checked.
  • Lifecycle: 48 sessions / 684 generation calls on 18M, covering offline and streaming on CUDA, Vulkan and CPU. Short→medium→short→long transitions were repeated three times, with frame limits 96/320/768 deliberately exercising graph growth. Repeated outputs were bit-identical; all 18 independent-session comparisons with matched, primed graph capacities were bit-identical.
  • After graph growth, request-cycle memory stabilized across all three cycles. Default-policy CUDA VRAM stayed at 870.8 MiB streaming / 888.8 MiB offline, Vulkan at 231.5 / 246.0 MiB. CPU RSS stayed at 639.2 / 671.4 MiB. These are growth-stress settings, separate from the normal performance tables.
  • Different default graph capacities can change sampled output when comparing a fresh smaller session against an already-grown session on CUDA/CPU, sometimes by one frame. This happens offline too. Matching capacities eliminates the tested differences; independent ASR returned identical transcripts and 0% WER for all 12 affected fresh/reused clips. This does not establish sampled-output invariance across arbitrary graph shapes.
  • Two-sentence boundary controls: CUDA/Vulkan streaming exactly matched separately streamed sentences and one-frame offline decoding. CPU matched one-frame offline; independent sentence equality also passed with matched capacities. Offline four-frame versus streaming one-frame waveform cosine exceeded 0.99999 in all 18 lifecycle comparisons.

Whisper Small greedy English WER on the 338-word corpus:

Model Python WER audio.cpp offline WER audio.cpp streaming WER
18M 0.59% 0.59% 0.59%
7M 0.00% 0.59% 0.59%
2M 0.30% 0.30% 0.30%
18M-REFL 0.59% 0.59% 0.59%

This is a limited English corpus, not a general quality benchmark. Normal sampled outputs need not be byte-identical to Python.

@0xShug0
0xShug0 force-pushed the feature/pocket-tts-small branch from a48406d to cf423d6 Compare November 4, 2026 04:35
@0xShug0
0xShug0 merged commit 06d1067 into main Nov 4, 2026
7 checks passed
@0xShug0
0xShug0 deleted the feature/pocket-tts-small branch November 4, 2026 05:20
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