Shipping an LLM-powered product exposes you to a specific class of bugs: fluent, confident sentences that quietly fabricate facts the user never mentioned. When the team behind an interactive tarot app expanded their relationship-focused features, they discovered that standard error codes don’t capture the real damage. The bugs that destroyed trust were subtle prompt and routing errors that passed unit tests but failed in production.

The Phantom Event: Few-Shot Leakage

During E2E testing on a silence-focused reading flow, the model hallucinated a 'warm contact' that the user never described. The root cause wasn't a model failure, but a prompt engineering flaw. The team had included a 'good style' few-shot example featuring the phrase 'That brief text wasn't random.' Despite an explicit system prompt instruction to 'Never invent events,' the model imitated the concrete nouns from the example. LLMs treat specific details in positive few-shot examples as templates, overriding abstract negative instructions.

The Pink-Elephant Effect in System Prompts

A second issue involved the model outputting cold disclaimers like 'I can't see inside his head' despite explicit prohibitions. The fix was counterintuitive: deleting the disclaimer priming entirely. Repeating the exact phrases you want to avoid, especially with conditional escape hatches, keeps those tokens active in the context window. Small, fast models like Haiku interpret 'if you note X' as permission to paraphrase X. By replacing negative rules with purely positive structural instructions, the team eliminated the disclaimers in four out of four live tests.

Deterministic Routing Beats LLM Classification

Beyond prompting, the team uncovered critical TypeScript regex bugs in their intent classifier. A precedence error routed 'Is he cheating on me with his ex?' to reconciliation instead of cheating, while morphology bugs missed hyphenated variants like 'break-up.' They solved this by implementing explicit precedence guards and flexible word forms in deterministic regexes. This approach ensures strict safety and paywall boundaries without incurring the latency or cost of an LLM router.

Key Takeaways

  • Audit few-shot examples for concrete nouns that may leak into outputs; use event-free examples to maintain emotional specificity without fabrication.
  • Avoid negative prompting for specific phrases; instead, remove disclaimer vocabulary from the prompt entirely to prevent the 'pink-elephant effect.'
  • Use deterministic TypeScript regexes for intent classification to achieve microsecond latency, zero cost, and 100% testability against adversarial edge cases.
  • Implement quote-aware sentence matching in post-processing to prevent truncation of LLM outputs that contain punctuation within quoted speech.

The Bottom Line

Prompt engineering is not just about what you tell the model to do, but what you inadvertently prime it to imitate. For production LLM applications, deterministic code guards and positive-only instruction sets are far more reliable than negative constraints or few-shot examples containing unverified context.