LLM & Transformer Fundamentals·Question 10 of 109Basic

Why do LLMs famously miscount the number of r's in "strawberry"?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Because the model never sees letters. The tokenizer maps "strawberry" to one or two token IDs (e.g. "str" + "awberry", or a single token), and the model receives only those IDs' embedding vectors. There is no character-level view anywhere in the forward pass - asking it to count r's is like asking someone to count the letters in a word they've only ever heard spoken. To answer correctly, the model must have memorised the spelling of that specific token from training data (e.g. from spelling lists or character-separated text), then perform counting - a two-step process where both steps are unreliable.

Full worked answer with diagram

Because the model never sees letters. The tokenizer maps "strawberry" to one or two token IDs (e.g. "str" + "awberry", or a single token), and the model receives only those IDs' embedding vectors. There is no character-level view anywhere in the forward pass - asking it to count r's is like asking someone to count the letters in a word they've only ever heard spoken. To answer correctly, the model must have memorised the spelling of that specific token from training data (e.g. from spelling lists or character-separated text), then perform counting - a two-step process where both steps are unreliable.

Counting itself is the second failure: transformers perform a fixed number of layers of parallel computation per token, and counting is an inherently sequential operation. Without externalising intermediate steps into generated tokens (chain of thought like "s-t-r-a-w-b-e-r-r-y: r appears at positions 3, 8, 9 → 3"), the model attempts the count "in its head" in one shot, where it's guessing from memorised associations. This is why the same model that fails the direct question usually succeeds if you ask it to spell the word letter-by-letter first - and why reasoning models, which are trained to externalise steps, largely fixed this class of error.

The general lesson interviewers want: this is a tokenization artifact, not evidence about intelligence. The same root cause explains poor performance on rhyming and wordplay, string reversal, base64-ish character manipulation, and off-by-one behaviours in character-precise editing. Practical implication for engineers: don't build character-level string operations on raw LLM output - do them in code, and use the LLM for the parts it's actually good at.

Worth sketching. It puts a finger on the exact step where characters stop existing, which is also why spelling it out first works.

flowchart LR
    W["word: strawberry"] --> T["tokenizer"]
    T --> ID["token ids, characters gone"]
    ID --> E["embedding vectors"]
    E --> D{"asked to count the r's"}
    D -->|"answer directly"| G["recall spelling from memory<br/>and count in fixed depth"]
    D -->|"spell it out first"| S["s-t-r-a-w-b-e-r-r-y<br/>now one token per letter"]
    S --> C["count over tokens it can see"]

What a good answer covers

  • Because the model never sees letters
  • The tokenizer maps "strawberry" to one or two token IDs (e.g
  • "str" + "awberry", or a single token), and the model receives only those IDs' embedding vectors
  • There is no character-level view anywhere in the forward pass - asking it to count r's is like asking…
  • To answer correctly, the model must have memorised the spelling of that specific token from training…

Interviewer follow-ups to expect

  1. Why does asking the model to spell the word first fix the count?

  2. What other task categories fail for the same root cause?

  3. How would a byte-level model differ here?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep