A Continuum of Generation Tasks for Investigating Length Bias and Degenerate Repetition (2022)

Abstract: Language models suffer from various degenerate behaviors. These differ between tasks: machine translation (MT) exhibits length bias, while tasks like story generation exhibit excessive repetition. Recent work has attributed the difference to task constrainedness, but evidence for this claim has always involved many confounding variables. To study this question directly, we introduce a new experimental framework that allows us to smoothly vary task constrainedness, from MT at one end to fully open-ended generation at the other, while keeping all other aspects fixed. We find that: (1) repetition decreases smoothly with constrainedness, explaining the difference in repetition across tasks; (2) length bias surprisingly also decreases with constrainedness, suggesting some other cause for the difference in length bias; (3) across the board, these problems affect the mode, not the whole distribution; (4) the differences cannot be attributed to a change in the entropy of the distribution, since another method of changing the entropy, label smoothing, does not produce the same effect.

## introduction neural language models serve as the core of modern nlp technologies, but they suffer from "inadequacy of the mode" @xcite , in which the sentences with the very highest probability under the model exhibit various pathological behaviors. specifically, machine translation suffers from length bias, where the generated translations are too long or (more often) too short @xcite , while story generation suffers from degenerate repetition, where the generated text repeats words or phrases unnecessarily @xcite . it has frequently been assumed that length bias and degenerate repetition are both aspects of a single phenomenon; for instance, it is very common for papers studying mt to reference issues observed in story generation. however, mt and story generation exhibit very different problems, and have been addressed using very different solutions. so it is worth pausing for a moment to ask how they relate. are they truly two symptoms of the same problem? why do different tasks exhibit different degenerate behaviors? @xcite and @xcite ) attribute the differences to task constrainedness: given a particular input, how many different possible correct answers might there be? for example, grammatical error correction (gec) and speech recognition are more constrained; image captioning and mt are in the middle; and story generation, dialogue, and pure unconditioned generation from the language model (ucg) are least constrained. however, constrainedness is only one of many differences among these tasks. they also differ in the length of the inputs and outputs, the size of the models, and so on. so although these papers provide compelling circumstantial evidence that the differences can be explained in terms of constrainedness, they do not rule out alternative hypotheses. in this paper, we introduce a new experimental framework which lets us directly adjust constrainedness while keeping everything else (architecture, number of parameters, type of output data) fixed. we expect that, if task constrainedness really is responsible for the differences in degenerate behaviors seen across tasks, then these behaviors should vary smoothly as we adjust constrainedness. we find this to be true for degenerate repetition: we see basically none for pure mt, and an increasing amount as we lower the constrainedness down to ucg. this is consistent with the literature, which reports repetition as a problem in ucg, but not mt. on the other hand, for length bias, we discover, to our knowledge for the first time, that length bias actually increases for less constrained tasks. this is inconsistent with the literature, where length bias is commonly reported for mt but very rarely re-ported for ucg. we conclude that the difference, then, is either due to some other factor besides constrainedness influencing the model's probability distribution, or that it can be attributed to the different decoding strategies commonly used for the different tasks. in addition, we present results showing that both length bias and degenerate repetition are problems exclusive to the mode; they do not in general affect random samples from the distribution. lastly, we explore one possible explanation for why length bias and repetition differ across constrainedness levels: that it is because less constrained tasks have higher entropy. we find that this cannot be the explanation, as another method of increasing the entropy, label smoothing, has very little effect on these phenomena. ## related work closely related to our work are two recent papers by @xcite and @xcite , which also explore how degenerate phenomena differ across tasks. @xcite study two more-constrained tasks, mt and gec. using exact search and beam search, they find that, for gec, the distribution is peaked around a few very highprobability outputs, and that, unlike mt, it does not suffer from inadequacy of the mode. @xcite study tasks in the same constrainedness range as we do, from mt to ucg. although their main focus is on evaluating different decoding strategies (where they confirm the trend seen in the literature, that more constrained tasks favor mode-seeking strategies, while less constrained tasks favor sampling-based methods), they look, as we do, at how degenerate repetition and length bias differ across tasks, finding that these phenomena vary across tasks and decoding methods. our contribution here is to provide a more rigorous empirical analysis of why these behaviors differ across tasks. both @xcite and @xcite attribute the differences they observe to task constrainedness, and @xcite quantify task constrainedness by looking at how much the references differ across a multireference test set, but neither is able to directly control task constrainedness while keeping all else fixed. tor our knowledge, our method is the first to study the effect of task constrainedness on degeneration in a completely controlled way. ## an experimental framework for the tasks which have been compared before (gec, mt, story generation, and others) all differ along multiple dimensions besides constrainedness: they use different architectures, different numbers of parameters and amounts of training data, and they produce different length outputs (one sentence for mt, many sentences for story generation), among other distinctions. this makes it difficult to study whether task constrainedness is actually responsible for the differences observed between these tasks. we therefore seek a way of controlling the constrainedness directly, via some sort of "knob" that we could adjust. in this section, we introduce an experimental framework that allows us to do so. ## degeneracy in the mode length bias is a problem where the length of the output consistently differs from the length of the reference; the term typically refers to sentences being too short. in nmt, length bias is such a major and well-known problem that nearly all systems correct for it using some kind of length normalization during decoding @xcite @xcite . in nmt, length bias gets worse the closer one approaches the mode of the distribution. it has been repeatedly shown that, as beam size increases, bringing the output translation closer to the mode, the length bias becomes more extreme. in fact, the mode of the distribution is often simply the empty string itself @xcite . on the other hand, length bias has been understudied in less constrained tasks such as story generation or ucg. we know of just two reports of this problem: for story generation, holtzman et al. (2020) report worsening length bias as beam size increases, with immediate stopping when using beam @xmath0, and @xcite found length bias for beam sizes 𝑘 = 5, 10; however, neither of these is the main result of their respective papers. this difference in emphasis seen in the literature would seem to suggest that length bias only affects mt, and does not affect less constrained tasks like story generation. thus, if constrainedness were fully responsible for the difference seen in the literature, then we would expect to see length bias decrease with constrainedness, becoming less of a problem for less constrained tasks. to test this, we measure how length bias changes as we vary 𝑠. to quantify length bias, we compute the (micro-averaged) length ratio, figure 3 shows how length ratio changes as we vary both 𝑠 and the beam size 𝑘. 3 consistent with previous findings, we find that standard nmt suffers from considerable length bias, with the problem worsening as beam size 𝑘 increases. but to our surprise, as 𝑠 decreases, we find that not only does length bias worsen, but that the dependence on beam size grows stronger and stronger. this is surprising given the lack of concern with length bias in the literature on less constrained tasks. to our knowledge, we are the first to report a result like this, where length bias actually worsens as task constrainedness decreases. we can think of two explanations for this result. the first is that there are other factors besides constrainedness affecting the length bias seen across tasks. we suspect that the length of the reference outputs might be a major part of this; models like gpt-2 are trained to produce much larger chunks of text than our systems, which typically just output one sentence at a time. the second is that this is an artifact of the decoding processes used. most of the literature on nmt uses mode-seeking decoding strategies such as beam search, while literature on less constrained generation favors sampling-based approaches. so it could in fact be that all unconstrained systems also suffer from length bias, but it simply doesn't show up because beam search is not used with those systems.we also note that it may be more difficult to study length bias in less constrained tasks, since there is not necessarily a roughly "correct" length the way there is in mt. a last interesting result is that, for 𝑘 = 1 (greedy search), the length ratio actually increases for decreasing 𝑠, ending up well above 1. this agrees with a recent result reported by @xcite , who found that, for the relatively unconstrained task of story generation, beam sizes 𝑘 = 5, 10 returned texts that were too short, while greedy search returned texts which were far too long. ## no degeneracy in samples in addition to looking at search results, we also look at samples from the distribution. for each system and for each sentence in the test set, we take 1000 samples, and discover that the samples do not suffer from either degenerate repetition or length bias (figs. 5 and 6 ). this underscores that these problems are specific to the mode, and are not properties of the distribution as a whole. for low values of 𝑠, this should not be particularly surprising; sampling-based decoding approaches such as top-𝑘 @xcite and top-𝑝 @xcite are favored for these tasks specifically to avoid the degenerate mode. yet it may be surprising to see that the pure mt (𝑠 = 100) outputs do not suffer from degeneracy either. since mt papers rarely explore properties of the full distribution beyond the mode, one might figure 5 shows that this is definitely not the case. this supports the argument by eikema and aziz (2020) that it is a mistake to focus too much on the mode during decoding. ## label smoothing and degeneration we now begin to examine exactly what it is about task constrainedness which affects the amount of degeneration. one possible explanation is that, as we vary 𝑠, we vary the distribution's peakedness: the distribution becomes much less peaked as 𝑠 decreases (as shown in §3.3). to examine whether differences in peakedness fully explain the level of degeneration, we contrast with a different method of adjusting peakedness: label smoothing. label smoothing @xcite is an alternative to the standard cross-entropy loss function. instead of comparing the next-word distribution against a one-hot vector, it compares against a mixture of a one-hot vector and the uniform distribution. it is commonly used in modern nmt systems, and has generally been found to be helpful, though the reasons why are still being investigated @xcite @xcite . the biggest effect we see is in figure 8a , which shows how adding label smoothing impacts the length bias when sampling. here, label smoothing changes the length bias from just below 1 to just above 1, giving sentences which are, on average, very slightly longer than the reference. however, although label smoothing affects length bias for the overall distribution, we see essentially no effect on length bias when using beam search (figure 8b ). 4 similarly, figures 8c and 8d show the effect of label smoothing on 1-gram repetition, for both search and sampling; there is essentially no effect. (we found this to be true for other values of 𝑛 as well.) from this, we can conclude that it is not merely the spread of the distribution which causes these degenerate behaviors to occur. there must be some other property of task constrainedness which is influencing them. we leave further investigation of what that property might be to future work. ## conclusion we introduced a new experimental framework for directly controlling the level of task constrainedness, by truncating sentences on the source side of an mt system. using this experimental framework, we analyzed how task constrainedness affected degenerate behaviors. for less constrained tasks, we observe three failure modes: beam search decoding that is too short, greedy decoding that is too long and repetitive, and random samples that are disfluent. we note that the same three failure modes are also displayed by a simple unigram language model: since every sentence contains eos, the highest-probability output must be empty (just eos with no real words); since 𝑃(eos) < 𝑃(the), a greedy search will choose the over and over; and random samples from a unigram distribution are of course disfluent. so the simplest explanation may be that the neural models used here are still insufficiently sensitive to context. for more constrained tasks, these effects are much milder. the presence of the source sentence seems to be sufficient to all but eliminate repetition and noticeably improve fluency. although some work on rnn models for nmt focused on adding coverage models to reduce skipping and repeating of source words @xcite @xcite , transformers seem to suffer from these problems far less. as transformers were originally designed for the 𝑠 = 100 case, one direction for future research may be to investigate modifications of the transformer that are better-suited to less constrained tasks.