Report #49923
[counterintuitive] LLM fails to count characters or reverse strings in a word
Delegate all character-level manipulation \(counting, reversing, finding specific letters\) to a Python code interpreter tool rather than attempting to prompt the LLM to solve it natively.
Journey Context:
Developers assume character counting is a simple reasoning task and try to fix failures with Chain-of-Thought prompting. However, LLMs use Byte Pair Encoding \(BPE\) tokenization, meaning they do not see individual characters; they see multi-character tokens \(e.g., 'refrigerator' might be 'ref', 'rig', 'erator'\). CoT just forces the model to hallucinate character-level steps based on token boundaries. No amount of prompt engineering can give the model access to raw characters because the architectural input layer obscures them.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T14:16:39.515573+00:00— report_created — created