▶ Sign up free for the video, slides & prompts
The lesson below is open to all. Enter your email once to unlock every video, slide deck, prompt and code example on this device.
Checking…
How LLMs Really Work · Lesson 14 of 15 · 2 min read · 5 min video
Shipping an LLM app: speed, cost and monitoring
Streaming, caching, model routing and what to watch once real users arrive.
📄 Download slides (PDF)· free sign-upA demo that works on your laptop is the easy part. Real users bring slow networks, odd questions, traffic spikes and a monthly bill. Here's what changes when you ship.
Speed
Users judge speed by how soon something appears, not total time.
- Stream tokens as they're generated, so text appears within a second
- Use a smaller model for simple steps such as classification and routing
- Cache answers to repeated questions, and keep fixed prompt prefixes identical so providers can cache them
- Run independent steps in parallel (retrieval while you validate the input)
- Cap the answer length; long answers take longer to generate
Cost
- Route by difficulty: a cheap model handles most requests, and only hard ones go to the expensive model
- Retrieve fewer, better chunks instead of stuffing the context
- Use batch APIs for non-urgent jobs such as overnight summaries, which are often much cheaper
- Set per-user and per-day limits so one script can't run up your bill
- Re-check prices when providers launch new models; they change often
Reliability
- Timeouts and retries with backoff for rate limits and temporary errors
- A fallback model or provider for outages
- Validate every output before using it (schema, allowed values)
- Degrade gracefully: if the AI step fails, show search results or route to a human instead of an error page
Monitoring
Log every request, with care for personal data:
- Prompt version, model, input and output tokens, latency and cost
- Retrieved chunks (for RAG debugging)
- Errors, refusals and validation failures
- User feedback: thumbs up or down, edits, "report a wrong answer"
Watch dashboards for cost per day, p95 latency (the slow 5% of requests), error rate and feedback trends. Sample real conversations every week and read them; that's where you'll find the next improvement.
Safe changes
- Keep prompts versioned in code, not edited live
- Run your evaluation set before every release
- Roll out big changes to a small share of users first
- Keep the old version ready to switch back
In one line
Shipping an LLM app means streaming and caching for speed, routing and limits for cost, retries and validation for reliability, and logging plus evaluation so you can improve safely.
Share with a friend