Neural text degeneration

From Systems analysis Wiki
Jump to navigation Jump to search

Neural text degeneration is a class of text generation pathologies in neural language models in which the output becomes unnatural: excessively repetitive, formulaic, low in information, or losing coherence. The term became widely used after the work by Ari Holtzman et al. The Curious Case of Neural Text Degeneration (2019; published at ICLR 2020), which showed that decoding strategies based on direct likelihood maximization often produce poor results in open-ended text generation tasks.[1]

Simple explanation

Neural text degeneration is a situation in which a model formally continues the text, but does so poorly from the standpoint of natural speech.

It usually looks like this:

  • the model starts repeating the same words or phrases;
  • the text becomes too formulaic and "lifeless";
  • the answer loses semantic coherence;
  • random or unsuccessful words start appearing in the continuation.

In other words, the model either becomes too "cautious" and keeps choosing the same thing, or, conversely, gets too much freedom and starts pulling in weak and noisy continuations. In both cases the text stops resembling natural human speech.[1]

History of research

The problem was formulated in detail by Holtzman et al. in 2019 on the material of open-ended text generation — primarily stories, free continuations, and dialogue responses. The authors showed that decoding methods oriented toward probability maximization, such as greedy search and beam search, often lead to unnatural, repetitive, and low-information sequences in open-ended tasks.[1]

The same work showed that the opposite approach — pure stochastic sampling without truncation — is also problematic, since the model can select tokens from the "unreliable tail" of the probability distribution. This worsens coherence and increases the risk of random, poorly coordinated continuations.[1]

Later works refined and extended this explanation. In particular, Finlayson et al. proposed a theoretical interpretation of why truncation methods (for example, top-p) often help reduce text degeneration: cutting off the tail makes it possible to avoid tokens for which the model is especially unreliable.[2]

Meister et al. additionally linked the degeneration problem to a violation of local typicality: human text, as a rule, tends to maintain information content close to the expected conditional entropy, rather than simply maximizing the probability of each next token.[3]

Main manifestations

Neural text degeneration can manifest not only as explicit repetition but also in more hidden forms: from semantic impoverishment to a gradual disintegration of coherence. Outwardly, such texts often remain grammatically correct, but they begin to differ noticeably from natural human speech in diversity, informativeness, and the stability of the development of thought.[1][3]

Repetition and looping

The best-known form is the repetition of tokens, phrases, or whole syntactic constructions. The text starts "going around in circles", adding almost identical continuations again and again.[1]

This kind of degeneration can manifest at different levels:

  • as the repetition of individual words;
  • as an obsessive reproduction of the same phrase;
  • as a cyclic return to the same thought;
  • as multiple copying of the same syntactic pattern with minimal changes.[1]

It is especially characteristic that repetitions often become self-reinforcing: once a construction has appeared, it begins to reinforce itself, since the model keeps relying on the already generated fragment and reproduces it again in a slightly modified form. As a result, the text may retain the appearance of moving forward, but in fact it stops developing in content.[1]

Formulaicness and impoverishment of content

Even if there are no explicit cycles, the model can produce text that is too predictable and low in information. Such output remains grammatically correct but becomes banal, monotonous, and poor in informational content.[1]

In this form of degeneration, the text usually looks "correct" but gives the impression of being overly safe and averaged. The model prefers the most expected words and turns of phrase, because of which:

  • lexical diversity decreases;
  • the same speech patterns are repeated more often;
  • less obvious but more meaningful formulations disappear;
  • the text becomes smoother in form but poorer in meaning.[1][3]

This is why degeneration does not always look like an explicit error: sometimes it manifests as text that is too predictable, "flat", and empty, which is formally written correctly but provides almost no new information.[1][3]

Loss of coherence

With excessive randomness or weak control over the tail of the distribution, generation may retain local grammatical correctness but lose overall semantic coherence: inappropriate words, unexpected topic changes, and logical gaps start appearing in the text.[1]

In this situation, adjacent phrases may individually look acceptable, but the causal, thematic, and logical connections between them weaken. This manifests in the following ways:

  • a sentence is grammatically correct but poorly connected with the previous one;
  • the thought suddenly changes direction without a clear transition;
  • locally acceptable but contextually inappropriate continuations appear in the text;
  • the overall course of reasoning becomes loose and unstable.[1]

In other words, the model may preserve local smoothness at the level of individual phrases but lose global coherence at the level of the entire paragraph or a long answer.[1]

Semantic drift

Another form of degeneration is a gradual shift of meaning, in which the text does not collapse instantly but slowly drifts away from the original topic, task, or line of narration.[1]

