Skip to content

docs(proposals): backbone micro-batch follows llama.cpp - #5

Closed
hans00 wants to merge 3 commits into
mainfrom
fix/tts-runner-ubatch-cap
Closed

hans00 wants to merge 3 commits into
mainfrom
fix/tts-runner-ubatch-cap

Conversation

@hans00

@hans00 hans00 commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Now a proposal only. The implementation is reverted on this branch (bfe476f reverts f3e3e5d). Both parts of the change touched public headers: the meaning of codec_audio_lm_backbone_req::n_ubatch in include/codec_audio_lm.h, and a host field in common/tts_runner.h.

docs/proposals/backbone-ubatch.md covers:

  • Where the model-specified value came from. examples/tts.py (7afe2ab) set n_ubatch = n_ctx without giving a reason, and the C++ host copied it. OuteTTS's 4096 (f10a3d5) was a cap that came with its 8192-token context, not a requirement.
  • Why no model needs it. llama.cpp needs n_ubatch >= n_tokens only for non-causal attention (llama-context.cpp:1750) or encoders. Every backbone here is a causal LM.
  • The proposal. Hosts set n_ubatch the way llama.cpp does (default 512, -ub/--ubatch-size). The struct field becomes a minimum that the model requires, and every family sets it to 0. There are no "0 means n_ctx" semantics.
  • Alternatives (a bool, or keeping the field), compatibility, and measured effect: Qwen3-TTS compute buffer 2502 → 313 MiB.

Net diff vs main: one new doc file.

🤖 Generated with Claude Code

hans00 and others added 3 commits November 14, 2026 19:08
codec_audio_lm_backbone_req::n_ubatch == 0 made the runner use n_ctx as the
micro-batch, so the context reserved a compute buffer for the whole context at
once: 2.5 GB for Qwen3-TTS 0.6B (n_ctx 4096) on every load, 172 MB for Soprano.
A model whose prompt needs one physical batch still says so (OuteTTS: 4096);
otherwise the runner now uses llama.cpp's default of 512 and llama.cpp splits
longer prompts. tts-cli / tts-server take --ubatch N (tts_runner_params::n_ubatch).

Verified on CPU (8 threads):
- Qwen3-TTS 0.6B Base, ICL clone: compute buffer 2502 -> 313 MiB, output
  bit-identical to --ubatch 4096, same timing.
- Soprano, prompt shorter than 512 tokens: bit-identical; a ~500-token prompt
  (split in two): first 6 s at 35-46 dB SNR (summation order), then a greedy
  step flips and the generations diverge, as any float change does. Peak RSS
  932 -> 872 MB, compute buffer 172 -> 22 MiB.
…h, default 512)

Replaces the reverted implementation: both parts touch public headers
(codec_audio_lm.h n_ubatch meaning, tts_runner.h host field), so they come as a
proposal with the evidence for where the model-specified value came from.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@hans00 hans00 changed the title fix(tts-runner): micro-batch 512 unless the model needs more docs(proposals): backbone micro-batch follows llama.cpp Nov 14, 2026
@hans00 hans00 closed this Nov 14, 2026
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