Vì sao nó cứ lặp đi lặp lại một câu?
Vòng lặp lặp lại: mô hình ngôn ngữ viết từng mẩu chữ có xác suất cao, và khi một cụm đã nằm trên trang, chép lại cụm đó càng dễ xảy ra mỗi lần nó xuất hiện (vòng tự củng cố), nhất là khi mô hình luôn chọn mẩu đứng đầu (greedy decoding, temperature 0); giữ chút ngẫu nhiên (temperature hoặc top-p), frequency penalty hay repetition penalty, mở cuộc trò chuyện mới và yêu cầu định dạng rõ ràng sẽ phá vòng lặp · Cơ bản · 5 phút · sampling, llm · học sau Dự đoán token tiếp theo, Temperature và lấy mẫu
Chatbot lặp lại vì mỗi cụm đã có trên trang làm chính cụm đó dễ được viết tiếp hơn. Luôn chọn từ đứng đầu biến điều này thành vòng lặp. Chút ngẫu nhiên, repetition penalty hay cuộc trò chuyện mới sẽ phá nó.
1 Đoán trước
2 Xem
How one sentence turns into a loop
1 / 6GPT-2 small, top piece every time
I enjoy walking with my cute dog, but I’m not sure if I’ll ever be able to walk with my dog. 1 I’m not sure if I’ll ever be able to walk with my dog. 2 I’m not sure if I’ll ever be able to walk with my dog. 3 I’m not sure if I’ll ever… 4
Numbers mark each copy of the sentence. GPT-2 also put a blank line before copy 3.
GPT-2 small, greedy, computed 2026-10-24
GPT-2, always taking its most likely next piece, continues “I enjoy walking with my cute dog”. It writes one new sentence, then the same sentence again, and again.
Mỗi bản sao của một câu trên trang làm bản sao kế tiếp dễ ra hơn. Mô hình luôn chọn từ đứng đầu sẽ đi theo những xác suất đó vào một vòng lặp không thoát ra được.
Mô hình viết từng mẩu một, đọc lại mọi thứ đã có. Chữ đã nằm trên trang là gợi ý mạnh nhất của nó, nên cụm vừa viết trở thành cụm dễ viết tiếp. Viết lại lần nữa thì gợi ý càng mạnh. Các nhà nghiên cứu gọi đây là hiệu ứng tự củng cố: càng nhiều bản sao, càng dễ có thêm một bản.
4 Bạn là model
Bạn là GPT-2, đang viết tiếp “I enjoy walking with my cute dog”. Ba lần, tại cùng một chỗ trong cùng một câu, hãy chọn từ tiếp theo. Rồi xem xác suất thật của GPT-2.
Round 1 of 3. The sentence is new.
I enjoy walking with my cute dog, but I’m not ___
GPT-2 small, greedy, computed 2026-10-24: its real top four words at each spot
You are GPT-2. Pick the next word.5 Kiểm tra
Đây không phải một ví dụ lạ. Holtzman et al. (2019) cho GPT-2 Large viết 5.000 văn bản. Luôn chọn từ đứng đầu: 73,66% kết thúc trong vòng lặp. Với top-p (rút từ nhóm từ có xác suất cao nhất cộng lại đủ 95%): 0,36%; văn bản người viết: 0,28%. Xu et al. (2022) thấy cùng lực kéo đó: càng nhiều bản sao, bản kế tiếp càng dễ ra.
Ứng dụng chat vốn đã gieo xúc xắc, nên chatbot lớn hiếm khi lặp nguyên văn từng chữ. Lực kéo vẫn còn: cùng một câu mở đầu, cùng các ý trong một cuộc trò chuyện dài. Hãy mở cuộc trò chuyện mới để bản sao cũ rời khỏi trang, và yêu cầu định dạng rõ ràng. Khi dùng API, giữ temperature gần mặc định và thêm frequency penalty: từ lặp lại bị giảm xác suất.
8 Nói lại bằng lời bạn
9 Nhiệm vụ · 5 phút
Trong ChatGPT Free, xin 15 tên cho một quán cà phê. Rồi nói “15 more” (thêm 15 tên) ba lần trong cùng cuộc trò chuyện và đếm những tên, hoặc kiểu tên, quay lại. Sau đó mở cuộc trò chuyện mới và hỏi một lần: “60 coffee shop names, numbered, each starting with a different word, none repeating an earlier one.” (60 tên quán cà phê, đánh số, mỗi tên bắt đầu bằng một từ khác nhau, không tên nào lặp lại tên trước.) Danh sách nào lặp ít hơn?
Ba câu nhanh
Rút ngẫu nhiên từ bộ câu hỏi của bài; lần sau sẽ khác.
Xong chưa?
Nhận email khi có bài mới
Bài mới nằm trong bản tin hằng tuần, chỉ gửi vào tuần có bài. Bạn xác nhận qua email trước; hủy đăng ký chỉ với một lần bấm.
Đọc thêm
Nguồn
- GPT-2 small (124M, Hugging Face “gpt2”), greedy decoding (top piece every time) of 60 pieces after “I enjoy walking with my cute dog”, computed 2026-10-24 with scripts/explain-data/repetition.ts (plain forward pass of scripts/explain-data/distill.ts). Odds of “ sure” on copies 1–4: 0.2008, 0.6583, 0.9297, 0.9970; average of the seven pieces “’m not sure if I’ll ever”: 0.2354, 0.4937, 0.7251, 0.9905. After the first “dog.”: “ I” 0.2322, new line 0.1686, “ It” 0.0417, “ So” 0.0360. The role’s top four at “I’m not”: copy 1 sure 0.2008, a 0.1175, really 0.0533, going 0.0438; copy 2 sure 0.6583, a 0.0441, going 0.0234, really 0.0228; copy 4 sure 0.9970, certain 0.0017, clear 0.0001, even 0.0001. The same prompt and greedy loop appear in Hugging Face’s “How to generate text” (2020, model gpt2)
- Same run with frequency penalty 0.5, applied as in OpenAI’s frequency_penalty (log-odds minus 0.5 × times already written, then renormalised): after the first “dog.”, “ I” 0.1001, new line 0.1976; the text continues “I’m a big fan of the “I love walking with my dog” meme. …” without repeating the sentence
- Holtzman, Buys, Du, Forbes and Choi, “The Curious Case of Neural Text Degeneration” (ICLR 2020; arXiv:1904.09751 v2, 2020-02-14, https://arxiv.org/abs/1904.09751, checked 2026-10-24): GPT-2 Large (762M), 5,000 passages of up to 200 tokens. Table 1, Repetition %: Greedy 73.66, Beam b=16 28.94, Top-k=40 t=0.7 8.86, Sampling t=0.9 0.66, Nucleus p=0.95 0.36, Human 0.28. Figure 9: a phrase (minimum length 2) counts as a repetition “when it repeats at least three times at the end of the generation”. Figure 4: “The probability of a repeated phrase increases with each repetition, creating a positive feedback loop.”
- Xu, Liu, Yan, Cai, Li and Li, “Learning to Break the Loop: Analyzing and Mitigating Repetitions for Neural Text Generation” (NeurIPS 2022; arXiv:2206.02369 v2, 2022-10-09, https://arxiv.org/abs/2206.02369, checked 2026-10-24): “there are few consecutive sentence-level repetitions in human corpora (e.g., 0.02% in Wikitext-103)”; “the more times a sentence is repeated in the context, the higher the probability of continuing to generate that sentence”. Table 1 (greedy, Wikitext-103), Repetition-Sen: MLE 14.50%, Human 0.01%
- OpenAI API reference, frequency_penalty (openai/openai-openapi spec, checked 2026-10-24): “Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model’s likelihood to repeat the same line verbatim.”
- Google, Gemini API docs, “Gemini 3 Developer Guide” (https://ai.google.dev/gemini-api/docs/gemini-3, last updated 2026-10-09, checked 2026-10-24): “we strongly recommend keeping the temperature parameter at its default value of 1.0”; “Changing the temperature (setting it below 1.0) may lead to unexpected behavior, such as looping or degraded performance”
- The mission’s coffee-shop prompt and the habit wording are illustrative, written for this lesson on 2026-10-24
- aifree.dev catalog, chatgpt-free (verified 2026-10-12, live check 2026-10-24): ChatGPT Free Plan
Đăng Oct 24, 2026 · cập nhật Oct 24, 2026