Differentiable K-means for Fully-optimized Discrete Token-based ASR

Kentaro Onda, Yosuke Kashiwagi, Emiru Tsunoo, Hayato Futami, Shinji Watanabe

TL;DR

Discretizing self-supervised learning (SSL) speech features using standard $k$-means creates a non-differentiable bottleneck, preventing end-to-end optimization for downstream tasks. This paper introduces a differentiable $k$-means framework using the Gumbel-Softmax trick, enabling joint optimization of SSL parameters, layer weights, and clustering centroids directly for Automatic Speech Recognition (ASR). The resulting discrete tokens are highly compressed, robust to speaker variations, and perform significantly better in both speech recognition and resynthesis.

What Problem Does This Paper Address?

Modern speech processing heavily relies on continuous embeddings from Self-Supervised Learning (SSL) models like WavLM or HuBERT. However, there is a growing shift toward discretizing these features into "discrete speech tokens" (acoustic units) to make speech compatible with text-based Large Language Models (LLMs) for generative tasks.

The standard pipeline extracts SSL features, clusters them offline using standard $k$-means, and passes the token IDs to a downstream model. The catch? $k$-means clustering is non-differentiable. Because gradients cannot flow backward through the clustering step, the upstream SSL model cannot be fine-tuned on the actual downstream task (like ASR). As a result, the generated tokens are suboptimal, often retaining task-irrelevant acoustic noise and speaker identities instead of focusing purely on linguistic content.

Methods

To bridge this gap, the authors propose Differentiable $k$-means for ASR, which replaces the hard assignment of standard $k$-means with a probabilistic, differentiable alternative.

  1. Gumbel-Softmax Reparameterization: Instead of a hard argmin operation to find the nearest cluster centroid, the framework calculates cluster assignment probabilities based on Euclidean distance and samples them using the Gumbel-Softmax trick. This allows gradients to pass through the tokenization layer during the backward pass.
  2. End-to-End Joint Optimization: The total loss function combines the downstream ASR cross-entropy loss and the $k$-means clustering loss. This allows the system to simultaneously update the ASR decoder, the cluster centroids, and the upstream SSL feature extractor.
  3. Multilayer Weighting: SSL models learn hierarchical representations (e.g., acoustic details in early layers, phonetic details in later layers). The authors integrate a learnable weighted sum of all SSL layers before the differentiable tokenization step, optimizing which layer combinations contribute most to the final ASR task.

Datasets

The approach was validated across several established speech benchmarks:

  • LibriSpeech (100-hour and 960-hour subsets): Used for primary ASR training and evaluation.
  • TIMIT: Used for precise token property analysis due to its high-quality, manually annotated phoneme alignments.
  • LJSpeech & VCTK: Used to evaluate speech resynthesis performance across in-domain (ID) and out-of-domain (OOD) conditions.
  • ML-SUPERB: A multilingual benchmark used to test the framework's robustness across multiple languages.

Key Insights and Ideas

  • Phonetic Purity over Quantization Error: Interestingly, full fine-tuning actually increases the normalized quantization error (NQE) compared to the baseline. This reveals an important "aha moment": minimizing geometric clustering error isn't necessary for downstream success. Instead, the model reshapes the embedding space to prioritize phonetic distinctions over acoustic exactness.
  • Massive Data Compression: In standard pipelines, reducing the number of clusters (e.g., from 2000 down to 100) severely degrades ASR accuracy. With differentiable $k$-means, a cluster size of 100 performs nearly as well as 2000, meaning highly compact representations can be achieved without sacrificing performance.
  • Speaker-Invariant Tokens: By optimizing directly for text transcription, the tokenization process naturally discards non-linguistic information like speaker identity and background noise, leading to shorter token sequences after deduplication.

Key Results

Automatic Speech Recognition (ASR)

On the LibriSpeech-100 benchmark, fully fine-tuning the system yielded massive Word Error Rate (WER) reductions, particularly for smaller cluster sizes. For a cluster size of 100, the WER on test-clean dropped from 7.6% to 5.4%.

Table 1: LibriSpeech-100 results with single-layer settings: WER(%) of test-{clean, other}

When utilizing multiple layers, the fully fine-tuned discrete token system closely approached the performance of systems using fully continuous SSL features, effectively closing the "discretization tax" performance gap.

LibriSpeech-100 Multi-Layer Results

Token Analysis & Resynthesis

Evaluations on the TIMIT corpus confirmed that the tokens became significantly more robust to speaker variations, as shown by the drop in Mean Token Error Rate (MTER).

Table 3: Cluster evaluations using TIMIT corpus

When these optimized tokens were used for speech resynthesis (text-to-speech style generation), they outperformed standard baseline tokens and even human-defined phone strings (g2p) in out-of-domain intelligibility and naturalness (UTMOS).

Table 4: Resynthesis performance with acquired units: syn- thesis models were trained with LJSpeech and tested with in- domain (ID) and out-of-domain (OOD) data (VCTK).

Limitations and Future Work

While the results are promising, the authors noted a few limitations:

  • Decoding Complexity: To keep gradient tracking straightforward, the authors did not implement token deduplication or subword modeling during the ASR training phase. Incorporating these could further improve sequence compression and decoding speed.
  • Scope of Tasks: The current work focuses primarily on ASR and speech resynthesis. The authors suggest that extending this differentiable tokenization framework to speech-to-speech translation and direct speech-language modeling (Speech LLMs) is a critical next step.

Summary updated

BibTeX
@inproceedings{onda2025differentiable,
  author = {Kentaro Onda and Yosuke Kashiwagi and Emiru Tsunoo and Hayato Futami and Shinji Watanabe},
  title = {{Differentiable K-means for Fully-optimized Discrete Token-based ASR}},
  booktitle = {Interspeech},
  year = {2025},
  doi = {10.21437/interspeech.2025-593},
}
Figure