Deploying a Large Language Model system into production is not a one-time event; it requires Continuous Observability and Automated Quality Evaluation.
Unlike traditional microservices where observability focuses purely on CPU, memory, and HTTP 500 error rates, AI observability must monitor non-deterministic output quality, token economics, latency waterfalls, and hallucination rates.
This lesson explores OpenTelemetry distributed tracing for LLMs and the RAG Triad evaluation framework (Ragas) for catching silent model degradation before it impacts end users.
1. The RAG Triad: Automated Quality Evaluation
In production RAG systems, measuring user satisfaction through basic thumbs-up/thumbs-down feedback is insufficient. The RAG Triad (introduced in the TruLens and Ragas evaluation frameworks) breaks down retrieval-augmented generation into three orthogonal, measurable quality dimensions:
The Three Core Metrics:
- Context Relevance (): Measures whether the retrieved document chunks contain only relevant information, penalizing noisy or irrelevant context.
- Groundedness / Faithfulness (): Measures whether every factual claim in the generated answer can be mathematically derived from the retrieved context. A groundedness score indicates active hallucinations.
- Answer Relevance (): Measures whether the model's response actually addresses the user's specific query without straying off-topic.
2. Python Implementation: Automated Ragas Evaluation Pipeline
The following Python script scores production RAG generation logs against the RAG Triad using LLM-as-a-Judge evaluators.
3. Production Failure Modes: Silent Model Degradation
Failure Mode: Prompt Update Improves Tone but Drops Groundedness by 35%
- Symptom: An engineering team updates the system prompt to make the AI assistant sound "more friendly, conversational, and enthusiastic". Two weeks later, customer complaints surge regarding fabricated billing policies.
- Root Cause: The conversational prompt instructed the model to be "helpful at all costs", causing it to invent answers when retrieved context was missing. Because traditional unit tests only checked for HTTP 200 responses, the regression went undetected.
- Resolution: Enforce automated CI/CD Eval Gates. Before any prompt, model, or chunking configuration is merged to production, run an automated evaluation over a 500-question gold-standard benchmark dataset. If the Groundedness score drops below , block the CI/CD deployment automatically.
4. Summary & Key Takeaways
- AI Observability Extends Beyond Infrastructure: Monitor latency waterfalls, token costs per tenant, and output factuality in real time.
- The RAG Triad Isolates Failures: Evaluate Context Relevance (retriever), Groundedness (hallucinations), and Answer Relevance (prompt adherence).
- OpenTelemetry Tracing Pinpoints Bottlenecks: Trace spans across embedding, vector search, reranking, TTFT prefill, and streaming decode phases.
- CI/CD Eval Gates Protect Production: Automate continuous evaluations to block prompt regressions before they reach end users.