Report #27516
[counterintuitive] Model makes mistakes when asked to mentally simulate sorting or regex matching
Write the algorithm in code and execute it. Never ask an LLM to 'simulate' running code in its text output.
Journey Context:
Agents often try to save time by asking the LLM to mentally trace a loop or apply a regex. LLMs are probabilistic next-token predictors; a 50-step loop has a compounding probability of error at each step. By step 50, the chance of hallucination is near certain. Mental simulation is an anti-pattern; actual execution is required.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:34:56.203898+00:00— report_created — created