Abstract
Modern speech processing increasingly relies on discrete representations of audio to bridge the gap between continuous speech signals and large language models (LLMs). However, the standard discretization process—typically k-means clustering—is non-differentiable, creating a bottleneck that prevents end-to-end optimization. This paper introduces a differentiable k-means framework that enables the simultaneous training of speech tokenizers and Automatic Speech Recognition (ASR) models. By utilizing the Gumbel-Softmax reparameterization trick, the proposed method allows gradients to flow from the ASR objective back into the self-supervised learning (SSL) feature extractor. Experimental results demonstrate that this task-aware tokenization significantly improves recognition accuracy, achieves high performance with smaller codebooks, and produces tokens with higher phonetic purity.
Introduction
In the current landscape of speech technology, Self-Supervised Learning (SSL) models such as HuBERT and WavLM have become the standard for feature extraction. While these models provide rich continuous embeddings, there is a growing trend toward discretizing these features into "speech tokens." These tokens serve as a compact vocabulary for sound, making speech data more compatible with the architecture of LLMs.
Despite their utility, the standard method for generating these tokens—k-means clustering—suffers from three primary limitations. First, the optimization is disconnected; the tokenizer is usually trained in an unsupervised manner and frozen, forcing the downstream ASR model to adapt to potentially suboptimal features. Second, standard k-means often clusters sounds based on acoustic "nuisance" variables, such as speaker identity or background noise, rather than phonetic content. Finally, selecting the optimal layer from an SSL model for tokenization remains a manual and rigid process. This work addresses these challenges by making the discretization step fully differentiable.
Methodology
Differentiable Tokenization via Gumbel-Softmax
To overcome the non-differentiable nature of "hard" k-means assignments, the authors replace the nearest-neighbor selection with a probabilistic assignment using the Gumbel-Softmax trick. This reparameterization allows the system to approximate the categorical distribution of cluster assignments while remaining "gradient-friendly." Consequently, the ASR loss can be backpropagated through the tokenizer and into the underlying SSL model parameters.
Joint Optimization and Multilayer Weighting
The framework employs a composite loss function that combines the standard ASR cross-entropy loss with a k-means loss. This dual objective ensures that the learned centroids are both mathematically representative of the acoustic space and functionally useful for the linguistic task of speech recognition.
Furthermore, rather than manually selecting a single SSL layer, the model learns a weighted sum of all layers. This "fused" representation is then passed through the differentiable k-means layer, allowing the model to automatically determine which combination of features is most relevant for the task.
Training Strategy
The authors implement a phased training approach to ensure stability:
- Warm-up: The SSL model is frozen while the ASR head is stabilized.
- End-to-End Fine-tuning: The centroids and SSL parameters are "unfrozen," allowing for full joint optimization of the entire pipeline.
Experimental Setup
The method was evaluated across a diverse set of benchmarks to test its robustness and generalizability:
- LibriSpeech (100h & 960h): The primary benchmark for English ASR performance.
- ML-SUPERB: A benchmark for evaluating multilingual speech recognition capabilities.
- TIMIT: Utilized for phonetic probing to measure how well tokens align with human-annotated phonemes.
- LJSpeech & VCTK: Used for speech resynthesis experiments to evaluate the acoustic quality preserved in the tokens.
Results and Discussion
Accuracy and Efficiency
The differentiable k-means approach yielded substantial improvements in Word Error Rate (WER). On the LibriSpeech-100h "test-clean" set, the WER dropped from a baseline of 7.6% to 5.4% after full fine-tuning. Notably, the method proved highly efficient; a small codebook of just 100 clusters performed nearly as well as much larger traditional codebooks (e.g., 2000 clusters), representing a significant win for data compression.
Multilingual and Phonetic Performance
The framework's effectiveness extends beyond English. On the ML-SUPERB benchmark, the Character Error Rate (CER) improved from 28.2% to 19.9%. Analysis of the tokens via the Mean Token Error Rate (MTER) showed that as the model is fine-tuned, the tokens increasingly converge toward actual phonetic representations, effectively ignoring speaker-specific variations.
Resynthesis Quality
Interestingly, although the tokens are optimized for ASR (a task that typically discards non-linguistic detail), they achieved higher "Naturalness" scores (UTMOS) in speech synthesis compared to standard k-means tokens. This suggests that the differentiable approach captures cleaner, more structured linguistic content that is beneficial even for generative tasks.
Conclusion and Future Work
This paper demonstrates that making the tokenization process differentiable is a powerful way to optimize discrete speech representations. By bridging the gap between feature extraction and downstream recognition, the proposed method achieves state-of-the-art results with significantly smaller codebooks.
Future research may explore the integration of deduplication and subword modeling to further enhance efficiency. Additionally, while this work focuses on ASR, the authors suggest that these "task-aware" tokens could provide significant benefits for speech-to-speech translation and generative language modeling.
Summary updated