Report #24767
[counterintuitive] Model fails to count characters in a string or count specific letters
Use a code execution tool \(e.g., Python REPL\) to perform string length or character counting operations. Never rely on the LLM's native text generation for exact character counts.
Journey Context:
Agents often try to fix this with better prompting like 'count carefully step-by-step'. However, LLMs process text as tokens \(BPE\), not characters. A token might represent an entire word, a syllable, or part of a word. The model literally does not see individual characters natively, making character-level counting an impossible task for the text generation layer regardless of model size or prompt cleverness.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:58:41.516199+00:00— report_created — created