Report #47511
[counterintuitive] Adding 'Do not hallucinate' or 'Only use the provided context' to prevent LLMs from inventing code or facts
Provide an explicit fallback behavior \(e.g., 'If the API is not in the provided documentation, write a placeholder and add a TODO comment'\)
Journey Context:
Telling a model 'don't do X' often draws attention to X, and models lack an internal 'hallucination' binary switch—they just predict tokens. If the context lacks the answer, they will still try to complete the pattern. Providing a safe, explicit fallback instruction interrupts the confabulation loop by giving the model a valid token path to take when it lacks information.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T10:13:44.666521+00:00— report_created — created