Skip to content
The Chat Archive
chatgpt-4o-latest-20250326· OpenAI LMArena Human Preference 140K

what aspect of the tokenisation process causes large language models to be unable to…

  1. User

    what aspect of the tokenisation process causes large language models to be unable to count individual letters in words

  2. Assistant

    Great question! The difficulty large language models (like me) have with accurately counting individual letters in words arises from aspects of how tokenization works — particularly with subword tokenization methods like Byte Pair Encoding (BPE) or WordPiece. Here's a breakdown of why this happens:


    🔑 1. Tokenization Is Not Character-Level

    Large language models (LLMs) like GPT-3, GPT-4, etc., do not process text character by character. Instead, they break text into tokens, which are usually subword units.

    • For example, the word "strawberry" may be tokenized as one token, or split into parts like:
      • "straw", "ber", "ry"
    • These tokens don’t correspond directly to individual letters.

    Because of this, the model does not inherently "see" each character, and thus counting individual letters like "r" becomes non-trivial.


    🧠 2. LLMs Learn Statistical Patterns, Not Explicit Rules

    Even though LLMs are excellent at mimicking human-like language, they don't have a built-in understanding of orthographic rules (like spelling or letter-counting). They learn:

    • Statistical relationships between tokens
    • Contextual associations

    When you ask "How many 'r's are in 'strawberry'?", the model doesn’t actually break the word into individual letters before processing — it uses its neural weights and embedding patterns, which are not optimized for tasks like precise letter counting.


    🔡 3. Letter Counts Are a Low-Level Task

    Tasks like counting letters are low-level symbolic reasoning rather than the probabilistic pattern-matching LLMs excel at.

    • A character-level model or a simple programmatic loop can do this easily because it's explicitly parsing individual characters.
    • But for an LLM trained on tokenized data, the granularity is too coarse.

    🧩 Example:

    Let’s look at how the word “strawberry” might be tokenized (in GPT-3.5 or GPT-4 using OpenAI's tokenizers):

    from transformers import GPT2Tokenizer
    
    tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
    tokens = tokenizer.tokenize("strawberry")
    print(tokens)  # Output could be something like: ['straw', 'berry']
    

    So the model doesn't truly see s, t, r, a, w, b, e, r, r, y as separate units, only larger chunks.


    ✅ Summary: Why LLMs Struggle to Count Letters

    CauseExplanation
    Subword tokenizationWords are split into chunks (not individual characters), so letter-level info is partially obscured.
    Probabilistic learningModels rely on statistical patterns in data, not symbolic logic like counting.
    No inherent character-awarenessLLMs don’t "see" every letter unless trained or prompted to attend to characters explicitly.

    🛠️ Workaround

    If you really want reliable letter-counting using an LLM, you can instruct the model to split the word into characters explicitly, like:

    "Split the word 'strawberry' into individual letters and count how many times the letter 'r' appears."

    This sometimes works better — because you're explicitly guiding the model to behave more like a symbolic system.

    Let me know if you want a live example, or how tokenizations look for specific models!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.