Unlike explicit incoherence, the degradation here develops gradually:

  • the model starts with a relevant answer;
  • then it adds increasingly general or loosely related details;
  • after that, the original topic becomes blurred;
  • in the end, the text may remain formally fluent but no longer answers the original query well.[1]

Such drift is especially noticeable in long-form generation: the model does not necessarily fall into cycles, but step by step it loses thematic discipline, and the continuation stops being truly relevant.[1]

Reduced informativeness

Degeneration can express itself not only in repetitions but also in the text ceasing to add new information. The model keeps writing, but the semantic "density" of the output decreases, and the continuation becomes empty in content.[3]

In such a text, words and sentences keep accumulating, but semantic progress slows down. New phrases:

  • reformulate what has already been said;
  • add a minimal amount of new facts;
  • replace specifics with general words;
  • maintain the volume of the text without a comparable growth of content.[3]

This is especially important because such degradation can look less noticeable than explicit repetitions: the text seems "normal", but on close reading it turns out that it mostly repeats the same idea in different words.[3]

Hidden degeneration without explicit failures

Not all neural degeneration looks like a gross breakdown. In a number of cases, the text contains no explicit cycles, abrupt logical breaks, or obvious "noise", yet it still noticeably deviates from natural human writing.[1][3]

Such a hidden form manifests as a combination of:

  • excessive predictability;
  • a monotonous rhythm of phrases;
  • safe but weak formulations;
  • a lack of surprise, nuance, and semantic depth.[1][3]

This is why neural text degeneration is not reduced to looping alone. It covers a wider spectrum of symptoms — from explicit repetitions to subtle semantic impoverishment, in which the text remains formally correct but loses diversity, expressiveness, and informative value.[1][3][2]

Causes

Mismatch between training and decoding

Language models are usually trained to predict the next token from a probability distribution. At generation time, however, the text is often extracted not as a sample from this distribution but with the help of procedures that rigidly maximize the likelihood at each step or across the whole sequence. This discrepancy between the objectives of training and the rules of decoding is one of the key causes of degeneration in open-ended tasks.[1]

The "unreliable tail" of the distribution

On the other hand, complete freedom of sampling can also be harmful. Even very unlikely tokens usually have a non-zero probability, and among them are many weak, noisy, or poorly coordinated options. If the model selects a token from this tail, the quality of the continuation can deteriorate sharply.[1][2]

Violation of local typicality

Meister et al. link degeneration to the fact that natural text usually maintains information content close to the expected conditional entropy. When decoding systematically departs from this "typicality", the text can become either too banal or too noisy.[3]

Relation to decoding methods

Neural text degeneration is closely related not only to the quality of the language model itself but also to how exactly the next token is selected from its probability distribution. The same set of probabilities can give noticeably different results depending on the decoding strategy: some methods reinforce repetitions and formulaicness, others increase diversity but risk losing coherence, and still others try to hold a compromise between these extremes.[1]

Greedy search and beam search are especially prone to repetition and formulaicness in open-ended generation tasks, since they systematically prefer the most likely continuations.[1]

With greedy search, the model selects the single most probable token at each step. This approach works well where the task has a relatively narrow set of correct answers, but in free generation it often makes the text too predictable. Again and again the model picks the most "safe" continuations, because of which:

  • the tendency to repeat already chosen constructions is reinforced;
  • the diversity of formulations decreases;
  • the text becomes more formulaic and poor in content.[1]

Beam search partially expands the search space, since it tracks several of the most probable hypotheses at once. In open-ended text tasks, however, this does not always save the output from degeneration. On the contrary, because of its general orientation toward likelihood maximization, it can also systematically favor overly "correct" but rather unnatural continuations, which increases the risk of:

  • monotony;
  • repetitiveness;
  • excessively smooth but low-information text.[1]

In other words, methods that too consistently select the most likely continuation often win in local predictability but lose in the naturalness of long generation.[1]

Pure sampling

Loosely constrained sampling increases diversity, but without additional filters it more often captures weak tokens from the tail of the distribution, which can worsen the coherence of the text.[1]

With pure sampling, the next token is chosen randomly according to the model's full probability distribution. Unlike greedy search or beam search, this approach gives the model more freedom and helps avoid getting stuck too early in the same pattern.[1]

This freedom has a downside, however. Even if the probability of many tokens is very small, they usually still have a non-zero chance of being selected. Because of this, the model can capture continuations from the "tail" of the distribution, where the following occur more often:

  • random and contextually weak words;
  • poorly coordinated continuations;
  • tokens that are locally acceptable but worsen the overall coherence of the text.[1]

