The Confidence Checklist for LLMs in Production

Rohit Agarwal, portkey.ai32:34 · Aug 2023 · 839 views
Thumbnail for The Confidence Checklist for LLMs in Production Watch on YouTube
TL;DR
  1. 1

    Output validation catches malformed, empty, irrelevant, and unsupported answers before they reach users.

  2. 2

    Rate limits, fingerprinting, quotas, and traffic controls protect both user experience and inference costs.

  3. 3

    Production LLM systems need telemetry, resilience features, privacy controls, and human feedback alongside the model itself.

Summary

Rohit Agarwal presents six production practices based on his experience with large LLM deployments: validate outputs, prepare for abusive traffic, control user limits, reduce perceived latency, build suitable logging and monitoring, and protect private data. He recommends simple checks first, such as validating JSON, rejecting empty responses, adding retries, using CAPTCHA, debouncing requests, streaming tokens, and masking personally identifiable information. More advanced systems can rank results, use closed-domain prompts, apply model-based checks, fingerprint abusive users, cache semantically similar queries, fall back between providers, and build custom monitoring for probabilistic outputs. He frames production readiness around reliability, accuracy, and cost. The model is only the compute layer, so teams still need the surrounding product and operational systems. His advice is practical and candid about the gap between a working proof of concept and a dependable production application.

Key ideas
03:19

Output validation prevents acceptable-looking failures from reaching users

Rohit says teams often rush code into production after testing prompts against a narrow set of cases. A system can work well in development while a significant group of production users receives poor answers, which can lead to churn. His basic checks include rejecting empty strings, enforcing character or word lengths, and validating formats such as JSON or generated code. He recommends Guardrails for this layer. More advanced checks assess relevance to the user query and rank multiple results, which is especially useful in retrieval-augmented generation. For higher confidence, he recommends answering within a closed domain and telling the model to use only the supplied context. He also suggests asking another model, or the same model, whether an answer is correct.

07:47

Traffic controls stop popularity and abuse from becoming unexpected model bills

A production LLM application can remain online during a denial-of-service attack while sending hundreds of thousands of requests to an upstream provider. That can make token costs grow rapidly. Rohit recommends adding CAPTCHA for simple attacks, then applying rate limits across users and organizations. Limits can be part of pricing plans or internal quotas. He also describes IP monitoring and fingerprinting to detect people who create malicious accounts. Teams should track language usage because short words in some languages can consume many tokens. He recalls a period when his OpenAI bill was six times his AWS bill, and uses that experience to argue for cost monitoring and user limits.

11:38

Trust-based quotas give new and abusive users different access

Rohit recommends starting users with lower limits and increasing them as they build trust. New users can stay in an untrusted or quarantined bucket for their first seven days, then move into a trusted bucket after meeting usage or concurrency conditions. Paid customers or approved organizations can receive higher limits. He also describes dynamic rate limiting, where the system decreases access for users who appear to abuse it. A credits or karma model can increase or decrease a user's allowance based on observed usage. On the client side, simple debouncing prevents repeated clicks on a generate button from creating unnecessary requests. ChatGPT's restriction on sending another message before a response completes is an example of this idea.

25:26

Perceived latency matters even when inference time cannot be removed

Rohit says users have become accustomed to fast software, while LLM inference can take many seconds. Streaming is the simplest way to reduce perceived waiting time: the application can show tokens as they arrive instead of leaving users with a loading indicator. He suggests tracking time to first token as a user-experience metric. Streaming also introduces failure cases, including broken streams, incomplete chunks, and multiple data objects arriving together, so teams need to test it carefully. He recommends exponential backoff and random jitter for provider rate limits. Semantic caching can return answers for identical or similar queries, which is particularly useful for document or data chat. Provider fallbacks and queues offer further control.

22:37

LLM monitoring must capture quality as well as API success

Standard logging systems are often designed for structured data and small strings, while LLM applications produce large prompts and outputs. They can become expensive or slow when asked to index this data. API success is also an incomplete signal. An API may return successfully even when the answer is inaccurate, partially accurate, or completely wrong. Rohit says teams may begin with limited visibility or use a service such as Datadog or CloudWatch. Larger applications may build a monitoring layer around systems such as Elastic and Kibana, store evaluation results, and display them in Grafana. The monitoring layer needs to track latency, cost, tokens, and the quality of probabilistic outputs.

25:44

Privacy controls belong in the product before compliance problems appear

Private data may pass through several applications and an external API provider, so Rohit recommends addressing privacy early. He names GDPR and CCPA as examples of compliance obligations and says the consequences of ignoring them can be severe. At minimum, teams should update their privacy policy and explain where data goes and whether a data processing agreement exists. They can then mask personally identifiable information before sending requests to other systems. For medical or financial applications, he recommends Microsoft's Presidio or Azure services when the system must identify and protect PII with greater accuracy. The basic choice of ignoring privacy is presented as unacceptable, even when a team is trying to get a product off the ground.

28:01

Production readiness requires systems around the foundation model

Rohit groups the production problem into reliability, accuracy, and cost. Reliability includes stable APIs, retries, fallbacks, and better response times. Accuracy can improve through relevant and moderated generations, better prompts, evaluations, fine-tuning, or eventually building a model. Cost requires watching inference spend and moving to smaller, cheaper models when quality allows. He says telemetry is necessary because teams cannot fix problems they do not know about, although LLM telemetry needs different treatment from ordinary application metrics. Human feedback should be collected early to improve the data and outputs. A foundation model is only the compute layer, similar to a server, so the product still needs its own operational and user-facing systems.

"Time to first token is actually maybe a second which is the kind of experience people are really used to."17:47
Who should watch
  • You are moving an LLM proof of concept into a customer-facing application and need a practical list of failure modes to address.
  • Your application calls model APIs at meaningful volume and you need to control traffic, latency, provider outages, and inference costs.
  • You handle user documents or regulated data and need concrete starting points for monitoring and PII masking.