Aligning the Pretraining and Finetuning Objectives of Language Models

by   Nuo Wang Pierse, et al.

We demonstrate that explicitly aligning the pretraining objectives to the finetuning objectives in language model training significantly improves the finetuning task performance and reduces the minimum amount of finetuning examples required. The performance margin gained from objective alignment allows us to build language models with smaller sizes for tasks with less available training data. We provide empirical evidence of these claims by applying objective alignment to concept-of-interest tagging and acronym detection tasks. We found that, with objective alignment, our 768 by 3 and 512 by 3 transformer language models can reach accuracy of 83.9 concept-of-interest tagging and 73.8 200 finetuning examples per task, outperforming the 768 by 3 model pretrained without objective alignment by +4.8 small language models in the presence of hundreds of training examples or less "Few Example learning". In practice, Few Example Learning enabled by objective alignment not only saves human labeling costs, but also makes it possible to leverage language models in more real-time applications.



There are no comments yet.


page 1

page 2

page 3

page 4


METRO: Efficient Denoising Pretraining of Large Scale Autoencoding Language Models with Model Generated Signals

We present an efficient method of pretraining large-scale autoencoding l...

Extracting Training Data from Large Language Models

It has become common to publish large (billion parameter) language model...

Improving Code Autocompletion with Transfer Learning

Software language models have achieved promising results predicting code...

To Pretrain or Not to Pretrain: Examining the Benefits of Pretraining on Resource Rich Tasks

Pretraining NLP models with variants of Masked Language Model (MLM) obje...

An Explanation of In-context Learning as Implicit Bayesian Inference

Large pretrained language models such as GPT-3 have the surprising abili...

Memorization Without Overfitting: Analyzing the Training Dynamics of Large Language Models

Despite their wide adoption, the underlying training and memorization dy...

Does the Objective Matter? Comparing Training Objectives for Pronoun Resolution

Hard cases of pronoun resolution have been used as a long-standing bench...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

In the past three years, new deep learning language model architectures and techniques have significantly advanced the field of computational linguistics. The current state-of-the-art language models use large Transformer architectures Vaswani et al. (2017) containing hundreds of millions of parameters and are pretrained using multi-billion word corpuses. GPT Radford et al. (2018) and BERT Devlin et al. (2019) are two of the first examples of these Transformer-base language models. They outperformed the RNN-based models such as ELMo Peters et al. (2018) by a significant margin in benchmarks like GLUE Wang et al. (2019) and SQuAD Rajpurkar et al. (2016). Since the release of GPT and BERT, many researchers have further improved the Transformer-based language models demonstrated by surpassing their predecessors in the evaluations of the common benchmarks Liu et al. (2019c); Dong et al. (2019); Conneau and Lample (2019); Conneau et al. (2019); Raffel et al. (2019); Yang et al. (2019); Sun et al. (2020).

These new language model releases typically use more model parameters than their predecessors and are evaluated only on the academic datasets. This contrasts the two major challenges that we face in building natural language understanding (NLU) applications: (1) Speeding up language model inference; (2) Shortage of finetuning data for application-specific tasks. In our experience, the inference speed of the 768 by 12 BERT-base model, the smallest BERT model, is far from meeting the requirements for most real-time applications. To speed up language models, people have developed libraries for fast neural network computation

Zhang et al. (2018); Junczys-Dowmunt et al. (2018) and built smaller models with sufficient prediction power using knowledge distillation Jiao et al. (2019) or improved Transformer architectures Lan et al. (2020)

. In terms of the learning techniques for low-resource tasks, knowledge transfer through pretraining itself is a partial solution. GPT-2 has demonstrated its impressive zero-shot learning capability in text generation and question & answering

Radford et al. (2019). Besides transfer learning, multitasking is another common technique used to boost low-resource task performance Lin et al. (2018); Liu et al. (2019b); Conneau and Lample (2019).

In this paper, we tackle both of the above challenges at once. We develop a solution to train high-quality small language models using only a few hundred finetuning examples. We attempted to maximize the efficacy of knowledge transfer by designing pretraining objectives that closely resemble the finetuning objectives - we call this “explicit objective alignment”, “objective alignment” in short. In our tasks, objective alignment not only enabled smaller language models to perform the finetuning tasks equally well as their larger counterparts pretrained without objective alignment, but also reduced the number of finetuning examples required. We were able to develop a concept-of-interest tagger and an acronym detector using a 768 by 3 Transformer model and 200 finetuning examples for each task. We call finetuning in this model size and data size limit Few Example Learning (FEL).