As a result, pure sampling often reduces formulaicness but at the same time makes the text less stable: it can remain diverse but becomes looser, inconsistent, or semantically unstable.[1]

Distribution truncation methods

Distribution truncation methods — primarily top-k and top-p — were proposed as a practical way to reduce degeneration. They restrict the set of admissible tokens and thereby lower the probability of unsuccessful continuations.[1][2]

The general logic of these methods is not to let the model choose the next token from the entire vocabulary. Instead, only the most plausible part of the distribution is considered:

  • Top-k leaves a fixed number of the most probable tokens;
  • Top-p leaves a dynamic "nucleus" of tokens whose total probability reaches a given threshold.[1]

This restriction reduces the risk that the model will select a continuation that is too weak from the unreliable tail, but at the same time it does not force the model to take only one single "best" option each time. Because of this, truncation methods often turn out to be an intermediate solution between two extremes:

  • too rigid maximization;
  • too free and noisy sampling.[1]

Later, Finlayson et al. proposed a more rigorous theoretical interpretation of this effectiveness. They show that truncation methods help discard tokens that are more likely to be unreliable from the standpoint of the true text distribution. Therefore, truncation can be viewed not only as an engineering heuristic but also as a way to reduce the probability of systematic errors when selecting the next token.[2]

Modern strategies

Later methods, such as locally typical sampling, strive to reduce degenerative repetitions while preserving generation quality.[3] Similarly, contrastive search was proposed as a way to increase diversity without sacrificing the coherence of the text.[4]

These methods develop the idea that the problem lies not only in how many tokens to leave but also in which exactly tokens should be considered good candidates.

Locally typical sampling is oriented not simply toward high probability but toward the closeness of a token's information content to the expected conditional entropy. This makes it possible to reduce situations in which the model:

  • selects continuations that are too banal and "empty";
  • gets stuck in degenerative repetitions;
  • becomes too predictable even without explicit cycles.[3]

Contrastive search uses a different logic: it strives to choose continuations that remain plausible and at the same time are not too similar to the already generated context. Because of this, the probability decreases that the model will reinforce the same constructions simply because they are locally very probable.[4]

Compared with classical decoding strategies, these methods try not simply to restrict the choice but to make the selection criterion itself more sensitive to the quality of long generation — that is, to whether the text will remain meaningful, diverse, and coherent across several sentences or paragraphs.[3][4]

Dependence on the decoding regime

The relation between neural degeneration and decoding is not reduced to a contrast between "good" and "bad" methods. The same algorithm can behave differently depending on how rigidly or freely it restricts the distribution at each step.[1]

In general terms, three regimes can be distinguished:

  • too rigid a selection — the model almost always takes the most probable tokens, which reinforces formulaicness and repetitions;
  • too free a selection — the model gets too broad access to weak continuations, which increases the risk of incoherence;
  • a moderately constrained selection — the model preserves diversity but stays within a sufficiently reliable part of the distribution.[1][2]

This is why neural degeneration is often considered a consequence not only of the quality of the model itself but also of an unsuccessful decoding regime: too rigid, too soft, or poorly matched to the specific generation task.[1][3]

Simply put, degeneration arises more often at the two extremes: when the model either too rigidly selects only the most probable words or, conversely, gets too much freedom and starts pulling in random weak continuations. The most stable strategies usually lie between these extreme regimes.[1][2]

Mitigation methods

Although there is no universal way to eliminate neural text degeneration completely, in practice a number of methods have been developed that make it possible to noticeably reduce its most typical manifestations — primarily repetitions, formulaicness, loss of coherence, and the capture of the "noise" tail of the distribution. These methods differ in how exactly they restrict the choice of the next token: some simply cut off weak options, others take into account the shape of the distribution more subtly, and still others try to directly balance coherence and diversity.[1][2][5]

Truncation of the distribution

The most common way to combat neural degeneration is to restrict the choice of the next token not to the whole vocabulary but only to its most plausible part. This is exactly what top-p and top-k are based on.[1][2]

The main idea of these methods is that the model should not freely choose among all possible tokens, since a significant part of the distribution lies in the "unreliable tail", where weak, noisy, or poorly coordinated options accumulate. Truncation makes it possible to artificially narrow the choice space and thereby reduce the probability that the generation sharply collapses into incoherence or starts falling apart.[1][2]

In practice, the two best-known schemes are used:

  • Top-k — leaves only a fixed number of the most probable tokens;
  • Top-p (nucleus sampling) — leaves a dynamic "nucleus" of tokens whose total probability reaches a given threshold p.[1]

Their common meaning is the same: not to let the model choose from too many weak continuations. At the same time, top-p is usually considered more flexible, since the size of the admissible set changes from step to step depending on the current shape of the distribution.[1]

Finlayson et al. proposed a more rigorous interpretation of why truncation methods often work: truncation helps discard tokens that may not belong to the support of the "true" text distribution, that is, tokens that are especially unreliable from the model's standpoint. Therefore, such methods do not simply mechanically "cut the tail" but in fact reduce the probability of systematic errors at the stage of token selection.[2]

Simply put, distribution truncation helps the model not to go too far into the area of weak and random options. Because of this, the text more often remains more coherent and natural, and less prone to degeneration.

More adaptive sampling methods

Locally typical sampling, eta-sampling, and related approaches try not simply to "cut off the tail" but to take into account the shape of the distribution and the information structure of the current generation step.[3]

Unlike simple truncation, such methods strive to take into account not only how probable a token is but also how typical it is for the given context. This is important because degeneration arises not only from tokens that are too weak but also from an excessive preference for overly "safe" and banal continuations.[3]

For example, locally typical sampling is oriented toward the closeness of a token's information content to the expected conditional entropy. In other words, it tries to choose not simply the most probable words but those that better match the "normal" level of informativeness for the given context. This makes it possible to reduce:

  • degenerative repetitions;
  • excessive formulaicness;
  • the semantic impoverishment of the text while preserving overall coherence.[3]

Other adaptive methods use similar logic: instead of a simple fixed cutoff, they strive to adapt to the current state of the distribution. Because of this, the model is less inclined to fall into the two extremes:

  • becoming too predictable and "flat";
  • capturing continuations that are too weak and noisy.[3]

Such methods are usually more difficult to interpret and tune than top-k or top-p; however, they can cope better with subtle forms of degeneration, where the problem lies not in explicit incoherence but in the loss of informativeness and the repetitiveness of speech patterns.[3][5]

Simply put, more adaptive methods try not simply to remove weak words but to keep the continuations that fit the current context best in meaning and "naturalness".

Contrastive search and similar methods strive to simultaneously maintain coherence and diversity, reducing the repetitions that often arise with strictly maximization-based decoding.[4]

The idea of the contrastive approach is not to rely only on the probability of the next token. Instead, the choice of a candidate is built as a compromise between two requirements:

  • the continuation must be sufficiently plausible;
  • the continuation must not be too similar to the already generated context, and thereby reinforce repetition.[4]

Because of this, contrastive search tries to suppress exactly those continuations that formally look very probable but in practice lead to looping, formulaicness, or excessively uniform generation. Unlike pure sampling, this approach does not introduce randomness as the main mechanism of fighting degeneration but tries to purposefully select continuations that are sufficiently probable but less degenerate.[4]

Such methods are especially important because classical maximization-based strategies often give high local confidence but pay for it with the naturalness of the text. Contrastive search tries to preserve the strong sides of deterministic selection — coherence and stability — while simultaneously reducing repetitions and monotony.[4]

Simply put, contrastive search tries not to take a continuation only because it is the most probable. It additionally "penalizes" overly monotonous options, so that the text does not loop and does not become too formulaic.

Matching the strategy to the task

Later research emphasizes that there is no universal method: the effectiveness of a particular decoding strategy depends on the type of task, the size of the model, alignment, and other factors. What works well for dialogue generation or essays may work worse for code, mathematics, or other deterministic domains.[5]

This means that fighting neural degeneration is not only the choice of the "best" algorithm but also the matching of the method to the type of task. In open-ended generation (stories, dialogues, long answers), sampling methods and more flexible selection schemes often help preserve diversity and naturalness. In more rigid and deterministic tasks — for example, programming, mathematics, or tasks with a single correct answer — overly aggressive stochasticity, on the contrary, can reduce the quality of the result.[5]

Shi et al. also show that the final result is influenced not only by the decoding strategy itself but also by:

  • the size of the model;
  • its degree of alignment;
  • the sensitivity to hyperparameters;
  • the deployment environment and inference constraints.[5]

An important practical conclusion follows from this: the same method can look strong in one configuration and noticeably weaker in another. Therefore, mitigating neural degeneration in practice almost always requires the tuning of parameters and testing on a specific class of tasks, rather than reliance on one "universal" recipe.[5]

Simply put, a good decoding method depends on what exactly the model is doing. For free text, some methods work better; for code, mathematics, and other precise tasks — others.

Combining methods

In practice, mitigation methods are often applied not in isolation but in combination with each other. For example, distribution truncation can be used together with temperature, and more complex strategies can be combined with additional constraints on the choice of tokens.[1][5]

