Report #80238
[counterintuitive] Why can't the model reliably reverse a simple string like 'hello' even though it can write complex code?
Never ask an LLM to directly reverse, rotate, permute, or perform character-level transformations on strings in its text output. Always delegate to a code execution tool for string manipulation.
Journey Context:
String reversal looks trivially easy — a human does it character by character from the end. But this task hits two fundamental architectural limitations simultaneously. First, tokenization: the model doesn't see characters, it sees tokens, so it must reconstruct character-level information from subword embeddings. Second, autoregressive generation: the model generates left-to-right, but reversal requires producing the last characters first. The model must internally compute the full reversed string and then emit it, which requires holding the entire result in a latent representation with no external scratchpad. For short common words, the model may have memorized the reversal. For novel strings, it must perform a computation that is architecturally misaligned with its generation process. This is why the model can trivially write 's\[::-1\]' in Python but cannot reliably produce the reversed string directly — the code delegates to a deterministic process that doesn't share the model's architectural constraints.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T17:16:48.456864+00:00— report_created — created