A Residual Vector Quantizer (RVQ) trained to discretize DACVAE latent representations into discrete tokens suitable for autoregressive language model generation.
Why Quantize DACVAE?
The Problem
DACVAE is an exceptionally efficient latent audio codec — its 128-dimensional continuous latent space at 25 fps is ideal for diffusion models (DiTs), flow matching, and other continuous generative approaches. However:
DiTs struggle with language understanding. Diffusion Transformers are powerful for audio generation but are not naturally suited to understanding complex natural language instructions — e.g., "speak this line with a warm, slightly raspy voice, as if comforting a child" or "deliver this with growing frustration, starting calm and ending in a shout."
LLMs excel at instruction following. Large Language Models are unmatched at understanding nuanced text instructions, reasoning about style/emotion/prosody, and generating structured outputs — but they need discrete tokens, not continuous vectors.
The Solution: RVQ as a Bridge
This RVQ model bridges the gap between LLMs and DACVAE:
Text Instruction → LLM → Discrete RVQ Tokens → Codebook Lookup → DACVAE Latents → Audio
^^^^ ^^^^^^^^^^^^^^^^^
Understands voice Instant decode (no neural net!)
design instructions Just a table lookup + sum
The key insight: RVQ tokens can be added to an LLM's vocabulary, enabling a unified model that understands both text and audio. The LLM generates coarse audio tokens that capture semantic content and speaker characteristics, while a lightweight acoustic model (or DiT) refines them into high-fidelity audio.
1# Only use levels 0-1 in the LLM vocabulary2# This adds just 16,384 tokens and produces 50 tokens/sec34# LLM generates coarse tokens:5# <audio_start> tok_2341 tok_8821 tok_1123 tok_9942 ... <audio_end>67# Separate acoustic model predicts fine tokens (levels 2-15)8# from the coarse tokens, then decode via RVQ + DACVAE910coarse_tokens = llm_output # (T, 2) from LLM11fine_tokens = acoustic_model(coarse_tokens)# (T, 14) predicted12all_tokens = np.concatenate([coarse_tokens, fine_tokens], axis=1)# (T, 16)13latents = codec.decode(all_tokens)
Architecture
There is no encoder or decoder neural network. The entire model is 16 codebook lookup tables:
Encoding (nearest-neighbor search):
Input x (128-dim float vector)
→ Find nearest entry in codebook_0 → token_0, residual = x - codebook_0[token_0]
→ Find nearest entry in codebook_1 → token_1, residual -= codebook_1[token_1]
→ ... repeat for all 16 levels
Output: 16 integer tokens (each 0-16383)
Decoding (pure addition):
reconstruction = codebook_0[t0] + codebook_1[t1] + ... + codebook_15[t15]
Each codebook is a (16384, 128) float32 matrix. Decoding is a single gather + sum operation — no neural network inference required.
Training Details
Method: Exponential Moving Average (EMA) codebook updates — not gradient-based
Dataset:TTS-AGI/maestrino-data-DACVAE — 1,137 WebDataset tar files containing ~5.5M speech samples with 128-dim DACVAE latent vectors
Scale: 1.58 billion vectors per epoch, 6 epochs = 9.5 billion training vectors
Streaming: Data streamed directly from HuggingFace (no local storage needed)
Multi-GPU: 8 shards across 8×A100 GPUs, codebooks averaged after each epoch