The point of such combinations is to divide the functions:

  • one mechanism sets the overall level of diversity;
  • another restricts the "noise" tail;
  • a third reduces the risk of repetitions or formulaicness.[1][4]

However, increasing the number of simultaneously tuned mechanisms complicates control over the model's behavior. Therefore, a more complex scheme does not always mean a higher-quality result: the gain often depends on how well the hyperparameters are selected and how well the particular combination matches the task.[5]

In other words, mitigating neural degeneration is most often built not on one "magic" method but on a careful combination of several constraints, each of which removes its own part of the problem.

Not to be confused with model collapse

Neural text degeneration in the sense of Holtzman et al. should not be conflated with model collapse — a separate phenomenon studied in works on the recursive training of models on synthetic data.

In the first case, the concern is primarily the degeneration of text at the generation stage (inference), when an unsuccessful decoding strategy leads to repetitions, formulaicness, or a loss of coherence.[1] In the second — the degradation of the model at the training stage, when data generated by the model begin to "pollute" the training set of the next generation of models, which can lead to the disappearance of rare events and a narrowing of the distribution.[6]

These phenomena are thematically related, since both concern the deterioration of the quality of neural text, but in the literature they are usually considered as different problems: one relates to decoding, the other to data and training.[1][6]

Significance for large language models

In the era of large language models, the problem of neural degeneration has not disappeared but has shifted from the area of small text generators to the area of managing the behavior of more powerful systems. Although modern LLMs are usually better aligned and less often fall into gross cycles of repetitions, the choice of decoding strategy still noticeably affects the naturalness, diversity, and stability of the output.[5]

Because of this, neural text degeneration is considered not a narrow defect of early language models but a fundamental problem of practical generation: good probabilistic modeling by itself does not guarantee good text at the inference stage.[1][2]

See also

Literature

  • Holtzman, A., Buys, J., Du, L., Forbes, M., & Choi, Y. (2019; published at ICLR 2020). The Curious Case of Neural Text Degeneration. arXiv:1904.09751.
  • Finlayson, M., Hewitt, J., Koller, A., Swayamdipta, S., & Sabharwal, A. (2024). Closing the Curious Case of Neural Text Degeneration. arXiv:2310.01693.
  • Meister, C., Pimentel, T., Wiher, G., & Cotterell, R. (2023). Locally Typical Sampling. TACL 2023.
  • Shi, C., Yang, H., Cai, D., Zhang, Z., Wang, Y., Yang, Y., & Lam, W. (2024). A Thorough Examination of Decoding Methods in the Era of LLMs. EMNLP 2024.
  • Su, Y., Lan, T., Wang, Y., Yogatama, D., Kong, L., & Collier, N. (2022). A Contrastive Framework for Neural Text Generation. arXiv:2202.06417.
  • Shumailov, I. et al. (2024). AI models collapse when trained on recursively generated data. Nature 2024.

References

  1. ↑ 1.00 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.20 1.21 1.22 1.23 1.24 1.25 1.26 1.27 1.28 1.29 1.30 1.31 1.32 1.33 1.34 1.35 1.36 1.37 1.38 1.39 1.40 1.41 1.42 1.43 1.44 1.45 1.46 1.47 Holtzman, A., Buys, J., Du, L., Forbes, M., & Choi, Y. (2019). The Curious Case of Neural Text Degeneration. arXiv:1904.09751. [1]
  2. ↑ 2.00 2.01 2.02 2.03 2.04 2.05 2.06 2.07 2.08 2.09 2.10 2.11 Finlayson, M., Hewitt, J., Koller, A., Swayamdipta, S., & Sabharwal, A. (2024). Closing the Curious Case of Neural Text Degeneration. arXiv:2310.01693. [2]
  3. ↑ 3.00 3.01 3.02 3.03 3.04 3.05 3.06 3.07 3.08 3.09 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 Meister, C., Pimentel, T., Wiher, G., & Cotterell, R. (2023). Locally Typical Sampling. Transactions of the Association for Computational Linguistics, 11. [3]
  4. ↑ 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 Su, Y., Lan, T., Wang, Y., Yogatama, D., Kong, L., & Collier, N. (2022). A Contrastive Framework for Neural Text Generation. arXiv:2202.06417. [4]
  5. ↑ 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 Shi, C., Yang, H., Cai, D., Zhang, Z., Wang, Y., Yang, Y., & Lam, W. (2024). A Thorough Examination of Decoding Methods in the Era of LLMs. EMNLP 2024. [5]
  6. ↑ 6.0 6.1 Shumailov, I. et al. (2024). AI models collapse when trained on recursively generated data. Nature. [6]