The main contributions of this paper are:

  • [topsep=0pt]

  • We propose pretraining objective alignment as a solution to developing small language models for NLU applications that have limited labeled data.

  • We demonstrate our solution by building two NLU applications of reasonable accuracy using a 768 by 3 Transformer model and 200 finetuning examples each.

  • We provide detailed steps to carry out object alignment, complete descriptions of the training parameters and recommendations for best practices.

2 Objective Alignment and FEL

Inspired by the success of zero-shot learning Radford et al. (2019), we developed a solution - objective alignment - to tackle the problem of finetuning data scarcity. Objective alignment in the scope of this paper is a type of transfer learning that specializes in transferring the knowledge needed for the finetuning tasks of interest. “Alignment” describes our attempt to design new pretraining objectives that resemble the finetuning objectives better than the standard pretraining objectives such as masked language model (MLM) and next-sentence prediction (NSP) Devlin et al. (2019). We provide detailed examples of objective alignment in Section 3.2.

Figure 1: A possible explanation of objective alignment and Few Example Learning (FEL).

The loss function minimum of an aligned pretraining objective (gray dot) is designed to be located near the loss function minimum of the finetuning objective (lower black dot) in the finetuning task model parameter subspace (“model parameters” in short). When the model switches from pretraining to finetuning, only a small amount of learning is necessary for finetuning convergence (double-dashed arrow).

FEL is the process of finetuning small language models using hundreds of examples or less after objective-aligned pretraining. We provide a possible explanation of FEL in Figure 1. During pretraining, the model undergoes multitask learning and converges along the additively combined loss functions of the standard pretraining objectives and the aligned pretraining objectives. The aligned objectives help the model converge closer towards the finetuning objective loss function minimum in the finetuning task model parameter subspace. And as a result, the model only needs a small amount of learning to converge in the finetuning phase. In our tasks, objective alignment and FEL allow a developer to produce the necessary amount of application-specific finetuning examples within hours and to finetune the model within minutes.

In this paper, we use the vanilla BERT architecture and focus our discussion on the independent contribution of objective alignment in improving language model performance. However, to build the most competent small language model, we recommend using objective alignment in combination with knowledge distillation Hinton et al. (2015); Liu et al. (2019a); Jiao et al. (2019), better Transformer architectures Dai et al. (2019); Yang et al. (2019); Lan et al. (2020), better pretraining setup and pretraining data Liu et al. (2019c); Dong et al. (2019); Conneau and Lample (2019); Conneau et al. (2019); Raffel et al. (2019).

3 Methods

3.1 Finetuning Tasks

We carry out our investigation on objective alignment and FEL through concept-of-interest tagging (CT) and acronym detection (AD) tasks. The technical implementations of CT and AD are shown in Figure 2.

Concept-of-interest tagging (CT). The goal of CT is to annotate the start and the end positions of concepts belonging to the categories of interest within a short query text. We define a concept as the shortest contiguous sequence of text that carries a standalone meaning. For example, query “when was the first super mario released” has four concepts “when was”, “the first”, “super mario” and “released”. The concept categories of interest are determined by downstream applications. In this paper, we build a concept tagger to annotate all concepts except for the ones that overlap with the following six types of language features: (1) Five Ws (who, what, when, where, why); (2) Verbs and verb phrases; (3) Prepositions, conjunctions and determiners that are outside of fixed expressions; (4) Comparatives and superlatives; (5) Numbers and IDs; (6) Natural language-type book, song, movie titles. Based on these choices, our tagger should only annotate “super mario” in the example query above.

Acronym detection (AD). The goal of AD is to determine whether a unigram is a valid acronym of any entity present in a text snippet. For example, given snippet “much of world of warcraft’s gameplay involves the completion of quests. these quests are usually available from npcs.”, unigram “wow” is a valid acronym as it matches to “world of warcraft”. But unigrams “tqa” (these quests are) and “woa” are not valid acronyms because they either do not match to an entity or do not match any span of text. AD does not aim to memorize “wow” as the most common acronym for “world of warcraft”, but only whether a unigram could be a valid acronym of an entity.

