Skip to main content
QUICK REVIEW

[论文解读] Why Do Large Language Models (LLMs) Struggle to Count Letters?

Tairan Fu, Raquel Ferrando|arXiv (Cornell University)|Dec 19, 2024
Natural Language Processing TechniquesComputer Science被引用 3
一句话总结

本文研究了大语言模型(LLMs)为何在简单的字母计数任务中失败,例如统计 'strawberry' 中 'r' 的数量。通过对 8 个 LLM 在 10,000 个单词上的实证评估,发现错误主要源于模型难以计数在单词中多次出现的字母,而非分词或训练频率问题。其核心限制在于模型无法聚合多个出现次数,尽管能正确识别单个字母。

ABSTRACT

Large Language Models (LLMs) have achieved unprecedented performance on many complex tasks, being able, for example, to answer questions on almost any topic. However, they struggle with other simple tasks, such as counting the occurrences of letters in a word, as illustrated by the inability of many LLMs to count the number of "r" letters in "strawberry". Several works have studied this problem and linked it to the tokenization used by LLMs, to the intrinsic limitations of the attention mechanism, or to the lack of character-level training data. In this paper, we conduct an experimental study to evaluate the relations between the LLM errors when counting letters with 1) the frequency of the word and its components in the training dataset and 2) the complexity of the counting operation. We present a comprehensive analysis of the errors of LLMs when counting letter occurrences by evaluating a representative group of models over a large number of words. The results show a number of consistent trends in the models evaluated: 1) models are capable of recognizing the letters but not counting them; 2) the frequency of the word and tokens in the word does not have a significant impact on the LLM errors; 3) there is a positive correlation of letter frequency with errors, more frequent letters tend to have more counting errors, 4) the errors show a strong correlation with the number of letters or tokens in a word and 5) the strongest correlation occurs with the number of letters with counts larger than one, with most models being unable to correctly count words in which letters appear more than twice.

研究动机与目标

  • 调查 LLM 在简单字母计数任务(如统计 'strawberry' 中 'r' 的数量)中失败的根本原因。
  • 评估训练数据中单词或子组件的频率是否影响 LLM 的计数错误。
  • 分析分词和注意力机制在字母计数表现中的作用。
  • 确定计数操作的复杂性——特别是字母多重性——是否导致错误。
  • 识别 LLM 是在检测字母时失败,还是在正确计数时失败,通过按多重性划分的错误分解来分析。

提出的方法

  • 本研究在 10,000 个单词上评估了 8 个 LLM,测量其对每个字母出现次数的计数准确性。
  • 将字母计数错误与单词频率、分词频率以及字母多重性(字母在单词中出现的次数)相关联进行分析。
  • 分析错误类型,包括高估(高于实际数量)和低估(低于实际数量),尤其关注多重性为 1、2 和 3 的情况。
  • 通过比较字母在同一个分词中出现两次与在不同分词中出现时的错误率,评估分词的影响。
  • 测量模型对单词中不存在的字母报告非零计数的倾向,以评估其检测能力。
  • 计算错误率与字母频率、单词长度以及字母多重性等因素之间的统计相关性。
Figure 1. Percentage of words with errors on when counting letters for the different models
Figure 1. Percentage of words with errors on when counting letters for the different models

实验结果

研究问题

  • RQ1单词或其子组件在训练数据中的频率是否影响 LLM 的字母计数准确性?
  • RQ2分词是否是 LLM 字母计数错误的主要原因?
  • RQ3字母的多重性(即其在单词中出现的次数)与计数错误之间是否存在相关性?
  • RQ4当字母多次出现时,LLM 是在检测字母上失败,还是在正确计数上失败?
  • RQ5LLM 的响应是否存在系统性偏差——例如,根据字母多重性高估或低估计数?

主要发现

  • LLM 在计数单词中多次出现的字母时持续失败,且随着字母多重性的增加,错误率显著上升。
  • 单词或分词在训练数据中的频率与计数错误频率之间无显著相关性。
  • 错误最强预测因子是字母在单词中出现的次数,尤其是当出现次数超过两次时。
  • 对于仅出现一次的字母,模型最常高估计数(例如,回答 2 或以上);而对于多重性为 2 和 3 的情况,低估是主要错误类型。
  • 模型能正确识别分词中的字母存在,表明核心失败在于聚合而非检测——尤其在重复字母上。
  • 更大的模型如 GPT-4o 和 Llama 3 70B 的错误率显著低于较小模型,表明规模有助于缓解问题,但无法消除根本的计数限制。
Figure 2. Distribution of cumulative error counts for words sorted by frequency
Figure 2. Distribution of cumulative error counts for words sorted by frequency

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。