Token Vocabulary Size in Audio Language Models

Token vocabulary size plays a pivotal role in the design of audio language models for Text-to-Speech (TTS), dictating the balance between representation density, sequence length, and resource consumption. This article examines how the size of an audio token vocabulary directly influences the computational cost of training and inference, as well as the optimization challenges and stability risks that arise when modeling discrete acoustic units.

The Trade-off Between Sequence Length and Vocabulary

Discrete audio codecs (such as EnCodec or SoundStream) compress continuous waveforms into discrete tokens using techniques like Residual Vector Quantization (RVQ). The chosen vocabulary size (\(V\)) determines the granularity of each discrete token.

Because the self-attention mechanism in Transformer-based architectures scales quadratically with sequence length, reducing sequence length via a larger vocabulary can substantially lower the computational footprint of the attention layers.

Computational Cost Dynamics

The vocabulary size alters where computational resources are consumed in the network:

  1. Softmax Bottleneck: The final projection layer maps hidden states to the vocabulary space, carrying a cost of \(O(d \times V)\), where \(d\) is the hidden dimension. As \(V\) increases, calculating cross-entropy loss over millions of tokens per batch becomes memory- and compute-intensive.
  2. Embedding Parameters: Large vocabularies require massive input and output embedding matrices. In resource-constrained environments, storing and updating these matrices can consume a significant fraction of GPU VRAM, limiting batch sizes.
  3. Inference Latency: During autoregressive generation, smaller sequences (enabled by larger vocabularies) mean fewer sequential forward passes are needed to produce an utterance, directly lowering inference latency even if each individual step is marginally heavier due to the larger softmax layer.

Impact on Training Stability

Vocabulary size directly impacts the gradients and optimization dynamics of the model:

Architectural Mitigations

Modern TTS architectures balance these competing factors by decoupling acoustic representation from the primary prediction step: