Report #72285
[counterintuitive] Why can't the model count characters in a word or find character positions despite seemingly understanding text?
Always delegate character counting, character position lookup, and substring indexing to code execution \(Python\). Never rely on the model's direct text output for character-level operations, no matter how simple the task appears.
Journey Context:
Developers assume character counting is trivial and that failures mean the model is bad at counting. The real issue is architectural: LLMs consume BPE-tokenized input, not characters. The token for 'strawberry' might be \["str", "aw", "berry"\], so the model literally cannot see how many 'r' characters exist—character boundaries are destroyed by tokenization. No prompt technique \(chain-of-thought, examples, role-play\) can recover information that isn't in the input representation. This is why the model can write a Python function to count characters perfectly but can't count them itself: the code interpreter operates on characters, while the LLM operates on tokens. The widespread 'just think harder' prompting approach is fundamentally misdirected here.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T03:54:54.750927+00:00— report_created — created