Pretrained masked language models (MLMs) require finetuning for most NLP tasks. Instead, we evaluate MLMs out of the box via their pseudo-log-likelihood scores (PLLs), which are computed by masking tokens one by one. We show that PLLs outperform scores from autoregressive language models like GPT-2 in a variety of tasks. By rescoring ASR and NMT hypotheses, RoBERTa reduces an end-to-end LibriSpeech model's WER by 30% relative and adds up to +1.7 BLEU on state-of-the-art baselines for low-resource translation pairs, with further gains from domain adaptation. We attribute this success to PLL's unsupervised expression of linguistic acceptability without a left-to-right bias, greatly improving on scores from GPT-2 (+10 points on island effects, NPI licensing in BLiMP). One can finetune MLMs to give scores without masking, enabling computation in a single inference pass. In all, PLLs and their associated pseudo-perplexities (PP-PLs) enable plug-and-play use of the growing number of pretrained MLMs; e.g., we use a single cross-lingual model to rescore translations in multiple languages. We release our library for language model scoring at https: //github.com/awslabs/mlm-scoring . BERT (Devlin et al., 2019) and its improvements to natural language understanding have spurred a rapid succession of contextual language representations (Yang et al., 2019; Liu et al., 2019; inter alia ) which use larger datasets and more involved training schemes. Their success is attributed to their use of bidirectional context, often via their masked language model (MLM) objectives. Here, a token w t is replaced with [MASK] and predicted using all past and future tokens W \ t := ( w 1 , . . . , w t  1 , w t +1 , . . . , w | W | ) . In contrast, conventional language models (LMs) predict w t using only past tokens W <t := ( w 1 , . . . , w t  1 ) . However, this allows LMs to estimate log probabilities for a sentence W via the chain rule ( log PLM ( W ) = (cid:80) | W | t =1 log PLM ( w t | W <t ) ), which can be used out of the box to rescore hypotheses in end-to-end speech recognition and machine translation (Chan et al., 2016; Gulcehre et al., 2015), and to evaluate sentences for linguistic acceptability (Lau et al., 2017). Our work studies the corresponding pseudo-log-likelihood scores (PLLs) from MLMs (Wang and Cho, 2019), given by summing the conditional log probabilities log PMLM ( w t | W \ t ) of each sentence token (Shin et al., 2019). These are induced in BERT by replacing w t with [MASK] (Figure 1). PLLs and their corresponding pseudo-perplexities (PPPLs) (Section 2.3) are intrinsic values one can assign to sentences and corpora, allowing us to use MLMs in applications previously restricted to conventional LM scores. Furthermore, we show that one can finetune BERT to compute PLLs in a single, non-recurrent inference pass (Section 2.2). Existing uses of pretrained MLMs in sequence-to-sequence models for automatic speech recognition (ASR) or neural machine translation (NMT) involve integrating their weights (Clinchant et al., 2019) or representations (Zhu et al., 2020) into the encoder and/or decoder during training. In contrast, we train a sequence model independently, then rescore its n -best outputs with an existing MLM. For acceptability judgments, one finetunes MLMs for classification using a training set (Warstadt et al., 2019; Devlin et al., 2019); instead, PLLs give unsupervised, relative judgements directly. In Section 3, we show that scores from BERT compete with or even outperform GPT-2 (Radford et al., 2019), a conventional language model of similar size but trained on more data. Gains scale with dataset and model size: RoBERTa large (Liu et al., 2019) improves an end-to-end ASR model with relative WER reductions of 30%, 18% on LibriSpeech test-clean , test-other respectively (with further gains from domain adaptation), and improves state-of-the-art NMT baselines by up to +1.7 BLEU on low-resource pairs from standard TED Talks corpora. In the multilingual case, we find that the pretrained 15-language XLM (Conneau and Lample, 2019) can concurrently improve NMT systems in different target languages. In Section 4, we analyze PLLs and propose them as a basis for other ranking/scoring schemes. Unlike log probabilities, PLL's summands are more uniform across an utterance's length (no left-to-right bias), helping differentiate fluency from likeliness. We use PLLs to perform unsupervised acceptability judgments on the BLiMP minimal pairs set (Warstadt et al., 2020); BERT and RoBERTa models improve the state of the art (GPT-2 probabilities) by up to 3.9% absolute, with +10% on island effects and NPI licensing phenomena. Hence, PLLs can be used to assess the linguistic competence of MLMs in a supervision-free manner. Bidirectional contextual representations like BERT come at the expense of being true language models PLM ( W ) , as there may appear no way to generate text (sampling) or produce sentence probabilities (density estimation) from these models. This handicapped their use in generative tasks, where they at best served to bootstrap encoder-decoder models (Clinchant et al., 2019; Zhu et al., 2020) or unidirectional LMs (Wang et al., 2019). However, BERT's MLM objective can be viewed as stochastic maximum pseudolikelihood estimation (MPLE) (Wang and Cho, 2019; Besag, 1975) on a training set W , where { w t } | W | t =1 are random variables in a fully-connected graph. This approximates conventional MLE, with MLM training asymptotically maximizing the objective: JPL (; W ) = 1 | W | (cid:88) W  WPLL ( W ; ) . In this way, MLMs learn an underlying joint distribution whose conditional distributions w t | W \ t are modeled by masking at position t . We include a further discussion in Appendix B. This enabled text generation with BERT via Gibbs sampling, leading to the proposal (but not evaluation) of a related quantity, the sum of logits, for sentence ranking (Wang and Cho, 2019). More recent work (Shin et al., 2019) extended past research on future-conditional LMs in ASR (Sec-tion 5) with deeply-bidirectional self-attentive language models (bi-SANLMs). They trained shallow models from scratch with the [MASK] scoring method, but did not relate their work to pseudolikelihood and fluency, which provide a framework to explain their success and observed behaviors. Experimentally, we extend both works by evaluating pretrained models, domain adaptation, and usage in NMT and multilingual settings (Section 3), along with acceptability judgements and PLL's intrinsic numerical properties (Section 4). A practical point unaddressed in both works is that computing PLLs from an MLM requires a sentence copy for each position, making the number of inference passes dependent on length (though these can be parallelized). The cost of a softmax is also incurred, which is dependent on vocabulary size V ; together this gives O ( | W |  V ) . We propose reducing this to O (1) by training a network q with parameters  S to match BERT's PLLs without [MASK] tokens: | PLL ( W )  q ( W ;  S ) | 2 . We propose finetuning q from the pretrained MLM directly (i.e., initializing  S with  ), via regression over the [CLS] token (Figure 2): Figure 2: We learn a linear map after the [CLS] token, supervised by the PLLs from the pretrained MLM. More generally, one could use any student model q , as in knowledge distillation (Hinton et al., 2014). Here, the teacher gives individual token probabilities ( | W | inference passes) while the student approximates their sum (one inference pass). This is reminiscent of distilling an autoregressive teacher to a parallel student, as in the case of WaveNet (Oord et al., 2018). Other [MASK] less bidirectional models like XLNet (Yang et al., 2019) can also give PLLs; we leave this to future work. Analogous to conventional LMs, we propose the pseudo-perplexity (PPPL) of an MLM as an intrinsic measure of how well it models a corpus of sentences W . Let N denote the number of tokens in the corpus. Then a model's PPPL on W is PPPL ( W ) := exp (cid:32)  1 N (cid:88) W  WPLL ( W ) (cid:33) . Past work (Chen et al., 2017) also computed this quantity with bi-RNNLMs for ASR, although such models are not deeply bidirectional like self-attentive MLMs (see Section 5). These PPPLs can be used in lieu of perplexities. can perform early stopping with respect to development PPPL. This is in contrast to MLM accuracy, which is not a continuous loss and is often stochastic (e.g., when performing dynamic masking as in RoBERTa). In Section 4.1, we see that PPPLs naturally separate out sets of acceptable and unacceptable sentences. Unlike previous works (Chen et al., 2017; Shin et al., 2019) we use pretrained BERTs, which are open-vocabulary (subword) bidirectional LMs. However, PPPLs are only comparable under the same subword vocabulary, which differs between e.g., BERT and RoBERTa. Normalizing with N as the number of words mitigates this. In Appendix C, we show that word-normalized PPPLs correlate with domain adaptation, and with downstream metrics like ASR and BLEU after rescoring. Let X denote audio features or source text tokens, and let W = ( w 1 , . . . , w | W | ) denote target text tokens. For non-end-to-end ASR and MT systems, having separate acoustic/translation models PAM / TM ( X | W ) and language models PLM ( W ) is motivated by the Bayes rule decomposition used to select the best hypothesis  W (Jelinek et al., 1975; Brown et al., 1993):  W = arg max W [ P ( W | X )] = arg max W [ PAM / TM ( X | W ) PLM ( W )] . End-to-end ASR and NMT use encoder-decoder architectures that are trained discriminatively. Though less principled, many still adopt a log-linear model  W = arg max W [log P ( W | X )]  arg max W [log f ( W , X ) +  log g ( W )] with learned functions f, g and a hyperparameter  , to good effect (Sutskever et al., 2014; Chan et al., 2016). One often takes f = P S2S ( W | X ) as the sequence-to-sequence model and g = PLM ( W ) as the language model. Since the sequence-level arg max is intractable, one can do fusion , which decomposes f = (cid:81) f t and g = (cid:81) g t over time (Gul-cehre et al., 2015), restricting to the top N intermediate candidates at each step (beam search). Instead, our work considers N -best rescoring , which computes f ( W , X ) first, still using beam search to maintain the top N candidates and scores. Then, g ( W ) is computed for the resulting hypotheses and interpolated with these scores, giving a new top-1 hypothesis. The sequence model is now solely responsible for capturing the best hypothesis  W in its beam. However, there are two advantages to N -best rescoring, which motivate PLLs as well as our maskless finetuning approach, respectively: Decoupling of scale. Fusion requires correspondence between f t and g t at every t . This requires the sequence model and LM to be autoregressive and share tokenizations. In rescoring, f = P S2S does not require g to decompose over time or to be a true probability at all, though g should scale with f so that  remains valid for all lengths | W | ; e.g., taking g ( W ) to be a relevance score between 0 and 1 would not satisfy this property. The choice of log-linear is relevant here (Appendix B). Length-independent inference. If g is nonrecurrent, then g ( W ) may be computed in a single inference pass. This difference manifests with self-attentive LMs like SANLMs and Transformer-XL (Dai et al., 2019), as recently explored for N -best rescoring in ASR (Li et al., 2019; Shin et al., 2019). Further implementation and experimental details can be found in Appendix A and our code release: LMs. We rescore sequence-to-sequence hypotheses as in Section 3.1. Each hypothesis is assigned its log probability (uni-SANLM, GPT-2) or pseudo-log-likelihood score (bi-SANLM, BERT, M-BERT, RoBERTa, XLM). We tune the LM weight  on the development set to minimize word error rate (WER) for ASR or maximize tokenized BLEU for NMT. We then evaluate on the test set. ASR. Our 100-best hypotheses are from an end-to-end, 5-layer BLSTMP model (Shin et al., 2019) from ESPnet (Watanabe et al., 2018) on the 960-hour LibriSpeech corpus (Panayotov et al., 2015). Though this baseline is not state-of-the-art, we use their lists to enable direct comparison in Table 5. NMT. Our 100-best hypotheses are from strong Transformer baselines with BPE subwords. One was pretrained for WMT 2014 English-German (Vaswani et al., 2017); the others are state-of-the-art low-resource models we trained for five pairs from the TED Talks corpus (Qi et al., 2018) and for IWSLT 2015 English-Vietnamese (Cettolo et al., 2015), which we also describe in a dedicated, concurrent work (Nguyen and Salazar, 2019). For the low-resource models we scored tokenized hypotheses (though with HTML entities unescaped, e.g., &quot; (cid:55) " ). Length normalization (Wu et al., 2016) is applied to NMT (  = 0 . 6 ) and LM (  = 1 . 0 ) scores (Section 4.3). We consider BERT (Devlin et al., 2019), GPT-2 (Radford et al., 2019), and RoBERTa (Liu et al., 2019), which are trained on 17GB, 40GB, and 160GB of written text respectively. Each model comes in similarly-sized 6-layer (117M / base) and 12-layer (345M / large) versions. GPT-2 is autoregressive, while BERT and RoBERTa are MLMs. We begin by rescoring ASR outputs in Table 2: Model dev test clean other clean other baseline (100-best) 7.17 19.79 7.26 20.37 GPT-2 (117M, cased) 5.39 16.81 5.64 17.60 BERT (base, cased) 5.17 16.44 5.41 17.41 RoBERTa (base, cased) 5.03 16.16 5.25 17.18 GPT-2 (345M, cased) 5.15 16.48 5.30 17.26 BERT (large, cased) 4.96 16.26 5.25 16.97 RoBERTa (large, cased) 4.75 15.81 5.05 16.79 oracle (100-best) 2.85 12.21 2.81 12.85 Table 2: WERs on LibriSpeech after rescoring. As GPT-2 is trained on cased, punctuated data while the ASR model is not, we use cased MLMs and append  .  to hypotheses to compare out-of-the-box performance. BERT outperforms its corresponding GPT-2 models despite being trained on less data. RoBERTa reduces WERs by 30% relative on LibriSpeech test-clean and 18% on test-other . We repeat the same on English-target NMT in Table 3. As 100-best can be worse than 4-best due to the beam search curse (Yang et al., 2018; Murray and Chiang, 2018), we first decode both beam sizes to ensure no systematic degradation in our models. Hypothesis rescoring with BERT (base) gives up to +1.1 BLEU over our strong 100-best baselines, remaining competitive with GPT-2. Using RoBERTa (large) gives up to +1.7 BLEU over the baseline. Incidentally, we have demonstrated conclusive improvements on Transformers via LM rescoring for the first time, despite only using N -best lists; the most recent fusion work (Stahlberg et al., 2018) only used LSTM-based models. We also consider a non-English, higher-resource target by rescoring a pre-existing WMT 2014 English-German system (trained on 4.5M sentence pairs) with German BERT (base) models 1 trained on 16GB of text, similar to English BERT. From 27.3 BLEU we get +0.5, +0.3 from uncased, cased; a diminished but present effect that can be improved as in Table 3 with more pretraining, a larger model, or domain adaptation (Section 3.5). To assess the limits of our modular approach, we ask whether a shared multilingual MLM can improve translation into different target languages. We use the 100+ language M-BERT models, and the 15-language XLM models (Conneau and Lam-ple, 2019) optionally trained with a crosslingual translation LM objective (TLM). Monolingual training was done on Wikipedia, which gives e.g., 6GB of German text; see Table 4. The 100-language M-BERT models gave no consistent improvement. The 15-language XLMs fared better, giving +0.2-0.4 BLEU, perhaps from their use of language tokens and fewer languages. Our 1 https://github.com/dbmdz/german-bert Model IWSLT'15 TED Talks en  vi en  de en  ar Wang et al. (2018) 29.09   Aharoni et al. (2019)  23.31 12.95 our baseline (4-best) 31.94 30.50 13.95 our baseline (100-best) 31.84 30.44 13.94 M-BERT (base, uncased) 32.12 30.48 13.98 M-BERT (base, cased) 32.07 30.45 13.94 XLM (base*, uncased) 32.27 30.61 14.13 + TLM objective 32.26 30.62 14.10 de-BERT (base, uncased)  31.27  de-BERT (base, cased)  31.22  Table 4: Test BLEU scores for language pairs with non-English targets, after hypothesis rescoring. German BERT results suggest an out-of-the-box upper bound of +0.8 BLEU, as we found with English BERT on similar resources. We expect that increasing training data and model size will boost XLM performance, as in Section 3.3. Out-of-the-box rescoring may be hindered by how closely our models match the downstream text. For example, our uncased multilingual models strip accents, exacerbating their domain mismatch with the cased, accented gold translation. We examine this effect in the setting of LibriSpeech, which has its own 4GB text corpus and is fully uncased and unpunctuated, unlike the cased MLMs in Section 3.3. We rescore using in-domain models in Table 5: Model dev test clean other clean other baseline (100-best) 7.17 19.79 7.26 20.37 uni-SANLM 6.08 17.32 6.11 18.13 bi-SANLM 5.52 16.61 5.65 17.44 BERT (base, Libri. only) 4.63 15.56 4.79 16.50 BERT (base, cased) 5.17 16.44 5.41 17.41 BERT (base, uncased) 5.02 16.07 5.14 16.97 + adaptation, 380k steps 4.37 15.17 4.58 15.96 oracle (100-best) 2.85 12.21 2.81 12.85 Table 5: WERs on LibriSpeech after hypothesis rescoring. Using a BERT model trained only on the text corpus outperforms RoBERTa (Table 2) which is trained on far more data, underscoring the tradeoff between in-domain modeling and out-of-the-box integration. Even minor differences like casing gives +0.3-0.4 WER at test time. In Section 4.3 we see that these domain shifts can be visibly observed from the positionwise scores log PMLM ( w t | W \ t ) . The best results (adaptation) still come from adapting a pretrained model to the target corpus. We proceed as in BERT, i.e., performing MLM on sequences of concatenated sentences (more details in Appendix A). In contrast, the 3-layer SANLMs (Shin et al., 2019) do per-utterance training, which is slower but may reduce mismatch even further. Finally, we show in Appendix C that even before evaluating WER or BLEU, one can anticipate improvements in the downstream metric by looking at improvements in word-normalized PPPL on the target corpus. The domain-adapted MLM has lower PPPLs than the pretrained models, and RoBERTa has lower PPPLs than BERT. We finetune BERT to produce scores without [MASK] tokens. For LibriSpeech we take the normalized text corpus and keep sentences with length | W |  384, score them with our adapted BERT (base), then do sentence-level regression (Section 2.2). We train using Adam with a learning rate of 10  5 for 10 epochs (Table 6): Model dev clean other baseline (100-best) 7.17 19.79 GPT-2 (117M, cased) 5.39 16.81 BERT (base, uncased, adapted) 4.37 15.17 + no masking 5.79 18.07 + sentence-level finetuning 4.61 15.53 Table 6: WERs on LibriSpeech upon rescoring, showing the effects of single-copy, maskless scoring. Sentence-level finetuning degrades performance by +0.2-0.4 WER, leaving room for future improvement. This still outperforms GPT-2 (117M, cased), though this gap may be closed by adaptation. For now, maskless finetuning could be reserved for cases where only a masked language model is available, or when latency is essential. Remarkably, we found that out-of-the-box scoring without [MASK] still significantly improves the baseline. This is likely from the 20% of the time BERT does not train on [MASK] , but instead inputs a random word or the same word (Devlin et al., 2019). Future work could explore finetuning to positionwise distributions, as in word-level knowledge distillation (Kim and Rush, 2016), for which our results are a nave performance bound. Although end-to-end models f = P S2S ( W | X ) predict W directly from X , interpolation with the unconditional g = PLM ( W ) remains helpful (Toshniwal et al., 2018). One explanation comes from cold and simple fusion (Sriram et al., 2018; Stahlberg et al., 2018), which further improve on shallow fusion (Section 3.1) by learning g ( W ) first. They argue g expresses fluency ; fixing g early allows f ( W , X ) to focus its capacity on adequacy in encoding the source, and thus specializing the two models. With this perspective in mind, we compare log PLM and PLL as candidates for log g . In this work we interpret fluency as linguistic acceptability (Chomsky, 1957); informally, the syntactic and semantic validity of a sentence according to human judgments (Schutze, 1996). Its graded form is well-proxied by neural language model scores ( log PLM ) once length and lexical frequency are accounted for (Lau et al., 2017). This can be seen in a controlled setting using minimal pairs and GPT-2 (345M) scores: Raymond is selling this sketch. This example is from the Benchmark of Linguistic Minimal Pairs (BLiMP) (Warstadt et al., 2020), a challenge set of 67k pairs which isolate contrasts in syntax, morphology, and semantics (in this example, determiner-noun agreement). While its predecessor, the Corpus of Linguistic Acceptability (CoLA), has a training set and asks to label sentences as acceptable or not in isolation (Warstadt et al., 2019), BLiMP provides an unsupervised setting: language models are evaluated on how often they give the acceptable sentence a higher (i.e., less negative) score. This is equivalent to 2-best rescoring without sequence model scores ( log f = 0 ). Since most minimal pairs only differ by a single word, the effect of length on log probabilities and PLLs (discussed in Section 4.3) is mitigated. We compute PLLs on the sentences of each pair using cased BERT and RoBERTa, then choose the sentence with the highest score. Our results are in Table 7. Despite using less than half the data and a Model (cased) O v e r a ll AN A . third of the capacity, BERT (base) already outperforms the previous state of the art (GPT-2) by 1.6% absolute, increasing to 3.9% with RoBERTa (large). There are 4 of 12 categories where all four PLLs outperform log probabilities by  1% absolute (val-ues marked by *), and 7 where three or more PLLs outperform by this margin. Interestingly, PLLs do consistently worse on quantifiers, though all are relatively bad against the human baseline. The ratio of token-level PPPLs between unacceptable and acceptable sentences overall increases with performance, separating the two sentence sets. RoBERTa improves by around 10% on filler-gap dependencies, island effects, and negative polarity items (NPIs), largely closing the human gap. This suggests that the difficulty of these BLiMP categories was due to PLM decomposing autoregres-sively, and not intrinsic to unsupervised language model training, as the original results may suggest (Warstadt et al., 2020). For some intuition, we include examples in Table 8. In the subject-verb agreement example, BERT sees The pamphlets and resembled those photographs when scoring have vs. has , whereas GPT-2 only sees The pamphlets , which may not be enough to counter the misleading adjacent entity Winston Churchill at scoring time. We observed that log g = PLL ( W ) is not unduly affected by unconditional token frequencies; this mitigates degradation in adequacy upon interpolation with P S2S . Consider a two-word proper noun, e.g., W = San Francisco: log PLM ( W ) = log PLM ( San ) + log PLM ( Francisco | San ) (cid:28) log PMLM ( San | Francisco ) + log PMLM ( Francisco | San ) = PLL ( W ) . It is a highly-fluent but low-probability bigram and thus gets penalized by log PLM ( W ) . Informally, PLL ( W ) expresses how likely each token is given other tokens (self-consistency), while log PLM ( W ) expresses the unconditional probability of a sentence, beginning with the costly unconditional term PLM ( San ) . We see this in practice when we take LM to be GPT-2 (345M) and MLM to be RoBERTa (large). Substituting in the actual scores: log P GPT-2 ( W ) =  8 . 693 = (  7 . 749) + (  0 . 944) (cid:28) (  0 . 006) + (  1 . 000) =  1 . 006 = PLL RoBERTa ( W ) . Both give similar probabilities P ( Francisco | San )  e  1 . 0  37%, but differ in the first summand. We examine the interplay of this bias with our sequence models, in cases where the baseline, GPT-2, and BERT gave different top-1 hypotheses (Ta-ble 8). In our examples, GPT-2 restores fluency using common and repeated words, at the cost of adequacy: clasping truth and (cid:55) class in truth and , Union by the Union Sivities (cid:55) Union by the Union by the Union Civities . One can view these as exacerbations of the rare word problem due to overconfident logits (Nguyen and Chiang, 2018), and of over-translation (Tu et al., 2016). Meanwhile, BERT rewards self-consistency, which lets rarer but still-fluent words with better acoustic or translation scores to persist: clasping truth and (cid:55) clasping truth in , Union by the Union Sivities (cid:55) Union by the Union of LiberCivities , System Model Output sentence BLiMP (S-V agreement) BERT The pamphlets about Winston Churchill have resembled those photographs. which preserves the p sound in the ground truth ( clapping ) for ASR, and promotes the more globally-fluent Union by the Union of LiberCivities . We also see the under-translation (i.e., omission) of Liber being corrected, without being discouraged by the rare sequence LiberCivities . Given the differences between PLLs and log probabilities, we explore whether ensembling both improves performance in Appendix D. Similar to the largely-dominant results of MLMs on BLiMP over GPT-2 (Section 4.1), we find that as the MLM gets stronger, adding GPT-2 scores has negligible effect, suggesting that their roles overlap. PLL's numerical properties make it an ideal foundation for future ranking or scoring schemes. For example, given fixed | W | one expects  log PMLM ( w t | W \ t ) to be in the same range for all t . Meanwhile  log PLM ( w t | W <t ) decreases as t  | W | , the rate of which was studied in recurrent language models (Takahashi and Tanaka-Ishii, 2018). We validate this with GPT-2 (Figure 3) and BERT (Figure 4). In particular, we see the outsized cost of the unconditional first unigram in Figure 3. This also explains why bi-SANLM was more robust than uni-SANLM at shorter and earlier positions (Shin et al., 2019); the difference is intrinsic to log probabilities versus PLLs, and is not due to model or data size. Figure 4 also shows that domain adaptation (Sec-tion 3.5) affects PLL's positionwise cross-entropies. Cased BERT spikes at position 1, as it observes a lowercase word where a capitalized word is expected. All MLMs spike at the final token of an utterance, before our appended period  . . Terminal 1 3 5 7 9 11 13 15 17 19 Context length ( t 1) 4.0 4.5 5.0 5.5 6.0 6.5 7.0 C r o ss e n t r o p y GPT-2 (117M, cased), test-clean GPT-2 (117M, cased), test-other GPT-2 (345M, cased), test-clean GPT-2 (345M, cased), test-other Figure 3: Cross-entropy (natural base) of w t | W <t versus context length ( t  1 ) from GPT-2 models, averaged over LibriSpeech's test utterances. words are difficult to predict in general, but here more so as the BERT+LibriSpeech text corpora and the LibriSpeech test set are mismatched; the latter's ground-truth utterances were segmented by voice activity and not punctuation (Panayotov et al., 2015). Otherwise, the averaged cross-entropies are flat. This, plus our success on BLiMP, suggest positionwise scores as a way of detecting disfluencies (at least, those in the form of domain mismatches) by observing spikes in cross-entropy; with log PLM , spikes are confounded by the curve in Figure 3. In Appendix C, we plot sentence-level PLLs versus | W | and observe linearity as | W |   , with spikes from the last word and lowercase first word smoothing out. This behavior motivates our choice of  = 1 . 0 when applying the Google NMT-style length penalty (Wu et al., 2016) to PLLs, which corresponds to the asymptotically-linear LPMLM = (5 + | W | ) / (5 + 1) . In contrast, autoregressive scores like PLM ( W ) integrate over the inverse power-law curve in Figure 3. We speculate that this explains the effectiveness of their hyperparameter  = 0 . 6 , widely used in NMT baselines like ours, as there exists C such that LP S2S ( W ) = (5 + | W | ) 0 . Our work extends the closest previous works (Wang and Cho, 2019; Shin et al., 2019) with regards to experiments and tasks, as outlined in Section 2.1. Furthermore, neither work considers the inference cost of masked rescoring, which we address with our maskless scoring approach, or analyze PLL's numerical properties. Future context. Log probabilities conditioned on past and future context have been used in MT (Finch and Sumita, 2009; Xiong et al., 2011) and perennially in ASR (Shi et al., 2013; Arisoy et al., 2015; Chen et al., 2017) to positive effect. However, these are not deep bidirectional as they model interactions between W <t and W >t via the for-ward and backward context vectors, while MLMs model all pairwise interactions w s and w s (cid:48) via dot-product attention (compare ELMo versus BERT). Their PLLs would have different properties from ours (e.g., their cross-entropies in Figure 4 may be convex instead of flat). Discriminative language modeling. Previous works (Roark et al., 2004; Huang et al., 2018) have explored training language models that directly optimize for a downstream metric (WER, BLEU). While we also eschew using log probabilities from conventional LMs, our approach remains generative. Log probabilities model the joint distribution; PLL does so as well, albeit implicitly (Appendix B). PLL's summands (conditional probabilities) remain accessible for Gibbs sampling and are not tailored to any metric. The two approaches are complementary; for example, one could use PLL as a prior or regularizer for scores given by discriminatively-finetuned BERT models in tasks like passage re-ranking (Nogueira and Cho, 2019). Language model integration. Beyond finetuning pretrained LMs and MLMs, monolingual pretraining has also improved NMT performance (Ra-machandran et al., 2017; Conneau and Lample, 2019). However, modular integration of language representation models remains prevalent for various pragmatic reasons, similar to fusion in ASR. Contemporary examples are the use of finetuned BERT scores in a question-answering pipeline (Nogueira and Cho, 2019), or as-is cosine similarity scores from BERT to evaluate generated text (Zhang et al., 2020). For example, one might have no pretrained multilingual LMs for decoder initialization or fusion, as such models are difficult to train (Ragni et al., 2016). However, one may have an M-BERT or XLM for the target lan-guage/domain. Finally, N -best rescoring and pretraining are not mutually exclusive, though pretraining may already go partway to improve fluency. We studied scoring with MLM pseudo-log-likelihood scores in a variety of settings. We showed the effectiveness of N -best rescoring with PLLs from pretrained MLMs in modern sequence-to-sequence models, for both ASR and lowto medium-resource NMT. We found rescoring with PLLs can match or outperform comparable scores from large unidirectional language models (GPT-2). We attributed this to PLL's promotion of fluency via self-consistency, as demonstrated by improvement on unsupervised acceptability judgements and by qualitative analysis. We examined the numerical properties of PLLs, proposed maskless scoring for speed, and proposed pseudo-perplexities for intrinsic evaluation of MLMs, releasing a codebase implementing our work. Future work could find additional modular uses of MLMs, simplify maskless PLL computations, and use PLLs to devise better sentenceor document-level scoring metrics. We thank Phillip Keung and Chris Varano for their thoughtful suggestions on this work.
abstain method result abstain result abstain method other abstain abstain abstain abstain other method abstain method result abstain objective abstain result other result objective abstain result abstain other other other other other method other other objective other other objective objective other other other abstain objective other other other other other other abstain method other other abstain abstain other abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method abstain method abstain method method abstain method method abstain method method method abstain method abstain abstain other method abstain abstain abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain other abstain method abstain abstain abstain method abstain abstain abstain abstain method abstain abstain abstain method method other abstain abstain abstain abstain abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain other abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method other other other other other other method other other other other other other other other other other method result result objective objective abstain other