Offline vs Online Evaluation — Cheat Sheet

Quick-reference · Release Gates · Production Risk · Signals · Logging · Sampling · Platform Config · Self-Improving Loop

1-PAGE REFERENCE

1Offline Evaluation

Def: eval before deployment, on a controlled golden dataset + predefined criteria.
DatasetAppEvaluatorScoreRelease?

2UPSC Grader Example

Golden dataset + LLM-as-Judge scores compared to human scores, before deployment → classic offline eval.

3Benefit: Release Gate

Threshold e.g. 95%. Score ≥ threshold → deploy. Below → block / keep old version. Automatable in CI/CD.

4Benefit: Version Comparison

Same dataset + same pipeline across versions → fair comparison.

ModelsPromptsRerankers Vector DBsArchitectures

5Benefit: Regression Testing

Improving one behavior shouldn't quietly break another.

Ex: kinder tone prompt → refund success drops 90%→80%.

6Regression Test Matrix

ChangeAlso Check
System promptPricing accuracy, relevance
LLM modelLatency, cost, safety
Vector DBAnswer quality, latency
RerankerFaithfulness, prior cases

7What Changes in Prod

  • Unexpected inputs — never in golden set
  • Emergent failures — visible only at scale
  • Drift — data/env changes over time

8Unexpected Input Examples

  • Hindi-English mixed msgs
  • Ambiguous/incomplete Qs
  • Angry msg w/ hidden question
  • Prompt-injection attempts
  • Unanticipated edge cases

9Emergent Failures

Course launch → thousands of concurrent users → latency spike never seen offline. Bias patterns visible only across thousands of convos.

10Drift

Real-world data/behavior/env changes; frozen eval set stops representing production.

Risk: stale golden dataset → good offline score, unhappy live users.

11Online Evaluation

Def: evaluates deployed system on live traffic, continuously — usually no fixed answer key.

Core Q: "Is it behaving normally right now?"

12Offline vs Online

OfflineOnline
WhenPre-deployPost-deploy, continuous
DataFixed golden setLive traffic
Answer keyUsually yesUsually no
Best forGate/compare/regressDrift/anomaly detect
CostCheap, repeatableCan get expensive

13Complementary, Not Rivals

Offline: Correctness+Online: Normality

Production-grade systems need both — online is not a replacement.

14Correctness vs Normality

CorrectnessOutput right vs a reference. Hard in prod — no per-case human label yet.
NormalityDoes behavior match healthy baseline?

15Distribution Shift Example

Scores usually 500–700. Week 5 suddenly 800–900 → not proof of error, but a trigger to investigate.

16Reference-Free Signals

  • Faithfulness — answer supported by context?
  • Thumbs-down spike — quality proxy, not proof

17Captured Signals

Already available — log directly.

Thumbs up/downLatencyTokens CostErrors

18Computed Signals

Need an evaluator.

FaithfulnessRelevanceCorrectness HallucinationToxicityBias

19Step 1 — Logging

Why first: no recorded conversations → nothing to evaluate later.
IdentityConv/turn/user/session ID, ts
InputUser message
RAGRetrieved context
OutputModel response
OpsLatency, tokens, cost
BehaviorFeedback, escalation

20Example Log Record

{
 "conversation_id": "conv_123",
 "latency_ms": 2030,
 "prompt_tokens": 850,
 "cost": 0.012,
 "status": "success",
 "feedback": "thumbs_down"
}

Platform example: LangSmith stores traces w/ inputs, outputs, metadata.

21Logging Properties

  • Non-blocking — async, no added latency
  • Durable & queryable — retrievable later
  • Late signal attach — via conversation ID
  • PII handling — mask sensitive data

22Dashboarding

Aggregates signals over windows (1h/24h/week). Aggregate trend > single conversation.

LogDashboardAlertAction

23Traffic Spike Example

Course launchLatency ↑Dashboard flagsScale resources

24Alerting

Automates threshold-violation detection since engineers can't watch dashboards 24/7.

SlackEmailPagerDuty-styleAPI

25Computed Eval: Hallucination

TraceSampleLLM JudgeScoreDashboardAlert

Judge inputs: question, context, answer, rubric.

26Reference-Based vs Free

Reference-BasedReference-Free
Known answer keyNo fixed answer for this case
Typical offline setupTypical online setup
UPSC vs human gradingAnswer supported by context?

27Cost Warning

Judge cost: running an LLM judge on every production conversation gets expensive fast → sample.

28Random Sampling

Randomly pick a subset. Simple, but risky conversations may be under-represented.

29Stratified Sampling

Sample more from high-risk categories, not uniformly.

Thumbs-downAbandonedEscalated Repeated QsFinancial topics
Rule: sample for information value, not convenience.

30Platform — LangSmith

Supports tracing, dashboards, alerts, datasets, offline experiments, online evaluators, judge templates.

PII LeakPrompt Inj.Toxicity BiasHallucinationCorrectnessAgent Eval

31Same Evaluator, Two Modes

On live traces→ Online
On dataset/experiment→ Offline

Evaluator type ≠ mode; the data it runs on decides the mode.

32Evaluator Config Steps

  1. Select application
  2. Select evaluator type
  3. Pick Judge LLM
  4. Configure model/API
  5. Define rubric
  6. Set output format
  7. Run on traces or dataset

33Self-Improving Loop

DatasetOffline EvalReleaseProdMonitorFailureDataset Update

Real failures get annotated & folded back → next release tested against real + historical cases.

34Final Mental Model

BuildEvalReleaseObserveDetectLearnUpdateRe-eval

35Cheat Table

OfflinePre-deploy, controlled, gate/compare/regress
OnlinePost-deploy, live, drift/anomaly detect
DriftEnv/data changed vs frozen eval set
CapturedLogged directly (latency, cost…)
ComputedNeeds evaluator (hallucination…)
CorrectnessRight vs reference
NormalityMatches healthy baseline
Stratified samplingOversample high-risk convos
Self-improving loopProd failures → dataset → better releases