Assessing Discourse Relations in Language Generation from GPT -2 (2020)

Abstract: Recent advances in NLP have been attributed to the emergence of large-scale pre-trained language models. GPT-2, in particular, is suited for generation tasks given its left-to-right language modeling objective, yet the linguistic quality of its generated text has largely remain unexplored. Our work takes a step in understanding GPT-2’s outputs in terms of discourse coherence. We perform a comprehensive study on the validity of explicit discourse relations in GPT-2’s outputs under both organic generation and fine-tuned scenarios. Results show GPT-2 does not always generate text containing valid discourse relations; nevertheless, its text is more aligned with human expectation in the fine-tuned scenario. We propose a decoupled strategy to mitigate these problems and highlight the importance of explicitly modeling discourse information.

## introduction recent progress in nlp has been marked with the emergence of large-scale pre-trained models, e.g., elmo @xcite , bert @xcite , and gpt-2 @xcite . among these, gpt-2 is particularly suitable in natural language generation due to its underlying left-to-right language modeling objective. indeed, gpt-based language models have shown impressive results for open-domain dialogue generation @xcite @xcite . this has motivated investigations into gpt-2's generated text @xcite . in particular, using automatic metrics (e.g., cosine similarity, lexical diversity, sentence length), @xcite illustrated that gpt-2 has the ability to generate interesting and coherent text. however, analysis of gpt-2's outputs from deeper linguistic dimensions (e.g., discourse) has largely remained unexplored. in this paper, we perform the first discourse analysis of gpt-2's outputs, under both organic and fine-tuned scenarios, with the goals of understanding model behavior and pointing towards ways of improvement. we chiefly focus on discourse relations, one of the most important linguistic devices for textual coherence. discourse relations specify the relationships between text spans, for example: jazz is good, but my favorite is country music. the two clauses (also called arguments) are connected by a contrast relation, as signaled by the connective but. discourse relations are central in establishing textual coherence. for example, they create rhetorical connections between spans in the absence of anaphoric entity mentions @xcite . cognitive experiments have repeatedly shown discourse relations to be highly influential in the mental processing of text @xcite @xcite . spans joined with incorrect discourse connectives can seem logically incoherent although they are independently grammatical: ## experimental setup fine-tuned. we choose open-domain dialog generation as our fine-tuned scenario. the model conditions on a prompt (dialog turn) and generates a response (next turn). we use the personachat @xcite data for the convai2 challenge. we use 122,499 prompt-response pairs for training and 4,801 pairs for validation. we fine-tune gpt-2 medium (345m parameters). for compatibility with gpt-2's pre-training, we concatenate the prompt and response (separated by a delimiter) during training. gpt-2 is fine-tuned for 3 epochs using adam (kingma and ba, 2015) with a learning rate of 5e-5. the cross-entropy (language modeling) loss is only calculated for the response. at test-time, the model is conditioned on the prompt (and delimiter) and generates the response. our approach is similar to @xcite and we follow @xcite to encourage generation of informative responses. 1 for decoding, we experimented with both topk sampling @xcite and nucleus sampling @xcite , and picked the better performing one upon manual inspection of the validation data. we use top-k (@xmath0. for quality assurance, we manually evaluate gpt-2's generated responses against spacefusion @xcite , a state-of-the-art rnnbased model, re-trained on personachat. the evaluation is conducted on amazon mechanical turk, where 5 annotators (per hit) chose between gpt-2 and spacefusion responses. gpt-2 (45.5% chosen) largely outperforms spacefusion (16.9% chosen). for the other 37.7%, the two are tied. ## assessing explicit discourse relations at a high level, our assessment strategy compares discourse connectives from gpt-2 outputs with human judgment, following existing strategies of discourse relation annotation, which ask annotators to insert connectives between text spans @xcite @xcite . a discourse connective can be considered valid if humans would also insert a connective signaling the same discourse relation when the connective is masked. extracting sentences with discourse connectives. we follow prior work @xcite in the use of heuristics to extract sentences with discourse connectives, using a list of 11 connectives most frequently observed in personachat: after, and, because, before, but, if, since, so, though, when, while. specifically, a clause (using verbs as approximations) needs to appear before and after the connective; the connective cannot be immediately followed by a punctuation; and only and and but can follow a period. we remove instances of so immediately followed by an adjective or adverb. upon manual inspection of a random sample of 133 extracted sentences, 100% of them contain an explicit discourse relation. the increase in percentage is likely because connectives are frequent words in the corpus. ## fixing discourse connectives as a first step to fix erroneous connectives, we propose a post-processing technique that does not require retraining a model or modifying model structure: replacing generated discourse connecconnective prediction model. we train a model to predict the masked discourse connective given the rest of the sentence, or none if no relation. for training, we extract 1 million sentences from reddit that contain discourse connectives, using the heuristics in section 3. we restrict the length of sentences to be 7-25 tokens, similar to that in personachat. the model is fine-tuned on the pretrained bert-base-uncased model @xcite , where the text before the connective is used as sentence a, and text after the connective is used as sentence b. we add an additional classification layer taking the learned [cls] representation as input. to obtain training data for the none class, we add 300k synthesized examples with sentence a and sentence b sampled from different posts, approximating the absence of discourse relations. the model is fine-tuned for 3 epochs on reddit using a learning rate of 5e-6. the classification accuracy on the validation set of personachat is 0.743 and macro-f1 is 0.649. in the organic setting, we directly apply this model to predict the masked connective. in the fine-tuned setting, to obtain a better model in the domain of personachat, we fine-tune the model for 1 epoch on the training set of personachat. the classification accuracy improved by 3% and macro-f1 by 5%. 4 post-processing results. with this connective prediction model, we replace connectives in generated outputs with the predicted ones. we evaluate whether the predicted connectives align better with figure 2 compares the prediction between gpt-2 and the connective predictor for post-processing (fig. 2(a) ). it illustrates the types of relations that the connective model replaced correctly (fig. 2(b) ) and incorrectly (fig. 2(c )). this shows that the better performance of the model is not due to simply preferring the most frequent class. the improvement is notably more substantial for the organic case, an indication that fine-tuning gpt-2 nudges the model very close to what the connective prediction model learns. the overall improvement is likely due the connective prediction model having access to text before and after the connective, while the initial language generation model does not. this finding points to future work on considering stronger discourse-related signals @xcite and stronger models for inferring relations. from gpt-2. we find that the understanding of discourse connectives are present in these models but are limited, especially when the relation requires more inference. we present a post-processing strategy to replace generated connectives, such that they align better with human expectation.