Lesson 9 of 9 · 26m
Observability and Production Learning Loops
Trace requests end-to-end, review failures with privacy-aware telemetry, and turn production evidence into evals and product improvements.
You cannot improve what you cannot reconstruct. In LLM systems, the important question is rarely just "what answer did we return?" It is "what exact prompt, model, retrieval set, tool sequence, policy gate, latency, cost, and user correction produced this outcome?" Observability is how production becomes a learning loop instead of a rumor mill.
Trace the full decision path
A single user-visible answer may involve retrieval, reranking, prompt assembly, a model call, validation, and multiple tools. Use one trace ID across stages:
trace req_9f31
retrieval 182ms 18 candidates -> 4 chunks
rerank 91ms top=kb_1842:c3
prompt_assembly 12ms 3,842 input tokens
model 2.8s 811 output tokens
output_gate 8ms pass
total 3.1s $0.0041This shape immediately tells you whether latency came from retrieval, provider generation, validation, or your own orchestration.
Log structured events, not just transcripts
Transcripts are useful but hard to query and often privacy-sensitive. Structured events make trends visible:
{"event": "llm_response", "feature": "support_copilot", "model": "gpt-5-mini",
"prompt_version": "answerer/v8", "finish_reason": "stop", "input_tokens": 3842,
"output_tokens": 811, "retrieval_empty": false, "citations": 3,
"fallback": false, "trace_id": "req_9f31"}Separate content telemetry from operational telemetry. Often you need counts, hashes, labels, and latency more than raw customer text.
Capture user correction as ground truth
Thumbs-down buttons are weak signals unless you ask what kind of failure occurred. Add lightweight correction paths:
Was this wrong because:
[ ] information was incorrect
[ ] citation did not support it
[ ] it missed my account context
[ ] tone or format was wrong
[ ] it should have escalatedEdits are even better. If an agent rewrites the suggested response before sending it, the diff is training data for evaluation — not necessarily model training, but certainly product learning.
Turn incidents into fixtures
Every meaningful production failure should have a path into the regression suite:
observed failure -> sanitized repro -> expected behavior -> eval fixture -> release gateDo this especially for near-misses: unsupported citations, stale policy retrieval, tool loops, memory leakage, and cost spikes. The fixture should preserve enough context to reproduce the behavior without copying unnecessary personal data.
Dashboards need both quality and economics
Track product-level signals:
grounded answer rate by feature and corpus revision
escalation precision/recall by risk category
time to first useful token p50/p95 by route
cost per successful task by tenant and feature
fallback rate by provider error and output-gate reason
citation precision sampled human reviewRaw request count is not a success metric. A decrease in usage can mean the feature is untrusted; an increase can mean users are retrying because answers are poor. Pair usage with completion, correction, and escalation outcomes.
Privacy and retention are part of observability design
Decide what you may log, for how long, and who can inspect it. Redact credentials, tokens, payment data, and secrets before storage. Use sampling for full transcripts and aggregate-only reporting where possible. If enterprise customers prohibit content retention, honor that contract while preserving operational metadata. Observability that violates customer trust is a security incident wearing a dashboard.
Field notes
- Include prompt and corpus versions in every trace; otherwise rollbacks are archaeology.
- Provider request IDs matter when escalating vendor incidents.
- Human review queues should prioritize high-impact uncertainty, not random volume alone.
- Cost dashboards need tenant attribution before finance asks why one customer generated 40% of spend.
- The learning loop is complete only when fixtures, prompts, retrieval rules, or product copy actually change.
Was this lesson helpful?