Papers › Learning to Break the Loop: Analyzing and Mitigating Repetitions for Neural Text Generation

Learning to Break the Loop: Analyzing and Mitigating Repetitions for Neural Text Generation

6 Jun 2022arXiv:2206.02369archive 2025-07-28

Jin Xu, Xiaojiang Liu, Jianhao Yan, Deng Cai, Huayang Li, Jian Li

While large-scale neural language models, such as GPT2 and BART, have achieved impressive results on various text generation tasks, they tend to get stuck in undesirable sentence-level loops with maximization-based decoding algorithms (\textit{e.g.}, greedy search). This phenomenon is counter-intuitive since there are few consecutive sentence-level repetitions in human corpora (e.g., 0.02\% in Wikitext-103). To investigate the underlying reasons for generating consecutive sentence-level repetitions, we study the relationship between the probabilities of the repetitive tokens and their previous repetitions in the context. Through our quantitative experiments, we find that 1) Language models have a preference to repeat the previous sentence; 2) The sentence-level repetitions have a \textit{self-reinforcement effect}: the more times a sentence is repeated in the context, the higher the probability of continuing to generate that sentence; 3) The sentences with higher initial probabilities usually have a stronger self-reinforcement effect. Motivated by our findings, we propose a simple and effective training method \textbf{DITTO} (Pseu\underline{D}o-Repet\underline{IT}ion Penaliza\underline{T}i\underline{O}n), where the model learns to penalize probabilities of sentence-level repetitions from pseudo repetitive data. Although our method is motivated by mitigating repetitions, experiments show that DITTO not only mitigates the repetition issue without sacrificing perplexity, but also achieves better generation quality. Extensive experiments on open-ended text generation (Wikitext-103) and text summarization (CNN/DailyMail) demonstrate the generality and effectiveness of our method.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2206.02369")

Code

Syntology Ran 1 of 7 code samples harvested from 1 repository linked to this paper; 6 have no recorded run. Of those that ran: 1 ran with no contract checked.

By repository: community (archive-listed): 7 samples from 1 repository, 1 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Jxu-Thu/DITTO officialmentioned in papermentioned on GitHubpytorchMIT report
Jxu-Thu/DIITTO mentioned on GitHubpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

7 samples harvested; 1 ran; 0 honoured the contract we drafted; 6 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran
6unverified

Licence: 7 of the 7 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from Jxu-Thu/DIITTO. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

safe_readline Jxu-Thu/DIITTO/fairseq/binarizer.py community (archive-listed) ran MIT recorded; this copy not marked cleared · pointer only · 82bdf940665aeeb4 · report
dataset_dest_prefix Jxu-Thu/DIITTO/preprocess.py community (archive-listed) unverified MIT recorded; this copy not marked cleared · pointer only · 9eda7f80331d658c · report
load_checkpoint Jxu-Thu/DIITTO/fairseq/checkpoint_utils.py community (archive-listed) unverified MIT recorded; this copy not marked cleared · pointer only · c5ea9d48b6fc2167 · report
load_checkpoint_to_cpu Jxu-Thu/DIITTO/fairseq/checkpoint_utils.py community (archive-listed) unverified MIT recorded; this copy not marked cleared · pointer only · df40d96cc20e7f57 · report
save_checkpoint Jxu-Thu/DIITTO/fairseq/checkpoint_utils.py community (archive-listed) unverified MIT recorded; this copy not marked cleared · pointer only · b3616a62387703cb · report
sentence_repetition_count Jxu-Thu/DIITTO/report_metrics.py community (archive-listed) unverified MIT recorded; this copy not marked cleared · pointer only · c0e67067471200e3 · report
sentence_repetition_count_all Jxu-Thu/DIITTO/report_metrics.py community (archive-listed) unverified MIT recorded; this copy not marked cleared · pointer only · 38878cf98d083511 · report

Tasks

SentenceText GenerationText Summarization

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

AdamAttentionBARTBPEDense ConnectionsDropoutLayer NormalizationLinear LayerMulti-Head AttentionResidual ConnectionSoftmax

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections