{'fraction_non_alphanumeric': 0.038039123261843034, 'fraction_numerical': 0.015743577657317934, 'mean_word_length': 4.937867338371117, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Contrastive Semi-supervised Learning for ASR

Pseudo-labeling is the most adopted method for pre-training automatic speech recognition (ASR) models. However, its performance suffers from the supervised teacher model's degrading quality in low-resource setups and under domain transfer. Inspired by the successes of contrastive representation learning for computer vision and speech applications, and more recently for supervised learning of visual objects, we propose Contrastive Semi-supervised Learning (CSL). CSL eschews directly predicting teacher-generated pseudo-labels in favor of utilizing them to select positive and negative examples. In the challenging task of transcribing public social media videos, using CSL reduces the WER by 8% compared to the standard Cross-Entropy pseudo-labeling (CE-PL) when 10hr of supervised data is used to annotate 75,000hr of videos. The WER reduction jumps to 19% under the ultra low-resource condition of using 1hr labels for teacher supervision. CSL generalizes much better in out-of-domain conditions, showing up to 17% WER reduction compared to the best CE-PL pre-trained model.


INTRODUCTION
Driven by the practical need to deploy speech and audio models to new languages and domains, there has been a surge in research work utilizing self-, semi-, and weakly-supervised approaches for speech and audio representation learning achieving impressive results on a wide variety of tasks.
The contrastive loss, which has been utilized extensively in selfsupervised computer vision and speech applications [1,2,3,4], centers around distinguishing one or more positive examples from negative ones given an anchor sample. It has also been utilized for supervised learning of visual objects [5].
Pseudo-labeling is the most adopted approach of semi-supervised learning in speech recognition since the late 1990s and more recently for modern end-to-end neural approaches [6,7,8,9,10,11,12,13,14,15,16]. A 'teacher' model uses a small amount of supervised data for training, then transcribes a larger volume of unlabeled audio data. A 'student' model then utilizes the teacher-generated pseudo-labels for its training. Depending on the downstream task, the student model can be smaller [17] or larger [15] than the teacher model. A critical ingredient of pseudo-labeling is filtering the teacher-generated data by removing implausible, low-quality hypotheses through confidence filtering [18], which reduces the possibility of the student model copying the teacher's mistakes. The whole pseudo-labeling process stalls when the initial labeled data is not large enough to train a reliable teacher model.
In this paper, we introduce a Contrastive Semi-supervised Learning (CSL) approach that benefits from a contrastive loss for improving the stability of learned speech representations. Precisely, we use a contrastive loss to replace the cross-entropy loss in the standard pseudo-labeling pre-training (CE-PL). Contextual representations of audio segments are optimized to get closer to others with similar pseudo-labels (positive examples) and further away from ones that are different (negative examples). Such soft constraint during learning allows the CSL to be more resilient to teacher labeling noise. To demonstrate its resilience to pseudo-labeling noise, we apply CSL pre-training in a low-resource setup with only 10hr of labeled data, where it reduces WER by 8% compared to the standard cross-entropy pseudo-labeling (CE-PL). This WER reduction increase to 19% with a teacher trained only on 1hr of labels and 17% for out-of-domain conditions.

RELATED WORK
Our paper builds upon previous research work in ASR pre-training using semi-supervised and self-supervised techniques. Pseudolabeling, a semi-supervised method, where a supervised 'teacher' model is used to label a large volume of unlabeled data, is a widely adopted pre-training method for ASR. Similar approaches with slight variations exist in the literature as teacher-student training, knowledge distillation, and self-training. Since the 1990s, pseudolabeling showed improvements to classical HMM/GMM systems as well as hybrid-NN systems [6,7,8,10,9,11], and also for end-to-end ASR approaches [12,13,14,15,16]. Our work inherits the same setup of utilizing a (small) set of supervised data for the teacher model learning similar to pseudo-labeling. However, we introduce a contrastive pre-training loss to deal with low-quality teacher pseudo-labels.
Recently, self-supervised ASR pre-training achieved impressive performance, especially with minimal amounts of labeled data [2,3,19,20,21,22,4,23]. Given unlabeled audio data, self-supervised methods rely primarily on pretext pre-training tasks that acquire their labels either from the input signal itself, e.g., predicting future frames [20] or via unsupervised means, e.g., feature clustering [4,23]. Many self-supervised methods boil down to contrasting positive and negative samples for a particular anchor sample. Depending on the downstream application in mind, positive samples could be near-by frames to the current time step or random samples for the same speaker. Negative samples could be further-away frames or samples for a different speaker [2,4]. After pre-training, a supervised fine-tuning stage optimizes the model performance for one or more downstream tasks, e.g., ASR.
Our approach relies on pseudo-labels from a supervised teacher model for positive and negative example selection. This work draws inspiration from the recent application of contrastive learning for supervised learning of visual object classification [5].

Pseudo-Labeling
The pseudo-labeling approach uses a supervised teacher ASR model to decode a large volume of unlabeled audio data X and generate pseudo-labels Y . The model training proceeds by using these pairs in a supervised learning setup. Following a hybrid-NN training approach, we align the labels to the input feature vectors to get a sequence of frame-level pairs: (x1, y1), (x2, y2), (x3, y3), ..., (xT , yT ), where yi are represented as chenone units [24].
Let the model be composed of two functions Fenc and G pred . Fenc(X1:T ) encodes the full input sequence and returns a sequence of contextualized representations Z1:T . The predictor network G pred (Z) produces a sequence of frame-level probability distributions over the chenone output units p(Ŷ1:T |X). In this paper, G pred is chosen to be a linear layer followed by a softmax function.
Our training objective is the cross-entropy loss of predicting frame-level chenones: Where B is the batch size, Ti the length of utterance i, and yti is the chenone target for utterance i at frame t.

Contrastive Semi-supervised Learning
Contrastive losses, e.g., InfoNCE [2], are at the heart of many selfsupervised representation learning approaches, where two groups of samples, positive and negative, are selected for a specific anchor data point within a pretext task-the training phase proceeds by iteratively improving the model's ability to distinguish samples in each group. Negative samples are selected randomly from a mini-batch or a memory bank of previous experiences, while positive samples could be augmented versions of the anchor, nearby frames, or samples from the same speaker. Data points' designation as positive and negative samples determines the learned representation nature and performance on downstream tasks. Our proposed Contrastive Semi-supervised Learning (CSL) approach synthesizes pseudo-labeling and self-supervised methods while solving some of their weaknesses. It bypasses the challenge of positive and negative sample selection of self-supervised methods by utilizing a supervised teacher. Using a large volume of unlabeled data and given the teacher's pseudo-labels, we select audio segments within one mini-batch as positive pairs if they share the same label and as negative pairs otherwise. Compared to standard pseudolabeling methods, CSL is resilient to errors in teacher-generated targets since it utilizes relative distance between label classes as a learning signal.
More precisely, during the CSL pre-training, our model consists of two functions: The encoder Fenc(X1:T ) = Z1:T which encodes input audio into latent representations, and a projection network Mproj(Z1:T ) = H1:T that maps encoder representations into a new space suitable for applying the contrastive loss. We normalize the projected features H1:T to unit length. A hybrid-NN supervised teacher generates aligned pseudo-labels Y1:T to guide the selection of positive and negative samples for the contrastive loss.
Given the speech signal's local smoothness, each positive or negative sample is an audio segment with a specific label. Concretely, let's define a span [i : j] as a segment if all its pseudo-labels [yi : yj] are equal, and it is not contained in a larger span with the same pseudo-label. We then randomly sample a single time step k to represent this segment with label y k in the loss function. Assuming S segments in all utterances in the mini-batch, a total of S representative latent vectors are selected {z1, .., zi, .., zS}, then projected using Mproj into unit length vectors {h1, .., hi, .., hS}. Given the corresponding pseudo-labels {y1, .., yi, .., yS} for sampled vectors, our training objective is: is the set of samples in the mini-batch with the same pseudolabel as i. The rest of the mini-batch samples belong to N (i) as negative examples. τ is a tunable temperature hyperparameter. Following the InfoNCE loss, the CSL objective function adjusts the encoder Fenc to bring its features of similar pseudo-labels closer and other negative samples further away. After the CSL pre-training, the prediction network G pred replaces the projection network Mproj for supervised fine-tuning of the whole network, including the encoder network Fenc.
In this paper, we apply frame-level cross-entropy fine-tuning, but other loss functions, e.g., the Connectionist Temporal Classification (CTC) [25] loss, can also be used. Our formulation is an adaptation of the previous work in computer vision [5] which applies a contrastive loss in a supervised setup. The CSL pre-training offer many benefits: • Utilizing teacher pseudo-labels for selecting positive and negative samples, CSL is more stable than self-supervised pre-training methods, which are sensitive to the diversity and the criterion for choosing positive and negative samples. Moreover, CSL enables reliable sampling of positive examples within and across utterances in the mini-batch.
• Unlike the standard pseudo-labeling pre-training methods, which forces the model to predict the teacher targets, CSL applies a softer constraint on learned representations through the contrastive loss. Such formulation improves robustness to noisy teacher pseudo-labels.
• Applying the contrastive loss over normalized representations emphasizes hard positives and negative examples, as shown analytically in [5], which enables the pre-trained model to generalize better under out-of-domain conditions.

Label-Aware Batching (LAB)
Large mini-batch sizes are critical for contrastive losses to ensure a diverse set of negative samples. For CSL, it also brings several positive realizations of speech sounds. Given the CSL loss formulation, we require at least two positive instances of each label class in the mini-batch. Some rare sounds might not form positive pairs for small randomly sampled mini-batches, leading to poor representations. To account for this problem, we propose Label-Aware Batching (LAB). LAB incrementally builds each mini-batch considering the number of segments representing label k in the current partially-created mini-batch, C(k). First, it samples a rare label r with probability ( 1 C(r) ) α / n i=1 ( 1 C(i) ) α , and then samples without replacement two random utterances containing the class r to add to the current mini-batch. LAB updates the counts C(k) for all labels appearing in these two utterances and repeats until it reaches the maximum number of utterances in a mini-batch. We use α = 2 in our experiments. For stable learning, we aggregate gradients over multiple mini-batches to perform a single model update and scale the learning rate accordingly [26].

Data
We use two in-house de-identified data sources with no personally identifiable information (PII). The first source contains de-identified public five-minute videos on Facebook in British English and Italian. During training, we segment all videos to a maximum of 10 seconds. To simulate a low-resource condition, we use 10hr labeled data for both teacher training and the final fine-tuning stage. We also test a more extreme setup with merely 1hr worth of labels. We use 75,000hr of unlabeled videos for pre-training and evaluate performance on 14hr of human-labeled videos for each language.
As an upper bound, we compare performance against a fully supervised setting with 650hr and 3,700hr labeled data for British English and Italian, respectively. We sample 23hr general English videos to test accent generalization. The second source contains recordings of crowd-sourced workers responding to artificial prompts with mobile devices. We collect two evaluation datasets to test out-of-domain generalization: 15hr of short message dictation and 13hr of longform conversations of up to 144 second long. The language model (LM) for British English uses the 650hr transcripts plus an additional 13,000hr of general English video transcripts, while the Italian LM uses only the 3,700hr transcripts.

Model Details
Fenc has a VGG front-end and 12 transformer blocks (dim=768, FFN=3072, 8 heads, stride 4) following [27] ( 90M parameters). For CSL pre-training, Mproj is a single hidden layer network of size 1024 and 128 output dimension. Input and output representations of Mproj are length normalized. Our input speech features are 80 dimensional, speed perturbed [28] Mel-scale log filterbank coefficients computed every 10ms over 25ms windows. We report the results of a single pass decoding using a 5-gram LM.

Training Details
For the pseudo-labeling baseline and CSL pre-training, the teacher model is a hybrid-NN ASR system trained on the initial 10hr of labeled data. Given the small number of supervised labels, we use 368 and 424 chenone outputs [24] for the British English and Italian systems, respectively. A supervised frame-level cross-entropy (CE) fine-tuning stage follows pre-training for all baseline and CSL models presented using the same amount of labels used for the respective teacher (either 10hr or 1hr depending on the experiment).
We use the Adam optimizer [29] with mixed-precision training [30] and gradient norm clipping at 10. We tune the learning rate (lr) for best performance on each task: lr=1e-4 for all supervised and pseudo-labeling baselines, lr=5e-5 for fine-tuning CSL pre-trained models. We apply 320k model update steps with a tri-stage lr schedule for pre-training: 13k warm-up steps, and the remaining steps are split evenly between constant lr and linear decay. We use 16 GPUs for pre-training, with about 320sec of audio per GPU. We apply 60 epochs of updates on a single GPU with a 0.8 multiplicative decay every epoch after the 40th epoch for fine-tuning. Using the CSL loss introduced a 15% increase in training time compared to baseline pseudo-labeling due to the pairwise similarity score computations, which can be further optimized by reducing the number of positive and negative examples used for frequent units.
We apply two types of input feature masking: Double masking policy (LD) [31] and a Short Time Masking (STM) policy which follows LD in frequency masking and increases the number of time masks to 15 with lengths uniformly sampled between 16 and 32 timesteps.  Table 1 presents the main results of our experiments. The best CE pseudo-labeling (CE-PL) pre-training strategy improves the respective supervised baseline by about 36% and 46% for both languages using 10hr of labels. CSL provides a relative improvement of 8% and 7% over the best CE-PL system bringing the overall WER closer to the fully supervised case, which utilizes orders of magnitude more labeled data. We observe performance degradation without normalizing the projected features. The Mproj output dimension can be reduced to 128 without significant performance loss. Unlike the supervised case in [5], high values for the contrastive loss temperature (τ =1) consistently provided the best performance since it reduces the harm of noisy teacher pseudo-labels. The proposed Short Time Masking (STM) policy improves both CE and CSL by a 6-9% relative (B2, C8) compared to the baseline policy. Fine-tuning the whole network after pre-training offered better performance than freezing the Fenc subnetwork.  Table 3. Relative WERR (WER reduction) of using CSL and CE-PL for out of domain conditions

Effect of large and label-aware batching
Increasing the per-GPU batch size from 320 seconds to 600 seconds improves WER by 3-4% relative (C3), supporting our hypothesis that incorporating more positive and negative examples improves learned representations during the CSL pre-training. Gradient accumulation, which comes at no extra GPU memory cost, improves learning stability as each update observes more speech units. It provides a 3-6% relative WER improvement (C7) and points to a potential future direction of adding a memory bank to hold extra positive and negative samples. Label-Aware Batching (LAB) provides a small but consistent boost in performance (C9) and provides the best performance both for the CSL and CE-PL systems when combined with all other improvements (C9 and B3).

Effect of positives and negatives sampling policy
In line with findings in self-supervised speech representation learning [4,2], using negative samples from the same utterance offers better WER compared to a random sampling of negative examples across utterances. The model learns to marginalize the speaker identity information while focusing on the speech content, which is preferable for an ASR downstream task but not necessarily for other speech applications. Using eight samples for both negative and positive comparisons was enough to reach the best performance. Limiting positives samples to be from the same or different utterances did not make a significant difference.

Effect of best policy on CE-PL
The last row of Table 1 presents the best CSL results by combining all the improvements above. Applying the same improvements to cross-entropy pseudo-labeling (CE-PL) offers about a 15% and a 12% relative WER reduction (B3) compared to the original policy (B1). Table 2 shows the experiments to test potential complementarity between CE pseudo-labeling (CE-PL) loss and the contrastive loss. Using the setup of (C3) from Table 1, the two loss functions are applied to mini-batches using shown percentages in Table 2. Applying the CE-PL to some mini-batches does not improve the learned representation for the downstream ASR task than the CSL case.  Table 5. Ultra low-resource condition using 1hr of labels.

Out of Domain Generalization of CSL
brought more significant improvements 11-17% when tested in outof-domain conditions. The CSL pre-training discovers more stable representations compared to CE-PL, which confirms our initial intuition.

Effect of iterative labeling
Using multiple rounds of pseudo-labeling for model pre-training was found very effective for the classical GMM/HMM systems in the mid 2000s [9] and more recently for neural systems [15,32,12]. Table 4 examines if the gain observed using CSL diminishes under an iterative labeling scheme due to the improved baseline CE-PL performance. Each generation starts by generating new teacher pseudo-labels for the unlabeled videos using the previous generation's model. A CE fine-tuning step is performed for all experiments reported in Table 4. Both CE-PL and CSL improve using iterative re-labeling. The gains from CSL pre-training are complementary to iterative re-labeling.

Ultra low-resource condition with 1hr of labels
To confirm CSL pre-training resilience to teacher pseudo-labeling errors, we test CSL and CE-PL under an ultra low-resource condition using only 1hr of labeled data for teacher training. Table 5 shows the WER on British English with about 19% relative improvement achieved by CSL compared to CE-PL, which suffers from teacher label noise. Using 1hr of labels and two iterations of CSL, we can close about 80% of the performance gap with 650hr of supervised data in the challenging domain of social media video transcription.

CONCLUSION
Inspired by the impressive performance of self-supervised representation learning in computer vision and speech, we introduced Contrastive Semi-supervised Learning (CSL), which applies a contrastive loss for semi-supervised ASR pre-training. For the challenging task of social media video transcription, using 75,000hr of unlabeled videos and only 10hr of labeled data, CSL offers an 8% relative WER reduction compared to the strongest Cross-Entropy pseudolabeling (CE-PL) baseline. CSL pre-training proved more resilient under out-of-domain conditions and even using 1hr of labeled data.