Beyond the Demo: Why LLM Features Fail in Production
AI looks great in pitch decks, but non-deterministic outputs destroy user trust. How to build evaluation frameworks, structured output validation, and fallback chains.
The AI Demo Illusion
It has never been easier to build a breathtaking AI prototype. A founder with an OpenAI API key and a weekend can build a chatbot that sounds indistinguishable from a domain expert. But moving that chatbot from a controlled demo to a live production environment where users ask weird, unexpected questions is where the illusion breaks.
I've shipped AI features across three different products — and the gap between "it works in the demo" and "it works for users at scale" is where most founders bleed runway. This post is about the lessons I wish I had before I learned them the hard way.
The Production Reality Check
In production, LLMs are fundamentally unpredictable. Here's what nobody tells you when you're watching a beautiful GPT-4 demo on YouTube:
| What You Expect | What Actually Happens | Business Impact |
|---|---|---|
| Fast, <500ms responses | 3–12 seconds per generation | Users abandon, churn spikes |
| Consistent JSON output | Malformed JSON ~5–15% of the time | Silent failures, broken features |
| Factual answers | Hallucinations under edge cases | Trust erosion, support overload |
| 100% uptime from provider | OpenAI had 12 incidents in 2023 | Full feature outages |
| Predictable costs | Token spikes from long user inputs | Margin destruction |
The Architecture That Actually Works
After shipping and iterating, I converged on a layered architecture that treats the LLM as a volatile dependency — not a reliable service. Here's the request lifecycle I now build by default:
The Three Non-Negotiable Layers
1 — Structured Output Validation
Never trust raw LLM text. Always enforce a typed schema on every response. With Zod and OpenAI's response_format: json_object, you can make this near-bulletproof.
- Define a strict Zod schema before you write a single prompt
- Use
safeParse— never throw on bad output, retry instead - Log every parse failure to your observability stack (Sentry, Datadog)
- Cap automatic retries at 2–3 before falling back to degraded UX
2 — Semantic Routing
Routing user intent to the right model is the single highest-leverage optimization I've found. A cheap classifier call (gpt-4o-mini at ~$0.15/M tokens) saves you from paying GPT-4o ($5/M tokens) for every simple request.
| Model | Input Cost (per 1M tokens) | Best For | Avg Latency |
|---|---|---|---|
| gpt-4o-mini | $0.15 | Classification, simple Q&A | ~0.8s |
| gpt-4o | $5.00 | Complex reasoning, long-form | ~3–6s |
| Claude Sonnet 3.5 | $3.00 | Coding, document analysis | ~2–4s |
| Gemini Flash 1.5 | $0.075 | High-volume, cost-sensitive tasks | ~0.6s |
3 — Fallback Chains & Provider Redundancy
AI providers go down. OpenAI, Anthropic, Google — all of them have had incidents lasting hours. Your fallback chain should be automatic, silent, and graceful. Here's mine:
- Check Redis cache — if a near-identical query was answered recently, serve it instantly
- Attempt primary model (e.g., gpt-4o) with a 7-second timeout
- On timeout or parse failure → retry once with the same model
- On second failure → switch to secondary provider (Claude Sonnet or Gemini)
- On third failure → serve a degraded static response with an error toast, never a broken UI
Evaluation: The Step Everyone Skips
The most expensive mistake I've made is shipping prompt changes without an eval framework. LLM regressions are silent — a subtle phrasing change in a system prompt can tank response quality for a specific user segment and you won't know until you see a churn spike in analytics weeks later.
Your eval suite doesn't need to be fancy. Start with these four checks:
- Exact match tests: For structured outputs, assert the JSON shape and key values match expected
- LLM-as-judge: Use gpt-4o-mini to score outputs on a 1–5 scale for correctness and helpfulness (cheap and surprisingly accurate)
- Latency regression: Assert p95 response time doesn't increase by more than 500ms vs baseline
- Cost regression: Track average token usage per request and alert on spikes above 20%
The Observability Stack I Use
You cannot improve what you can't measure. Every LLM call in my systems emits a structured log event with the following fields — piped into Datadog with custom dashboards per feature:
| Log Field | Why It Matters |
|---|---|
| model_used | Track which fallback fired in prod |
| prompt_tokens / completion_tokens | Cost attribution per feature |
| latency_ms | p50 / p95 tracking for UX alerting |
| parse_success | Boolean — catches output format regressions |
| intent_class | Router output — catch misclassifications early |
| cache_hit | Measure cache effectiveness to cut spend |
| user_id + session_id | Debug specific user complaints in <2 minutes |
Where Most Teams Go Wrong: A Maturity Model
After working with a dozen AI-first teams, I see them fall into predictable traps at each stage. Here's the maturity curve and what to focus on at each level:
| Level | Team Stage | Common Symptom | Fix |
|---|---|---|---|
| 0 — Demo Mode | Pre-launch / hackathon | Works on your machine only | Add output schemas |
| 1 — Structured | Beta, <100 users | Occasional 500s on bad JSON | Add retry logic |
| 2 — Routing | Launch, 100–1K users | High cost, slow responses | Add semantic router |
| 3 — Redundancy | Growth, 1K–10K users | Feature outages during incidents | Add fallback chains |
| 4 — Evals | Scale, 10K+ users | Silent regressions after prompt edits | Build eval suite in CI |
| 5 — Prod-Ready | Compound growth | Predictable quality & cost | Continuous iteration |
The Founder's Takeaway
AI features are not magic. They are complex, probabilistic systems that require the same engineering discipline as any other piece of critical infrastructure. The founders who win with AI are not the ones who have the fanciest models — they're the ones who wrap those models in robust, boring software that makes them reliable.
Start with structured validation. Add semantic routing once you feel cost pressure. Build your eval suite before you have your first regression. And treat every LLM provider as if it will go down tomorrow — because eventually, it will.
The goal is not an impressive demo. The goal is a feature your users trust enough to come back for.

Rohit Nishad
I design and build scalable backend systems, AI integrations, and cross-platform apps for startups. Focusing on performance, reliability, and clean architecture.