arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.18626cs.CL
收藏

为什么大语言模型(LLMs)难以数清字母?

Why Do Large Language Models (LLMs) Struggle to Count Letters?

College of Mechanical & Electrical Engineering, Nanjing University of Aeronautics and Astronautics(南京航空航天大学机电学院);ETSI de Telecomunicación, Universidad Politécnica de Madrid(马德里理工大学电信高级工程学院)

Tairan Fu, Raquel Ferrando, Javier Conde, Carlos Arriaga, Pedro Reviriego

AI总结:

本文通过实验系统分析了大语言模型在字母计数任务中的错误模式,发现错误主要与单词长度及重复字母数量相关,而与词频和分词频率关系不大,并指出模型能识别字母却难以完成计数。

摘要:

大语言模型(LLMs)在许多复杂任务上取得了前所未有的表现,例如能够回答几乎任何主题的问题。然而,它们在另一些简单任务上却表现不佳,比如统计一个单词中某个字母出现的次数,许多 LLMs 无法正确数出“strawberry”中字母“r”的数量就说明了这一点。已有若干工作研究了这一问题,并将其归因于 LLMs 所使用的分词方式、注意力机制的内在局限,或缺乏字符级训练数据。本文开展了一项实验研究,以评估 LLMs 在字母计数错误与以下两方面之间的关系:1)单词及其组成部分在训练数据集中的频率;2)计数操作的复杂度。我们通过在一组代表性模型上对大量单词进行评估,对 LLMs 在字母出现次数计数中的错误进行了全面分析。结果表明,在所评估的模型中存在若干一致趋势:1)模型能够识别字母,但无法对其进行计数;2)单词及单词中 token 的频率对 LLMs 的错误没有显著影响;3)字母频率与错误呈正相关,更常见的字母往往产生更多计数错误;4)错误与单词中字母或 token 的数量存在强相关;5)最强的相关性出现在计数大于 1 的字母数量上,大多数模型无法正确计数其中字母出现超过两次的单词。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