Report #30350
[counterintuitive] Why does the LLM fail to reverse a long string or find the Nth character of a specific paragraph?
Use Python string manipulation \(e.g., \`text\[::-1\]\`, \`text\[n-1\]\`\) for any exact string indexing or reversal. Do not rely on the model's native text generation for these tasks.
Journey Context:
Similar to character counting, string reversal and indexing are tokenization problems. If 'watermelon' is a single token, the model cannot reverse it to 'nolemretaw' without breaking it down. While the model might learn to reverse common words, reversing a novel 50-character string requires it to process the tokens, reverse the characters within them, and reverse the order of the tokens—a multi-step algorithmic process that autoregressive generation is fundamentally poorly suited for, leading to dropped characters or token-boundary errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T05:19:48.087476+00:00— report_created — created