๐Ÿ“ LLM Glitch Lab

Why ChatGPT Couldn't Count Rs in Strawberry

Interactive Subword Decomposition & Character Diagnostic Real-Time BPE Simulator
Test Presets:
Single ASCII letter for model attention query
Subword Token Stream (CL100k / GPT-4 Vocabulary) 2 Tokens Total
3
Actual Letter Count
2
LLM Token Chunks
2
2023 Direct LLM Guess
3
2025 Reasoning Guess
The Character Blindspot: Human Eyes vs Transformer Vector Ingestion Mechanistic Interpretability
๐Ÿ‘๏ธ What Human Eyes See (Character Matrix)

Humans inspect discrete individual characters indexed from 0 to N. Target letter matches are highlighted.

Formula: Count('r' in "strawberry") = 3
๐Ÿค– What the LLM Input Layer Receives (Atomic Embeddings)

The model receives compressed high-dimensional token IDs. Individual ASCII characters are completely opaque.

Input: "strawberry" Tokens: [49624, 18765] ("straw" + "berry") Embedding Vector: E[49624] (1536-dim) + E[18765] (1536-dim) Letter Resolution: 0 (Hidden inside dense semantic weights)
Three-Generation Inference Simulator Historical Evolution
Tokenizer Resolution Benchmark BPE vs Byte vs Character

Comparing how different tokenization architectures chunk the current string. High token counts increase compute cost but preserve letter-level spatial awareness.

Tokenizer Type Chunking Breakdown Token Count Character Counting Capability
Transformer Subword Permutation Sandbox Reversal & Anagrams

Subword chunking also explains why LLMs struggle with backward spelling and anagrams without test-time reasoning.

Forward Tokenization
Reversed String Tokenization

๐Ÿ“š Why Did This Happen? The Anatomy of Byte-Pair Encoding

1. Words are not characters to an LLM: Modern frontier models do not ingest text letter-by-letter. To maximize throughput and compress context windows, algorithms like Byte Pair Encoding (BPE) merge common character clusters into single token IDs. The word "strawberry" is partitioned into "straw" (ID 49624) and "berry" (ID 18765).

2. The Loss of Internal Geometry: Once mapped to token embedding vectors, the internal ASCII spelling is destroyed. The attention layers attend to the semantic concept of "straw" and "berry", not the individual letters 's', 't', 'r', 'a', 'w', 'b', 'e', 'r', 'r', 'y'.

3. Why direct 2023 models guessed 2: When prompted with "How many Rs in strawberry?" without reasoning tokens, the model had to generate the next token immediately in a single forward pass. Because the root word "berry" contains 2 'r's and "straw" is perceived as a single fruit/material token, probabilistic weights frequently hallucinated '2'.

4. How Modern Models (o1, o3, R1) Fixed It: Modern reasoning architectures introduce thinking tokens. The model writes out an internal scratchpad: "s-t-r-a-w-b-e-r-r-y -> r at index 2, 7, 8 -> Total: 3". By tokenizing individual characters during test-time compute, the attention layers can finally count!

Enjoy this tool? Build your own with Super