Evade the Trap of Mediocrity: Promoting Diversity and Novelty in Text Generation via Concentrating Attention (2022)

Abstract: Recently, powerful Transformer architectures have proven superior in generating high-quality sentences. Nevertheless, these models tend to produce dull high-frequency phrases, severely hurting the diversity and novelty of generated text. In this work, we dig into the intrinsic mechanism of this problem and found that sparser attention values in Transformer could improve diversity. To understand such a phenomenon, we first conduct both empirical and theoretical analysis and then attribute it to representation degeneration caused by the attentive mixture of the hidden states during training. We term this process the Trap of Mediocrity. To escape from such a trap, we introduce a novel attention regularization loss to control the sharpness of the attention distribution, which is transparent to model structures and can be easily implemented within 20 lines of python code. We prove that this method could be mathematically regarded as learning a Bayesian approximation of posterior attention. Experiments show that our method improved the diversity and novelty of the generated text while maintaining comparable quality on a variety of conditional and unconditional generation tasks.

## introduction natural language generation (nlg) plays a crucial role in modern natural language processing (nlp). with considerable benefits for a wide array of applications such as automatic literary writing @xcite , summarization @xcite and paraphasing @xcite , this area has risen to prominence. recently, neural architectures based on the prevalent tranformer @xcite , e.g., gpt-2 @xcite , have proven highly successful in producing fluent text indistinguishable from the human-written one. nevertheless, these models the quality and diversity (the higher the better) are measured by bertscore @xcite and dist @xcite , respectively. sparsity is controlled by the attention window size. a smaller window leads to higher sparsity. what leads to poor generation diversity and how could we accordingly tackle it? in this work, we dig into these questions and find another possible cause of such a conundrum in transformer-based models, namely attention concentration. initially inspired by related literary research which demonstrated that the concentration degree of attention on linguistic sources could impact creative writing @xcite , we conducted a preliminary study on the correlation between attention concentration (or sparsity) and generation diversity. we trained a gpt-2 base model with local attention window as in @xcite on the rocstories dataset @xcite . as shown in fig. 1 , obviously, adequate sparsity improves both quality and diversity, while excessive sparsity harms quality. such improvement of diversity is non-trivial as demonstrated in sec. 4. to better understand such results, we resort to the representation degeneration problem @xcite and analyze the interaction between the hidden states and word embeddings in transformer. we discovered that the attentive mixture could impel hidden states to approach the embeddings of high-frequency words, especially when the attention is highly distributed, which encourages irrationally higher probabilities of the generic highfrequency words, harming diversity and novelty. we termed this phenomenon as the trap of mediocrity. to escape this trap enforced by evenly dispersed attention, we propose a simple yet effective regularization method, care 1 , to concentrate and sharpen attention. care reduces the rényi entropy of attention distributions during the training process to enhance sparsity, which is lightweight, transparent to the model architectures, and could be easily implemented within 20 lines of code. we mathematically demonstrate care as learning a bayesian approximation of the posterior attention given the ground truth, providing a theoretical validation of its superiority. besides, we also equip care with learnable attention dropout to further boost performance. in this way, care could learn more concentrated attention with minimal computa-1 concentrating attention by rényi entropy tion cost to break the trap of mediocrity and hence improve the diversity and novelty of generated text. in summary, our contributions are as follows: ## the trap of mediocrity as introduced in sec. 1, we find one underlying cause of poor generation diversity lies in the improperly attentive mixture of the hidden states in transformer, i.e., trap of mediocrity. to reveal the mechanism of this trap, we performed in-depth analyses both empirically and theoretically. in detail, we progressed our argumentation by proving the following three research claims (rc) step by step: rc1: formation of the trap. the output-layer embeddings of high-frequency tokens are more likely to cluster in a uniformly positive direction of corresponding hidden states in the transformer. ## conclusion in this paper, we analyze the underlying cause of generic generated texts and propose a theory called the trap of mediocrity to attribute this problem to the attention dispersion in transformer. to evade such a trap, we present care to concentrate attention, which is easy to implement and transparent to model structures. experiments on a variety of nlg tasks demonstrate care's superiority in improving diversity while maintaining competitive quality. the code of our method will be released in https://github.com/peterliwenhao/care .