Applied AI / To Production
Why the demo is the easy 20 percent.
Reviewed by Yuvaraj
A convincing demo feels like the finish line. It is closer to the starting line, maybe 20 percent of the work. The demo proves the model can produce a good answer once, under friendly conditions, watched by someone who wants it to succeed. Production means it produces good answers for real users, at scale, when inputs are hostile, the model provider has an outage, and nobody is watching. This lesson is about the other 80 percent: the evaluation, guardrails, observability, cost controls, and versioning that separate a prototype from a system you can trust in front of users.
A demo is a single happy path with a forgiving audience. Production is thousands of adversarial paths with no audience at all. The gap is not that the model gets worse, it is that everything around the model now has to be engineered: what happens on the 1-in-500 weird input, how you notice quality quietly dropping, what stops a runaway loop from spending your monthly budget by lunchtime, and how you change the model next quarter without breaking every user's workflow. None of that shows up in the demo, and all of it shows up in production.
The model is a dependency, not the product
Treat the model like any third-party dependency: it has a version, an SLA you do not control, variable latency, and occasional outages. Your product is the system around it, the validation, fallbacks, monitoring, and controls. Teams that ship the model as the product get paged; teams that ship a system around the model sleep.
You cannot improve or safely change what you cannot measure, and "it looked good when I tried it" is not measurement. You need two kinds of evaluation working together.
Offline evaluation runs before you ship. Build a dataset of real, representative inputs, including the weird and adversarial ones, with a notion of what a good output looks like. Score candidates against it automatically where you can (exact matches, format checks, an LLM-as-judge for open-ended quality) and keep a human-reviewed slice for the cases automation cannot grade. This is your regression suite: it is how you know a prompt tweak or model swap made things better, not just different.
Ask about this lesson, or about anything in AI. Answers cite the lessons they draw on.
Finished this lesson?
Mark it complete to earn XP, keep your streak, and schedule a review.
Online evaluation runs in production on live traffic. Offline sets go stale and never fully capture reality, so you also measure what actually happens: thumbs up/down, edit and acceptance rates, task completion, escalations to humans. Online signals catch the failures your offline set never imagined.
Between the model and the user sits a layer that assumes the model can misbehave. Validate every output you depend on, if you asked for JSON matching a schema, parse and check it before use, and retry or fall back when it fails. Constrain inputs to guard against prompt injection and abuse, especially where user text is mixed with your instructions or feeds a tool call. Handle provider failures with timeouts, retries with backoff, and a defined behavior when the model is simply unavailable. The rule of thumb: never let unvalidated model output flow straight into something that renders to a user, executes an action, or hits your database.
When something goes wrong in production, and it will, you need to answer "what happened?" in minutes, not days.
| Layer | What it captures | What it answers |
|---|---|---|
| Logging | Inputs, outputs, model/prompt version, tokens, latency, errors | "What exactly did the model see and return for this request?" |
| Tracing | The full chain: retrieval, tool calls, model calls, retries | "Which step in the pipeline was slow or failed?" |
| Monitoring | Aggregate quality, latency, cost, error and fallback rates over time | "Is the system degrading, and did my last change help or hurt?" |
Log enough to reconstruct any single request end to end, trace multi-step flows so you can see where time and failures accumulate, and monitor aggregates with alerts so a slow quality slide or a cost spike pages you before a user complains. Be deliberate about privacy: user inputs may contain sensitive data, so redact or restrict access to logs accordingly.
An AI feature can spend money in a runaway loop faster than any traditional bug. Put ceilings in place before launch, not after the invoice:
Models are deprecated, repriced, and improved on the provider's schedule, not yours. If your product silently depends on "whatever the latest model is," every provider change is an uncontrolled experiment on your users. Instead: pin explicit model versions, and treat the prompt as versioned code alongside them. Roll out changes gradually, canary a new model or prompt on a slice of traffic, compare it against the current version on your evals and online signals, and keep the ability to roll back instantly. Because output varies run to run, a change that looks fine in a quick test can still regress in aggregate; the eval set and gradual rollout are what catch it.
Before you call an AI feature production-ready, you should be able to check every box:
Common mistakes