Figure 2: BERT-like implementation of concept-of-interest tagging (CT) and acronym detection (AD). CT is a token-level 4-class classification task. The four classes are: The start of a concept (S), the end of a concept (E), both start and end (S&E), neither start nor end ((S&E)). CT uses “[CLS] query [SEP]” input format. AD is a sentence-level binary classification task. The two classes are: acronym matches any entity in the snippet (1) and no match (0). AD uses “[CLS] acronym [SEP] snippet [SEP]” input format and the CLS token for the output. “emb layer” and “pred layer” stand for embedding layer and prediction layer respectively.

3.2 Design Aligned Pretraining Objectives

We designed aligned pretraining objectives Wikipedia hyperlink prediction for CT and pseudo acronym detection for AD.

Wikipedia hyperlink prediction. The majority of hyperlink texts on Wikipedia pages are named-entities, common nouns and noun phrases. They contain specialized concept understanding knowledge for performing CT. We extract the hyperlink metadata from the official Wikipedia dump and use the same CT 4-class classification to predict the start and the end of hyperlinks in our pretraining. It is noteworthy that training with Wikipedia hyperlinks does lead to annotations of the six unwanted categories described in Section 3.1. Many book, movie and song titles are natural language-like, starting with five Ws and containing verbs etc. Many product names and events contain numbers and IDs. We also found that, MLM alone can provide good concept understanding to the model, making the Wikipedia hyperlink prediction task partially redundant, we will provide more discussion on this in Section 5.1.

Pseudo acronym detection. To perform AD, the language model needs to understand both concepts and spelling. While MLM and Wikipedia hyperlink prediction inject concept understanding knowledge into the model, we use pseudo acronym detection task along with subword regularization Kudo (2018b)

to teach the model spelling. Pseudo acronym detection is a binary classification task like AD, and we generate its training data in the following steps: (1) From a chunk of Wikipedia text, we take a random contiguous span of 2 to 6 unigrams. We concatenate their initials as a positive example; (2) For the same chunk of text we generate a negative example using one of two methods with equal probabilities - randomly mutating one to all of the letters in the positive unigram or taking the positive unigram belonging to another random chunk of text; (3) We make sure there is no accidental match for the negative examples.

3.3 Pretraining

Our pretraining dataset is composed of a filtered Wikipedia corpus (about 70% English, 30% non-English) and a set of internally collected web documents (about 50% English, 50% non-English). We created the model vocabulary from our web document corpus using the unigram language model algorithm in the sentencepiece library Kudo (2018a). Our vocabulary covers 111K unique tokens and about 6000 unique characters. The filtered Wikipedia corpus tokenizes to 4.4 billion tokens and the web document corpus tokenizes to 1.6 billion tokens.

We used four pretraining objectives: (1) MLM; (2) NSP; (3) Wikipedia hyperlink prediction and (4) Pseudo acronym detection. MLM and NSP are directly taken from the BERT paper Devlin et al. (2019), but instead of masking tokens with equal probabilities, we mask rarer tokens with higher probabilities Conneau and Lample (2019). MLM and NSP labels are generated randomly on-the-fly and they are applied to both corpuses. Wikipedia hyperlink prediction and pseudo acronym detection labels are pre-generated across the Wikipedia corpus only. Subword regularization is applied to the web document corpus only to make pseudo acronym detection more challenging.

We trained a set of eleven language models that have the same architecture as BERT but differ in dimensions. Nine of them have sizes 256, 512, 768 embedding dimensions by 1, 2, 3 Transformer layers. The last two are both 768 by 3 models, one pretrained without Wikipedia hyperlink prediction, one pretrained without pseudo acronym detection. All models have 64-dimension Transformer heads and 3072 hidden dimensions. We use learning rate 0.0001 with Adam optimizer, dropout 0.1, batch size 256 and maximum sequence length 128. We train each model for 500 million examples, which is 10 epochs of the Wikipedia corpus (our web documents have shorter sequence lengths and higher examples to total token ratio). It takes two weeks to pretrain a 768 by 3 model on four Tesla P40 GPUs. Our model training code was forked from the XLM code base

Conneau and Lample (2019).

3.4 Finetuning

The CT dataset contains 475 manually labeled English queries and 2199 token-level labels with label distribution 16% S, 16% E, 9% S&E, 59% (S&E) (Figure 2). The 475 examples further split into a 275 example subset and a 200 example subset. The two subsets do not share any non-stopword unigrams. The AD dataset contains 1200 manually labeled English acronym-snippet pairs with label distribution 50% 0 and 50% 1. We created this dataset by taking 600 unique snippets each containing at least one unique named-entity with a known acronym. The known acronyms are the positive examples. We create one negative example for each snippet using one of the two methods with equal probabilities - generating a pseudo acronym detection positive example or randomly mutating one or more letters in the positive acronym unigram. We made sure that the acronym unigrams never appear in the snippet and there is no accidental false negatives in the negative examples.

