Report #42665
[counterintuitive] Adding 'Do not hallucinate' or 'Be accurate' to prevent factual errors in code generation
Provide grounding context \(RAG, docs, codebase\) and explicit fallback instructions \('If the API is not in the provided docs, use standard library equivalents or halt'\).
Journey Context:
LLMs do not have an internal 'hallucination dial' that can be turned off by instruction. Telling a model not to hallucinate often makes it overly cautious \(refusing valid but uncertain answers\) or has zero effect. Accuracy is a function of the model's training data and the context provided. Grounding the model in specific documentation and defining what to do when context is missing is the only reliable way to constrain hallucinations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T02:04:55.142677+00:00— report_created — created