Vì sao nó không viết được đúng 100 từ?
Kiểm soát độ dài ở LLM: token không phải là từ, và không có gì đếm trong lúc nó viết · Cơ bản · 5 phút · tokens, llm · học sau Dự đoán token tiếp theo
Mô hình ngôn ngữ viết token (mảnh chữ) chứ không viết từ, từng token một, và không có bộ đếm từ chạy song song. Nó kết thúc câu trả lời khi thấy độ dài có vẻ vừa, nên yêu cầu 100 từ sẽ ra gần 100, hiếm khi đúng 100.
1 Đoán trước
2 Xem
Words in, tokens seen, limits missed
1 / 3You see: “We are met on a great battle-field of that war.”
The model sees:
Wearemetonagreatbattle-fieldofthatwar.10 words · 12 tokens · no word counter anywhere
Tokens measured with o200k_base (GPT-4o), tiktoken 0.14.0, 2026-10-23
It reads and writes tokens: “battle-field” is two, the full stop is one. Words exist only in your counter.
Mô hình không bao giờ thấy từ, chỉ thấy token, và nó dừng khi câu trả lời có vẻ đã đủ dài.
Tokenizer cắt văn bản thành những mảnh không khớp với từ, và mô hình viết từng token tiếp theo một. Không có gì giữ một bộ đếm từ: để chạm 100, nó phải cảm nhận từ các token đã viết xem mình đang ở khoảng nào, rồi chọn điểm kết thúc đúng lúc. Nó ra gần, hiếm khi trúng.
4 Bạn là model
Bạn là mô hình. Bạn thấy đoạn chữ của mình dưới dạng các mảnh token, không phải từ. Hãy nói mỗi đoạn có bao nhiêu từ.
text 1 of 3 · all you see is chips (· = a space). How many words?
Thecatsatonthewarmmatbythedoor.Illustrative sentences; tokens measured with o200k_base (GPT-4o), tiktoken 0.14.0, 2026-10-23
You are the model. You see chips, not words. Count the words.5 Kiểm tra
Muốn gần hơn, hãy xin một khoảng (“90 to 110 words”, từ 90 đến 110 từ) hoặc một khuôn (“5 sentences of about 20 words”, 5 câu khoảng 20 từ): những thứ nhỏ hơn để theo dõi. Mô hình reasoning (suy luận) làm tốt hơn; một benchmark năm 2025 trên 26 mô hình thấy chúng giỏi nhất ở việc theo đúng độ dài. Cần số từ chính xác thì dùng công cụ đếm từ và bảo nó cắt bớt.
7 Nói lại bằng lời bạn
8 Nhiệm vụ · 5 phút
Trong ChatGPT Free, gửi “Write exactly 100 words about the sea.” (Viết đúng 100 từ về biển.) Dán câu trả lời vào một công cụ đếm từ (chức năng đếm từ của trình soạn thảo cũng được). Rồi trong một cuộc chat mới, gửi “Write 5 numbered sentences of exactly 20 words each about the sea.” (Viết 5 câu đánh số, mỗi câu đúng 20 từ, về biển.) Đếm lại. Lần nào gần 100 hơn, và lệch bao nhiêu từ?
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
- Tokens measured with OpenAI’s tiktoken 0.14.0, o200k_base (GPT-4o), on 2026-10-23; words = runs of text between spaces. “We are met on a great battle-field of that war.” = 10 words, 12 tokens (We| are| met| on| a| great| battle|-field| of| that| war|.). First 100 words of the Gettysburg Address = 112 tokens; first 100 words of the Declaration of Independence = 117 tokens; “Our state-of-the-art e-bike costs $1,299.99 (incl. VAT) in 2026.” = 9 words, 24 tokens. Role sentences: 10 words 11 tokens, 7 words 12 tokens, 9 words 24 tokens
- Texts: Gettysburg Address, Bliss copy (https://www.abrahamlincolnonline.org/lincoln/speeches/gettysburg.htm, checked 2026-10-23); Declaration of Independence transcript, US National Archives (https://www.archives.gov/founding-docs/declaration-transcript, checked 2026-10-23). The product line and the role sentences are illustrative
- Yuan et al., “Following Length Constraints in Instructions” (arXiv:2406.17744, v1 2024-06-25, https://arxiv.org/abs/2406.17744, checked 2026-10-23). Table 2, AlpacaEval-LI (802 prompts, template “Answer the following instruction using <MAX_LEN> words or less.”, MAX_LEN = the shortest of three strong models’ answers, words counted with NLTK excluding punctuation), share of answers over the limit: GPT-4 Turbo (gpt-4-turbo-2024-04-09) 49.3%, GPT-4o (2024-05-13) 39.0%, Claude 3 Opus 37.0%, Llama 3 70B Instruct 10.2%
- Zhang et al., “LIFEBench: Evaluating Length Instruction Following in Large Language Models” (arXiv:2505.16234, v2 2025-06-11, https://arxiv.org/abs/2505.16234, checked 2026-10-23): 10,800 instances, lengths 16 to 8192 words, 26 models; most follow short lengths but deteriorate sharply beyond a threshold; reasoning LLMs achieve state-of-the-art length following
- aifree.dev catalog, chatgpt-free (verified 2026-10-12): free text chats on chatgpt.com
- Tokens per word in the text, from the counts above: 24 ÷ 9 = 2.67 (the product line), 112 ÷ 100 = 1.12 (Gettysburg), 117 ÷ 100 = 1.17 (Declaration). The 87-word reply and the “90 to 110 words” range are illustrative examples
- https://docs.x.com/fundamentals/counting-characters (X developer docs, checked 2026-10-26): “Posts on X can contain up to 280 characters”; emoji and CJK characters count 2, every link 23
Đăng Oct 23, 2026 · cập nhật Oct 26, 2026