For each data point presented in Section 4

, we perform 5-fold cross validation with two random seeds each - a total of ten finetuning calculations. In the case of CT, instead of the standard 5-fold cross validation, we do five random samples from the 275 example subset to form the training sets and use the 200 example subset as the testset. By default, we use batch size 64, dropout 0.1, learning rate 0.0001, finetuning data size 200 and backpropagate only through the prediction layers. We also discuss the effects of different finetuning parameters in Section

4. Finetuning calculations typically finish within fifteen minutes on one Tesla P40 GPU.

1 2 3 3*
CT 256 77.80.5 / 1.750.01 80.00.7 / 1.700.04 81.90.6 / 1.580.01 79.60.7 / 1.700.04
512 77.20.8 / 1.780.03 82.10.5 / 1.560.01 82.50.6 / 1.550.04 81.50.4 / 1.620.02
768 79.00.7 / 1.710.01 83.70.3 / 1.530.01 83.90.3 / 1.500.01 82.40.8 / 1.580.02
768- / / / 79.10.9 / 1.760.06
AD 256 56.90.6 / 1.980.01 61.60.3 / 1.920.02 65.31.0 / 1.860.02 65.40.9 / 1.860.02
512 57.60.8 / 1.970.01 66.40.5 / 1.870.02 70.21.5 / 1.790.03 70.21.6 / 1.790.03
768 59.80.8 / 1.990.03 70.71.7 / 1.810.05 73.80.8 / 1.790.04 73.80.5 / 1.800.04
768- / / / 63.91.3 / 1.960.05
Table 1: CT and AD accuracy/perplexity by model size. Model accuracy and perplexity improve as model size increases. The boldface models statistically significantly outperform model 768-3*, which is pretrained without objective alignment (underlined). Models in row CT, 768- are pretrained without Wikipedia hyperlink prediction. Models in row AD, 768- are pretrained without pseudo acronym detection. Models in column 3* are finetuned after first discarding the prediction layers.

768-3* 5123* 7683* 7683
CT 50 72.42.1 / 2.050.10 76.41.1 / 1.840.05 77.71.4 / 1.780.03 82.00.5 / 1.590.02
100 76.51.3 / 1.880.11 79.11.0 / 1.740.06 80.30.9 / 1.650.02 83.70.7 / 1.520.01
150 77.91.0 / 1.810.10 80.40.8 / 1.690.07 81.80.5 / 1.600.02 83.70.7 / 1.510.01
200 79.10.9 / 1.760.06 81.50.4 / 1.620.02 82.40.8 / 1.580.02 83.90.3 / 1.500.01
AD 50 58.71.8 / 2.000.05 64.30.6 / 1.910.04 65.21.4 / 1.970.08 65.01.6 / 1.980.05
100 61.00.6 / 1.990.05 66.31.0 / 1.870.03 70.30.6 / 1.920.06 70.10.8 / 1.890.06
150 62.41.8 / 1.970.07 68.61.7 / 1.830.03 72.50.5 / 1.870.04 72.30.7 / 1.830.03
200 63.91.3 / 1.960.05 70.21.6 / 1.790.03 73.80.5 / 1.800.04 73.80.8 / 1.790.04
1000 72.92.5 / 1.780.05 77.23.1 / 1.670.06 84.71.3 / 1.490.04 85.51.4 / 1.470.03
Table 2: CT and AD accuracy/perplexity by finetuning data size. Model accuracy and perplexity improve as finetuning data size increases from 50 to 1000. The boldface models statistically significantly outperform model 768-3*, which is finetuned using 200 examples (underlined). Symbols “-” and “*” carry the same meanings as in Table 1.

4 Results

We evaluate the accuracy and perplexity of CT and AD tasks across the eleven language models with different finetuning parameters. All values are averaged over ten finetuning calculations (Section 3.4

), and we provide the one standard deviation values in Tables

1, 2 and 4. We use the standard accuracy and perplexity calculation formulas, the exact computation methods can be found in the XLM code base Conneau and Lample (2019). Accuracy, i.e. precision without thresholding, is the determining metric for our NLU applications, but we also use perplexity to gauge the overall quality of our models.

4.1 Case Studies

WHP: [when was [the first [super mario] released]
 CT:  when was  the first [super mario] released

WHP: [skyrim] [100% completion]
 CT: [skyrim]  100% completion

Wikipedia hyperlink prediction (WHP) and CT lead to different outcomes of query tagging. We use symbols “[” and “]” to denote the predicted concept boundaries by the model. Concepts containing five Ws (“when”), verbs (“was”, “released”) and numbers (“first”, “100%”) are not annotated in CT. Note that Wikipedia hyperlink prediction leads to nested annotations even though hyperlinks are non-overlapping. This is because the classification loss of a token is conditioned independently of the classes of their context tokens.

SNIPPET: much of world of warcraft’s gameplay involves the completion of quests. these quests are usually available from npcs. ACRONYMS: wow: PAD score = 0.80, AD score = 0.71 tqa: PAD score = 0.95, AD score = 0.34 woa: PAD score = 0.09, AD score = 0.18

Pseudo acronym detection (PAD) gives “wow” and “tqa” positive labels (score0.5), while AD only gives “wow” a positive label. This is because “wow” is the only unigram that matches to an entity. The model scores are the softmax probabilities of the positive class. All examples above are generated by one of the finetuned 768 by 3 models.

4.2 Objective Alignment and Model Size

Since the models pretrained without Wikipedia hyperlink prediction and pseudo acronym detection (denoted by “-”) do not have pre-minimized prediction layers for CT and AD, we discard the prediction layers of the pretrained models for fair comparisons (denoted by “*”). Table 1 shows that smaller language models pretrained with objective alignment can outperform bigger language models pretrained without objective alignment. Model 7683* achieves +3.3% accuracy in CT and +9.9% accuracy in AD compared to model 768-3* of the same size. When comparing across model sizes, the smallest models that statistically significantly outperform model 768-3* are model 5123* and model 2563* for CT (+1.4%) and AD (+1.5%) respectively.

Keeping the pre-minimized prediction layers of the objective aligned models further improves the accuracy of the finetuning results of CT but has little impacts on AD. On the other hand, AD gets bigger accuracy boost than CT from both objective alignment and model size increasement. This is most likely because of the standard language model tokenization algorithm we used. The algorithm tokenizes words into the longest most probable subwords Wu et al. (2016); Kudo (2018b) and as a result, the model does not know the letter-by-letter spelling of a word explicitly. This makes AD a more challenging task for the language models we trained.

As expected, the best performing model of both CT and AD tasks is the largest model we trained, model 7683. In terms of the embedding dimension, CT accuracy increased 2.0% and AD accuracy increased 8.5% from model 2563 to model 7683. In terms of the number of Transformer layers, CT accuracy increased 4.9% and AD accuracy increased 14.0% from model 7681 to model 7683. Model 2563 significantly outperforms model 7681, which shows, for the vanilla Transformer architecture, at least two Transformer layers are recommended to learn tasks of moderate complexity.

4.3 FEL and Training Data Size

Table 2 shows that objective alignment reduces the amount of finetuning examples required to reach a targeted accuracy, and good objective alignment can reduce the minimum number of finetuning examples required to the order of hundreds. For example, for the AD task, model 7683* can reach accuracy of 72.5% using 150 finetuning examples while model 768-3* requires 1000 examples to reach the same accuracy.

The accuracy of model 7683 improves the most from using 50 examples to 100 examples for both CT and AD. CT accuracy stops improving after 100 examples, while AD accuracy keeps improving linearly from 100 to 1000 examples. This again shows that AD is a more challenging task and requires more examples to learn. Table 2 also shows that the observations made in Section 4.2 hold across all FEL training data sizes - the accuracy of model 7683 model 7683* model 5123* model 768-3*.

4.4 FEL Training Parameters

The Transformer language models we use here are composed of the embedding layer, the Transformer layers and the prediction layers (Figure 2). We perform finetuning by backpropagating through (1) only the prediction layers, (2) the prediction and the Transformer layers, and (3) all of the layers (Table 3).

When backpropagating through only the prediction layers, the model reaches the best accuracy and perplexity at the same time. But when we extend the backpropagation to the other layers, the model reaches the best perplexity first, then reaches the best accuracy while perplexity continues to increase. We see this as a sign of overfitting - the accuracy of a portion of the testset examples increases while the accuracy of the rest of the testset worsens. Even though accuracy is generally the determining metric for our applications, we pick the model with the best perplexity given that the corresponding accuracy is acceptable. CT-AD multitasking while backpropagating through the prediction and transformer layers achieves the best accuracy and perplexity for both tasks, showing that multitasking significantly benefits FEL in its low-resource regime. Despite this, we choose to backpropagate only through the prediction layers as our best practice, because it best prevents overfitting.

We also experimented with the choice of learning rate for FEL (Table 4). We found that when backpropagating through the prediction layers only, the performance of CT and AD tasks are not very sensitive to learning rates in the range of 0.001 and 0.00001. AD shows accuracy loss and perplexity gain as learning rate increases but no significant combined difference. We speculate that the loss functions for CT and AD are smooth near their minima or that they have multiple equally good closely spaced local minima. We chose a learning rate of 0.0001 for the other FEL calculations in this paper, as it provides the best combination of performance and training time.

backpropagation acc/best-ppl best-acc/ppl
CT pred 83.8 / 1.50 83.9 / 1.50
mt pred+trm 84.8 / 1.47 86.0 / 1.75
pred+trm 85.0 / 1.47 85.9 / 1.63
pred+trm+emb 84.8 / 1.48 85.9 / 1.67
AD pred 72.3 / 1.75 73.8 / 1.79
mt pred+trm 74.2 / 1.69 84.8 / 2.38
pred+trm 73.8 / 1.70 83.8 / 2.65
pred+trm+emb 73.3 / 1.71 83.9 / 2.63
Table 3: FEL backpropagation scheme. Backpropagating through both prediction (PRED) and Transformer (TRM) layers while multitasking (MT) achieves the best accuracy/perplexity combination. The best-accuracy models are overfitted when backpropagating through the Transformer and embedding (EMB) layers. We recommend selecting models using perplexity. Results are generated using model 7683.

acc/ppl epochs
CT 0.001 83.7 / 1.53 4.61.6
0.0001 83.9 / 1.50 33.16.9
0.00001 83.8 / 1.50 291.440.4
AD 0.001 74.8 / 2.01 84.417.9
0.0001 73.8 / 1.79 156.233.3
0.00001 71.7 / 1.76 903.5128.4
Table 4: FEL learning rate. Learning rate does not have a significant impact on the finetuning accuracy and perplexity of CT and AD. Smaller learning rates require more epochs of training. Results are generated using model 7683.

7683* CT 768-3* AD 768-3*
CT 82.4 / 1.58 79.1 /1.76 80.6 / 1.65
AD 73.8 / 1.80 73.9 / 1.72 63.9 / 1.96
Table 5: Objective alignment vs. objective diversity. Pseudo acronym detection provides the language model more unique information than Wikipedia hyperlink prediction. It not only significantly improves the AD accuracy, but also improves the CT accuracy by more than 1%. Symbol “-” carries the same meaning as in Table 1.

7683 CT 768-3 AD 768-3
MLM 52.4 / 14.1 52.6 / 14.0 52.8 / 13.5
NSP 99.1 / 1.02 99.1 / 1.02 99.2 / 1.02
Table 6: MLM and NSP accuracy/perplexity. The MLM and NSP accuracy and perplexity remain the same with and without the aligned pretraining objectives. Symbol “-” carries the same meaning as in Table 1.

5 Discussion

5.1 Pretraining Objective Diversity

In Table 1, model 7683* outperforms model 768-3* by +3.3% accuracy in CT and +9.9% accuracy in AD. The improvement of the CT task from objective alignment is 3 times less than that of the AD task. We think this is because that MLM and Wikipedia hyperlink prediction are intrinsically similar. The model has acquired most of the knowledge needed to perform CT from MLM and Wikipedia hyperlink prediction does not add significant amount of new information. Unlike Wikipedia hyperlink prediction, pseudo acronym detection resembles neither MLM nor NSP. It teaches unique new knowledge to the model that is necessary to perform AD. Additionally, in Table 5, model CT 768-3* pretrained without Wikipedia hyperlink prediction gives the same AD accuracy as model 7683* pretrained with all four pretraining objectives. Model AD 768-3* pretrained without pseudo acronym detection instead reaches 1.8% less CT accuracy compared to model 7683*. This means, Wikipedia hyperlink prediction and pseudo acronym detection are approximately responsible for 1.5% and 1.8% of the 3.3% CT accuracy improvement. On the other hand, pseudo acronym detection is responsible for the entire 9.9% of the accuracy improvement for AD. These results show that pseudo acronym detection not only helps the model perform AD better but also has the potential to benefit other tasks that are seemingly less related. In future works, we plan to build a more universal language model by designing more diverse pretraining objectives to align better with a broader range of finetuning tasks.

5.2 Low-Resource Tasks vs. High-Resource Tasks

Table 6 shows that our added pretraining objectives do not lead to significant variations of the accuracy and perplexity of MLM and NSP. Not surprisingly, while objective alignment and objective diversity could improve the performance of low-resource tasks, their effects on high-resource tasks are minimal. Models 768-3 (CT) and 768-3 (AD) show slightly better accuracy and perplexity than model 7683. This is mostly likely because that we pretrain all models for 500 million examples regardless of the choice of pretraining tasks. When training without Wikipedia hyperlink prediction or pseudo acronym detection, the model effectively see more MLM and NSP examples.

5.3 The Limits of FEL

Objective alignment is a technique that applies to all finetuning tasks, but the same cannot be said for FEL. We apply FEL to CT and AD because they only require the understanding of a few rules that are made of the fundamental properties of a language - concept-boundary, part of speech and spelling. We show that these small numbers of rules can be explained by just a few examples. In fact, AD is pushing the limit of “developer-affordable” FEL. Even though model 7683 can reach a reasonable AD accuracy using 200 finetuning examples, for the best performance, 1000 examples or more are recommended, which is still a very affordable size when hiring human judges. FEL does not apply to tasks that require heavy memorization. For example, a task to tag only the names of celebrities or a task to predict the likelihood of a unigram being the official acronym of a named-entity.

6 Conclusion

We developed the language model training techniques objective alignment and FEL to tackle two challenges in building NLU applications: (1) Speeding up language model inference and (2) Shortage of finetuning data for application-specific tasks. We produced a high-accuracy concept-of-interest tagger and a medium-accuracy acronym detector using our techniques. Both models have dimension 768 by 3 and were trained with 200 finetuning examples each. This small model size meets our real-time inference latency requirements, and the small finetuning dataset can be generated by the developers themselves or a few human judges. Overall, our language model training solution greatly improves the efficiency and agility of our NLU application development cycles.


  • A. Conneau, K. Khandelwal, N. Goyal, V. Chaudhary, G. Wenzek, F. Guzmán, E. Grave, M. Ott, L. Zettlemoyer, and V. Stoyanov (2019) Unsupervised Cross-lingual Representation Learning at Scale. arXiv preprint arXiv:1911.02116. Cited by: §1, §2.
  • A. Conneau and G. Lample (2019) Cross-lingual Language Model Pretraining. In Advances in Neural Information Processing Systems 32, pp. 7057–7067. Cited by: §1, §1, §2, §3.3, §3.3, §4.
  • Z. Dai, Z. Yang, Y. Yang, J. Carbonell, Q. V. Le, and R. Salakhutdinov (2019) Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context. arXiv preprint arXiv:1901.02860. Cited by: §2.
  • J. Devlin, M. Chang, K. Lee, and K. Toutanova (2019) BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In Proc. of NAACL, Cited by: §1, §2, §3.3.
  • L. Dong, N. Yang, W. Wang, F. Wei, X. Liu, Y. Wang, J. Gao, M. Zhou, and H. Hon (2019) Unified Language Model Pre-training for Natural Language Understanding and Generation. In Advances in Neural Information Processing Systems 32, pp. 13042–13054. Cited by: §1, §2.
  • G. Hinton, O. Vinyals, and J. Dean (2015) Distilling the Knowledge in a Neural Network. In NIPS Deep Learning and Representation Learning Workshop, Cited by: §2.
  • X. Jiao, Y. Yin, L. Shang, X. Jiang, X. Chen, L. Li, F. Wang, and Q. Liu (2019) TinyBERT: Distilling BERT for Natural Language Understanding. arXiv preprint arXiv:1909.10351. Cited by: §1, §2.
  • M. Junczys-Dowmunt, R. Grundkiewicz, T. Dwojak, H. Hoang, K. Heafield, T. Neckermann, F. Seide, U. Germann, A. F. Aji, N. Bogoychev, A. F. T. Martins, and A. Birch (2018)

    Marian: Fast Neural Machine Translation in C++

    In Proceedings of ACL 2018, System Demonstrations, pp. 116–121. Cited by: §1.
  • T. Kudo (2018a) sentencepiece. Note: July 2019 Cited by: §3.3.
  • T. Kudo (2018b) Subword Regularization: Improving Neural Network Translation Models with Multiple Subword Candidates. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, pp. 66–75. Cited by: §3.2, §4.2.
  • Z. Lan, M. Chen, S. Goodman, K. Gimpel, P. Sharma, and R. Soricut (2020)

    ALBERT: A Lite BERT for Self-supervised Learning of Language Representations

    In International Conference on Learning Representations, Cited by: §1, §2.
  • Y. Lin, S. Yang, V. Stoyanov, and H. Ji (2018) A Multi-lingual Multi-task Architecture for Low-resource Sequence Labeling. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 799–809. Cited by: §1.
  • X. Liu, P. He, W. Chen, and J. Gao (2019a) Improving Multi-Task Deep Neural Networks via Knowledge Distillation for Natural Language Understanding. arXiv preprint arXiv:1904.09482. Cited by: §2.
  • X. Liu, P. He, W. Chen, and J. Gao (2019b) Multi-Task Deep Neural Networks for Natural Language Understanding. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 4487–4496. Cited by: §1.
  • Y. Liu, M. Ott, N. Goyal, J. Du, M. Joshi, D. Chen, O. Levy, M. Lewis, L. Zettlemoyer, and V. Stoyanov (2019c) RoBERTa: A Robustly Optimized BERT Pretraining Approach. arXiv preprint arXiv:1907.11692. Cited by: §1, §2.
  • M. E. Peters, M. Neumann, M. Iyyer, M. Gardner, C. Clark, K. Lee, and L. Zettlemoyer (2018) Deep Contextualized Word Representations. In Proc. of NAACL, Cited by: §1.
  • A. Radford, K. Narasimhan, T. Salimans, and I. Sutskever (2018) Improving Language Understanding by Generative Pre-Training. Technical report OpenAI. Cited by: §1.
  • A. Radford, J. Wu, R. Child, D. Luan, D. Amodei, and I. Sutskever (2019) Language Models are Unsupervised Multitask Learners. Technical report OpenAI. Cited by: §1, §2.
  • C. Raffel, N. Shazeer, A. Roberts, K. Lee, S. Narang, M. Matena, Y. Zhou, W. Li, and P. J. Liu (2019) Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer. arXiv preprint arXiv:1910.10683. Cited by: §1, §2.
  • P. Rajpurkar, J. Zhang, K. Lopyrev, and P. Liang (2016) SQuAD: 100,000+ Questions for Machine Comprehension of Text. In

    Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing

    pp. 2383–2392. Cited by: §1.
  • Y. Sun, S. Wang, Y. Li, S. Feng, H. Tian, H. Wu, and H. Wang (2020) ERNIE 2.0: A Continual Pre-training Framework for Language Understanding. AAAI. Cited by: §1.
  • A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin (2017) Attention is All You Need. In Advances in Neural Information Processing Systems 30, pp. 5998–6008. Cited by: §1.
  • A. Wang, A. Singh, J. Michael, F. Hill, O. Levy, and S. R. Bowman (2019) GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding. In ICLR, Cited by: §1.
  • Y. Wu, M. Schuster, Z. Chen, Q. V. Le, M. Norouzi, W. Macherey, M. Krikun, Y. Cao, Q. Gao, K. Macherey, J. Klingner, A. Shah, M. Johnson, X. Liu, Ł. Kaiser, S. Gouws, Y. Kato, T. Kudo, H. Kazawa, K. Stevens, G. Kurian, N. Patil, W. Wang, C. Young, J. Smith, J. Riesa, A. Rudnick, O. Vinyals, G. Corrado, M. Hughes, and J. Dean (2016) Google’s Neural Machine Translation System: Bridging the Gap Between Human and Machine Translation. arXiv preprint arXiv:1609.08144. Cited by: §4.2.
  • Z. Yang, Z. Dai, Y. Yang, J. Carbonell, R. R. Salakhutdinov, and Q. V. Le (2019) XLNet: Generalized Autoregressive Pretraining for Language Understanding. In Advances in Neural Information Processing Systems 32, pp. 5754–5764. Cited by: §1, §2.
  • M. Zhang, S. Rajbhandari, W. Wang, and Y. He (2018) DeepCPU: Serving RNN-based Deep Learning Models 10x Faster. In USENIX ATC 18, pp. 951–965. Cited by: §1.