MAUVE: Measuring the Gap Between Neural Text and Human Text using Divergence Frontiers

1 Introduction . Recent large-scale text generation models show an ability to produce human-like text of remarkable quality and coherence in open-ended generation [ 45 , 61 , 6 ] . In this setting , a text generation model forms a distribution over natural language sequences , induced by an autoregressive neural sequence model ( e.g. , GPT-3 [ 6 ] ) paired with a decoding algorithm ( e.g. , nucleus sampling [ 26 ] ) . Generating text amounts to sampling from this distribution , with the goal of obtaining samples that resemble those from the “ true ” distribution of human-written text . To evaluate how close a generation model ’ s distribution is to that of human-written text , we must consider two types of errors : ( I ) where the model assigns high probability to sequences which do not resemble human-written text , and , ( II ) where the model distribution does not cover the human distribution , i.e. , it fails to yield diverse samples . However , quantifying these aspects in a principled yet computationally tractable manner is challenging , as the text distributions are high-dimensional and discrete , accessed only through samples or expensive model evaluations [ 26 , 58 , 62 ] . We develop MAUVE , a comparison measure for open-ended text generation . The proposed measure is efficient , interpretable , and practical for evaluating modern text generation models . It captures both types of errors ( Figure 1 ) by building upon information divergence frontiers [ 49 , 31 , 16 ] , so far underexplored in natural language processing . The key idea for making the proposed measure computationally tractable , yet effective , is to reduce its measurement to computing Kullback-Leibler divergences in a quantized , low-dimensional space after embedding samples from each distribution with an external language model . From an end-user ’ s perspective , MAUVE has a simple interface : given neural text and human text , it yields a scalar measure of the gap between them . 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) . We summarize our contributions . First , we introduce MAUVE , a comparison measure between neural text and human text . Second , we empirically show that MAUVE is able to quantify known properties of generated text with respect to text length , model size , and decoding more correctly and with fewer restrictions than existing distributional evaluation metrics . Third , we find through a human evaluation that MAUVE better correlates with human quality judgements of text . Finally , we find that MAUVE can be highly robust to the choice of quantization , embeddings , and scaling . We open-source a pip-installable Python package to compute MAUVE.1 2 MAUVE . We begin by discussing the basics of open-ended text generation , and then introduce MAUVE for measuring the divergence between machine generated text and human text . Open-ended Text Generation . A language model is an estimate P̂ ( x ) of the probability distribution over sequences of text x = ( x1 , . . . , x|x| ) , consisting of tokens xt belonging to a fixed vocabulary ( e.g . characters , or words ) . Prevailing neural autoregressive language models estimate the joint distribution P̂ ( x ) by modeling the conditional distribution P̂ ( xt+1|x1 : t ) over the next token in a sequence . The open-ended text generation task asks us to output text x̂t+1 : |x| in continuation of a given context x1 : t. Unlike targeted generation tasks like translation or summarization , there is no “ correct ” output ; the main criteria for open-ended text generation are coherence , creativity , and fluency . Given a neural autoregressive language model P̂ , we can generate open-ended text in a serial , left-toright fashion , by sampling x̂t+1 ⇠ P̂ ( ·|x1 : t ) , x̂t+2 ⇠ P̂ ( ·|x1 : t , x̂t+1 ) , etc . In practice , this simple decoding algorithm is often modified by adjusting the conditional distribution P̂ ( ·|x1 : t ) to promote more conservative outputs . The decoding algorithm and the language model taken together define a distribution Q over text , which we call the model distribution . Common decoding algorithms include temperature rescaling [ 1 ] and truncation [ 18 , 26 ] . Note that truncation methods in particular create sparsity in Q , which leads to degeneracy of some measures including test-set perplexity . Sources of Error in Text Generation . Our goal in this work is to measure the gap between the model distribution Q and the target distribution P of human text . As highlighted in Figure 1 , this gap arises from two sources of error : ( Type I ) Q places high mass on text which is unlikely under P , ( Type II ) Q can not generate text which is plausible under P . The Type I errors are false positives , including the common failure case where a model generates text with semantic repetitions [ 15 , 26 , 59 ] that are highly unlikely to be written by humans.2 The Type II 1Available from https : //github.com/krishnap25/mauve . See Appendix B for an example of the mauve package in action . 2Let text x with P ( x ) 0 be the positive class and P ( x ) ⇡ 0 be the negative class . If Q ( x ) 0 for some negative x , then the model incorrectly considers it a positive , so it is a false positive . errors are false negatives , which can occur , for instance , because some pieces of plausible human text can not be generated by truncation-based decoding algorithms such as nucleus sampling [ 26 ] . The gap between P and Q is small only if both of these errors are small . Quantifying the Errors . We formalize the Type I and II errors with the Kullback-Leibler ( KL ) divergences KL ( Q|P ) and KL ( P |Q ) , respectively . The divergence KL ( Q|P ) penalizes Q if there exists text x such that Q ( x ) is large but P ( x ) is small , so it quantifies the Type I error . Likewise , KL ( P |Q ) quantifies the Type II error . Unfortunately , one or both of the KL divergences KL ( P |Q ) and KL ( Q|P ) are infinite if the supports of P and Q are not identical , which is often the case in open-ended generation . This makes the KL divergence itself unsuitable as an evaluation metric . We overcome this issue by softly measuring the two errors using the mixture distribution R = P + ( 1 ) Q for some 2 ( 0 , 1 ) . In particular , we define the ( soft ) Type I error at level as KL ( Q|R ) and the ( soft ) Type II error as KL ( P |R ) . Summarizing the Errors with a Divergence Curve . Since the mixture weight was arbitrary , we consider a family of Type I and II error values by varying between 0 and 1 , in the same spirit as information divergence frontiers [ 49 , 16 ] . This yields a divergence curve , C ( P , Q ) = n exp ( cKL ( Q|R ) ) , exp ( cKL ( P |R ) ) : R = P + ( 1 ) Q , 2 ( 0 , 1 ) o , ( 1 ) where c > 0 is a hyperparameter for scaling . The divergence curve formalizes and encodes information about the trade-off between Type I and II errors.3 Figure 2 illustrates the divergence curves for different models and decoding algorithms . Our proposed measure , MAUVE ( P , Q ) , is the area under the divergence curve C ( P , Q ) . It provides a scalar summary of the trade-off between Type I and Type II errors . MAUVE ( P , Q ) lies in ( 0 , 1 ] , with a larger value meaning that Q is closer to P . Further , MAUVE ( P , Q ) = 1 if and only if Q = P . The area under the curve is a common summary of trade-off curves in machine learning [ 13 , 11 , 12 , 19 ] . Connections to Common Divergences . The divergence curve encodes more information than the KL divergence KL ( P |Q ) , which can be obtained from the second coordinate of the curve C ( P , Q ) as ! 0 , and the reverse KL divergence KL ( Q|P ) which can be obtained from the first coordinate of the curve C ( P , Q ) as ! 1 . Further , the Jensen-Shannon ( JS ) divergence JS ( P , Q ) = KL ( P |R1/2 ) +KL ( Q|R1/2 ) /2 , can be obtained from the two coordinates of C ( P , Q ) at = 1/2 . MAUVE summarizes all of the divergence curve C ( P , Q ) . Computing MAUVE for Open-Ended Text Generation . Each point on the divergence curve C ( P , Q ) consists of a coordinate KL ( P |R ) = X x P ( x ) log P ( x ) R ( x ) , ( 2 ) and a similarly defined coordinate KL ( Q|R ) . We can not compute the summation as written in Eq . ( 2 ) , as we do not know the ground-truth probabilities P ( · ) and the support of a typical model 3More generally , the divergence curve C ( P , Q ) encodes the Pareto frontier of KL ( P |R ) , KL ( Q|R ) for all distributions R , not just mixtures of the form R . We prove this in Appendix A. distribution is prohibitively large , since it is the space of all sequences of tokens . As a result of these two issues , MAUVE can not be tractably computed in closed form . We employ a Monte Carlo estimator using samples xi ⇠ P and x0i ⇠ Q to overcome the fact that ground-truth probabilities P ( · ) are unknown . We circumvent the intractable support size by computing MAUVE in a quantized embedding space that is sensitive to important features of text . The overall estimation procedure is as follows . First , we sample human text xi ⇠ P and machine text x0i ⇠ Q . We then embed each text sequence using an external language model M ( e.g. , GPT-2 [ 45 ] ) to obtain embeddings { M ( xi ) } Ni=1 and { M ( x0i ) } N 0 i=1 . Each embedding is now a vector M ( x ) 2 Rd . Next , we jointly quantize the embedded samples ( e.g . with k-means [ 36 ] ) , and count the cluster assignments to form histograms , giving low-dimensional discrete distributions that approximate each high-dimensional text distribution . In particular , the distribution P of human text is approximated by the discrete distribution P̃ of support size k , which is defined as , P̃ ( j ) = 1 N NX i=1 I ( xi ) = j , ( 3 ) where ( x ) 2 { 1 , · · · , k } returns the cluster id of x . The model distribution Q is approximated as Q̃ similarly . Here , P̃ and Q̃ can be interpreted as piecewise constant approximations of P and Q , similar to a histogram ; see Figure 3 for an illustration . Computing the divergence curve is now tractable , as each coordinate is a KL divergence between the k-element discrete distributions . To recap , our proposed measure MAUVE ( P , Q ) is the area under this divergence curve , providing a summary of all Type I and Type II errors through an efficient approximation designed for text generation . Next , we discuss how MAUVE compares to prior comparison measures for text ( §3 ) , then present empirical results with MAUVE ( §4 ) .

Summary: This paper presents a framework for evaluating open-ended text generation models: that is, evaluating how closely they match the distribution of human text (P). The proposed method (Mauve) evaluates for both Type I errors (false positives) and Type II errors (false negatives).  Mauve measures the divergence between P and Q by looking at the Pareto frontier of distributions R that are close to P and Q: that is, looking at the curve KL(P|R), KL(Q|R), which is optimized by R being an interpolation of P and Q.  This curve cannot be computed exactly since the true text distribution P is unknown. Mauve therefore takes samples, embeds them, clusters them, and approximates P and Q as multinomial distributions over the clusters, allowing us to interpolate their distributions and take KL divergences.  Results show that this metric (1) has some desirable properties like rating long text as worse (since it often is in these settings) and reproducing human judgments about different sampling schemes; (2) is robust and works with different hyperparameters; (3) correlates well with human judgments.