Sub topic 12
Offline Evaluation Versus Online Monitoring
The two views of AI quality
Assume you understand basic product requirements, user stories, and short Python and JSON snippets. This chapter uses an AI feature that answers customer questions from a help center.
Offline evaluation tests a fixed set of inputs before a change reaches users. Online monitoring observes the feature while real users are using it. You need both because each answers a different question:
- Offline evaluation asks, “Does this version behave acceptably on known cases?”
- Online monitoring asks, “Does the feature continue to behave acceptably in production?”
An offline set can reveal that a new prompt gives incorrect refund deadlines. Online monitoring can reveal that users now ask about a newly launched product that the set does not contain.
| View | Main purpose | Typical evidence | Main limitation |
|---|---|---|---|
| Offline evaluation | Compare versions before release | Pass rates, failure cases, judge scores | It cannot represent every future input |
| Online monitoring | Detect production problems and change | Feedback, latency, escalation rate, sampled reviews | Production signals can be noisy or delayed |
Build a loop between them
Offline evaluation usually runs during development, continuous integration, and release review. Run the same cases against the current version and a candidate version. Compare quality dimensions such as groundedness, correctness, refusal behavior, and latency.
Online monitoring begins when the feature is available to users. Collect signals that are appropriate for the product and privacy rules:
- User feedback such as helpful or unhelpful ratings.
- Escalation, retry, and abandonment rates.
- Retrieval failures, empty answers, and safety-policy matches.
- Latency, token use, and error rates.
- Human review of a carefully sampled set of conversations.
The online signals should influence the offline set. If production reviewers find a new failure, remove sensitive data, label the case, assign its severity, and add a safe version to the evaluation dataset. The next release then tests against a problem that previously escaped detection.
flowchart LR
A[Offline evaluation set] --> B[Release decision]
B --> C[Production traffic]
C --> D[Online metrics and sampled reviews]
D --> E[New labeled failure cases]
E --> Acaption: The evaluation loop connects pre-release tests with production evidence. alt: A flowchart from an offline evaluation set to a release decision, production traffic, online metrics and reviews, new labeled failures, and back to the offline set.
Detect drift and separate signal from noise
Drift is a change in the data, users, or environment that can make an earlier evaluation less representative. For example, a support assistant may see a different mix of languages after an international launch. A policy update may also make previously correct answers stale.
Track the production distribution when it is safe to do so. Useful comparisons include the percentage of requests by category, language, product, and risk level. A sudden change does not prove quality has fallen. It tells you where to investigate and which cases to add.
Do not treat every online metric as a direct quality score. A helpfulness rating may be biased because frustrated users are more likely to respond. A lower escalation rate could mean better answers, or it could mean users gave up. Combine several signals with sampled review and known critical checks.
Use release and operational thresholds
Offline thresholds decide whether a candidate can ship. Online thresholds decide whether the running feature needs investigation or rollback. Keep these decisions explicit.
def online_alert(metrics):
alerts = []
if metrics["critical_error_rate"] > 0:
alerts.append("critical errors detected")
if metrics["groundedness_rate"] < 0.95:
alerts.append("groundedness below target")
if metrics["p95_latency_seconds"] > 4.0:
alerts.append("latency above target")
return alerts
current = {
"critical_error_rate": 0.0,
"groundedness_rate": 0.93,
"p95_latency_seconds": 3.2,
}
print(online_alert(current))A zero-tolerance rule for a critical error may require immediate investigation. A small change in a noncritical metric may require only a larger sample or human review. Define the time window and sample size for each threshold so that a single unusual request does not trigger an unnecessary rollback.
Exercise
Exercise
Production review finds an unsupported answer about a newly changed return policy. What should you do?
Show answer
Redact sensitive data, label the failure and its severity, add a representative case to the offline evaluation set, investigate the live impact, and rerun the release checks before the next change.