Abstract
RepCodec is a novel speech tokenization framework designed to bridge the information gap in semantic speech tokens. Unlike traditional k-means clustering which is often lossy, RepCodec utilizes a neural representation codec to reconstruct high-level speech features from pre-trained models like HuBERT or Whisper. By minimizing reconstruction loss in the feature space, RepCodec produces discrete tokens that preserve significantly more semantic and linguistic information. Experimental results across multiple benchmarks demonstrate that RepCodec substantially outperforms k-means in both speech understanding (ASR) and generation tasks, achieving up to a 50% relative improvement in Word Error Rate (WER) when integrated with Whisper.
Introduction
To integrate speech into Large Language Models (LLMs), continuous audio waveforms must be converted into discrete sequences, a process known as tokenization. Currently, researchers rely on either acoustic tokens, which result in prohibitively long sequences, or semantic tokens, typically generated via k-means clustering on pre-trained model features. However, k-means is a lossy process that discards vital information, leading to degraded performance in downstream tasks like Automatic Speech Recognition (ASR) and speech synthesis. RepCodec addresses this gap by replacing simple clustering with a neural "representation codec."
Methodology
RepCodec consists of an end-to-end neural architecture with three primary components: a Codec Encoder, a Vector Quantizer (VQ), and a Codec Decoder.
The key innovation lies in the training objective: instead of reconstructing raw waveforms (as seen in standard audio codecs like EnCodec), RepCodec is trained to reconstruct the feature space of a pre-trained speech encoder (e.g., HuBERT, data2vec, or Whisper). By minimizing reconstruction loss in this high-level embedding space, the resulting discrete tokens retain significantly more linguistic nuance than those produced by k-means.
Experimental Setup
The framework was evaluated on several standard benchmarks:
- LibriSpeech (960h): Used for codec training and ASR evaluation.
- Multilingual LibriSpeech (MLS): Used to assess robustness in French and Spanish.
- LJSpeech & VCTK: Used for speech resynthesis and voice conversion to measure generative quality.
Key Results and Analysis
RepCodec demonstrated substantial quantitative improvements across all evaluated tasks:
- Speech Understanding (ASR): Using
data2vec-largerepresentations, RepCodec achieved a 2.87% Word Error Rate (WER) on LibriSpeech (test-clean), compared to 4.55% for k-means. - Whisper Integration: When applied to Whisper-medium, RepCodec reduced the WER from 9.52% to 5.04%, a nearly 50% relative improvement.
- Speech Generation: In resynthesis tasks, RepCodec achieved a Mean Opinion Score (MOS) of 3.48, significantly higher than the 2.82 achieved by k-means.
The Role of Information Retention
A critical insight from this work is that information retention (low reconstruction loss) is a far better predictor of downstream performance than phoneme alignment (PNMI). Traditionally, researchers prioritized tokens that aligned closely with phonemes. However, RepCodec shows that neural reconstruction captures complex, non-linear relationships that k-means ignores, leading to better performance even if phoneme similarity is lower.
Conclusion
RepCodec represents a significant advancement in speech tokenization, proving that learning to reconstruct feature spaces is fundamentally superior to simple clustering. While a performance gap still exists between discrete tokens and continuous representations, RepCodec's encoder-agnostic nature and multilingual robustness make it a powerful tool for the next generation of speech-enabled LLMs. Future work will explore scaling the architecture with Transformers and training on larger datasets like GigaSpeech.
Summary updated