How LLMs Work
Why Do Chatbots Struggle to Count Letters in a Word?
Researchers have several ideas for why chatbots miscount letters, and they have not settled on one. A look at the evidence.
Ask some chatbots how many times a letter appears in a word and they may get it wrong. A famous example is counting the letter "r" in "strawberry".
The word strawberry shown as letters, and then as made-up chunks that a model might read instead.
Scientists are still working out why
Researchers have suggested several reasons, and they have not settled on one.
- Tokens. A model reads tokens, not single letters, so it has little direct view of the letters inside a word. A 2024 study of counting and tokenization found that how the text is split into tokens changes how well models count.
- How the model is built. The same study points to limits in how a Transformer works through a problem in a fixed number of steps.
- Not enough letter-level practice. Another suggestion is that models see little training text that works at the level of single letters.
A separate 2024 experiment tested many models on many words. It found that models could recognise the letters but not count them, and that mistakes went up when a letter appeared more than once in the word. That study found the frequency of the word in training data did not have a significant effect.
What helps
Asking for step-by-step working can help in some cases, but the 2024 tokenization study still saw failures on short words even with step-by-step reasoning. Using a tool that runs code to count is the dependable way, because a program counts letters exactly.
Lesson
AI can be strong at some hard things and weak at what seems easy to us. Its strengths and weaknesses are not the same as a person's.