Report #60581
[research] LLM ignores 'not', 'without', or 'exclude' in prompts, generating the exact thing it was told to avoid
Frame prompts using affirmative constraints \(what to do\) rather than negative constraints \(what not to do\). If exclusion is necessary, implement a post-processing validation step or a secondary LLM check specifically designed to verify the exclusion constraint.
Journey Context:
LLMs process text token by token and struggle with logical negation, especially over long contexts. Telling an LLM 'Do not use library X' often primes the model to generate 'library X' because the token is highly activated. Rewriting 'Do not use X' to 'Use Y or Z instead' significantly reduces the hallucination of the forbidden item. For strict factuality, a programmatic guardrail is superior to a linguistic one.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T08:10:27.500700+00:00— report_created — created