Abstract
Connectionist Temporal Classification (CTC) is a widely used criterion for training supervised sequence-to-sequence (seq2seq) models. It enables learning the relations between input and output sequences, termed alignments, by marginalizing over perfect alignments (that yield the ground truth), at the expense of imperfect alignments. This binary differentiation of perfect and imperfect alignments falls short of capturing other essential alignment properties that hold significance in other real-world applications. Here we propose Align With Purpose (AWP), a general Plug-and-Play framework for enhancing a desired property in models trained with the CTC criterion. We do that by complementing the CTC with an additional loss term that prioritizes alignments according to a desired property. Our method does not require any intervention in the CTC loss function, enables easy optimization of a variety of properties, and allows differentiation between both perfect and imperfect alignments. We apply our framework in the domain of Automatic Speech Recognition (ASR) and show its generality in terms of property selection, architectural choice, and scale of training dataset (up to 280,000 hours).
Introduction: The CTC Blind Spot
In sequence-to-sequence modeling, particularly Automatic Speech Recognition (ASR), Connectionist Temporal Classification (CTC) is a standard objective. However, CTC possesses a significant limitation: it treats all paths that result in the correct transcript as equally desirable. In a production environment, this is rarely true. For instance, a model might produce a perfect transcript but with high latency, emitting tokens only after the audio has finished. CTC training marginalizes over all "perfect" paths, failing to distinguish between a fast alignment and a sluggish one.
Furthermore, CTC struggles to differentiate between "imperfect" alignments. An alignment that is one character off is treated with the same binary rejection as complete gibberish. For real-world applications like streaming captions or voice assistants, we require models that favor specific alignment properties—namely, those that minimize latency or maximize word-level accuracy.
The Align With Purpose (AWP) Framework
To address these limitations, we introduce Align With Purpose (AWP). AWP is a "plug-and-play" framework that acts as a fine-tuning step, allowing researchers to optimize for specific properties without modifying the underlying CTC loss function.
The AWP workflow consists of three primary components:
- Sampling: Given an input $x$, we sample $N$ possible alignments $a_i$ from the pre-trained acoustic model's output distribution $P(a|x)$.
- The Property Function ($f_{prop}$): This user-defined function takes a sampled alignment $a_i$ and produces an "improved" version $\bar{a}_i$ based on the target property. For latency optimization, $f_{prop}$ might shift tokens earlier in time. For accuracy, it might correct a specific word error to match the ground truth.
- Hinge Loss Optimization: The model is trained using a joint loss: $\mathcal{L} = \alpha \mathcal{L}_{AWP} + \mathcal{L}_{CTC}$. The auxiliary $\mathcal{L}_{AWP}$ is a hinge loss that penalizes the model if the probability of the original alignment $a_i$ is higher than the improved alignment $\bar{a}_i$. This effectively "pushes" the model to favor the desired property.
Experimental Results and Scale
We evaluated AWP across three distinct data scales to demonstrate its robustness: LibriSpeech (960 hours), a subset of LibriVox (35,000 hours), and a massive internal dataset totaling 280,000 hours. The framework was tested across various architectures, including Stacked ResNets, Wav2Vec2, and Conformers.
Latency Optimization
When optimized for emission time, AWP achieved significant latency reductions. On the 35k-hour dataset, we observed an improvement of up to 590ms compared to baseline models, with only a negligible impact on Word Error Rate (WER). In some instances, the model exhibited "negative drift," emitting tokens faster than the high-quality offline reference models.
Accuracy Enhancement
By defining $f_{prop}$ to minimize word-level errors, AWP provided a 4.5% relative improvement in WER over baseline models. This demonstrates that AWP can effectively distinguish between "near-miss" imperfect alignments and poor ones, guiding the model toward more accurate word-level predictions.
Conclusion
Align With Purpose provides a simple yet powerful method for steering CTC models. By breaking the symmetry of the CTC objective, we gain control over critical performance metrics like latency and accuracy. The framework is architecture-agnostic, requires only a few lines of code to implement, and scales effectively to industrial-sized datasets. While demonstrated here for ASR, the principles of AWP are applicable to any sequence-to-sequence task utilizing alignment-free loss functions.
Summary updated