Method note: the LLM-as-judge method and the tracing standard are cited to their sources. I studied the applied framework in the DeepLearning.AI RAG course; nothing proprietary is reproduced. The diagram is my own.
Context
A retrieval system is a chain: rewrite the query, search, rerank, build a prompt, generate. When the output gets worse, “it feels off” tells you nothing about which link broke. The two disciplines that turn a vague complaint into a fix are evaluation, which tells you what is wrong, and observability, which tells you where and why.
The concept
Evaluation works at two scopes. System evaluation looks end to end and shows what problems exist. Component evaluation looks at each part and shows where and why. You also have three kinds of check, and they are complementary. Code-based checks measure the objective things: latency, token usage, whether a citation points to a real chunk. An LLM-as-judge grades the fuzzy things a rule cannot, like whether the answer is faithful to the context, and it is more reliable asking for a label than a numeric score (Zheng et al., 2023). Human feedback, even a thumbs up or down, anchors the whole thing to what people actually want.
| Code-based | LLM-as-judge | Human feedback | |
|---|---|---|---|
| Component | Retriever latency | Context quality | Is this chunk relevant? |
| System | Token usage | Citation accuracy | Thumbs up / down |
One rule saves a lot of pain: write your ground-truth set, thirty to fifty real questions with known good answers, before you build, so every change is measured against a fixed target instead of a moving vibe.
Observability is how you see inside a single request. A trace follows one query through the whole pipeline. Within it, each operation is a span with a start, an end and attributes, so you can read exactly how long the retriever, the reranker and the model each took, and what each returned. OpenTelemetry is the common standard for emitting these traces. When something breaks, the trace shows the failing step directly, which beats guessing or running an A/B test to answer a question a single log would have answered.
That last point is a common surprise. Across a RAG pipeline the generation step dominates total time, well over the retrieval and database work. So the highest-leverage latency fixes are usually about the model: a smaller or quantized model, or a router that skips unnecessary steps, not squeezing the already-fast search.
Where this connects
- Data science. This is experiment discipline applied to systems that are hard to score. A fixed evaluation set, a mix of automatic and human judgment, and traces to localize failures is the same loop as any rigorous ML evaluation, just adapted to outputs a single metric cannot capture. The transferable habit is refusing to ship on vibes.
- Clinical AI. For anything that answers over clinical evidence, evaluation is not optional and it is not one number. Faithfulness and citation validity get their own thresholds, a human clinician reviews on a schedule, and traces make each answer auditable after the fact. The same measure-before-you-scale rule that protects a research pipeline protects a patient-facing one.
Nota de método: el método de LLM-as-judge y el estándar de tracing están citados a sus fuentes. Estudié el marco aplicado en el curso de RAG de DeepLearning.AI; no se reproduce nada propietario. El diagrama es propio.
Contexto
Un sistema de recuperación es una cadena: reescribir la consulta, buscar, reordenar, armar un prompt, generar. Cuando la salida empeora, “se siente raro” no te dice nada sobre qué eslabón se rompió. Las dos disciplinas que convierten una queja vaga en un arreglo son la evaluación, que te dice qué está mal, y la observabilidad, que te dice dónde y por qué.
El concepto
La evaluación trabaja en dos alcances. La evaluación de sistema mira de punta a punta y muestra qué problemas existen. La de componente mira cada parte y muestra dónde y por qué. También tienes tres tipos de chequeo, y son complementarios. Los chequeos de código miden lo objetivo: latencia, uso de tokens, si una cita apunta a un chunk real. Un LLM-as-judge califica lo difuso que una regla no puede, como si la respuesta es fiel al contexto, y es más confiable pidiéndole una etiqueta que un score numérico (Zheng et al., 2023). El feedback humano, aunque sea un pulgar arriba o abajo, ancla todo a lo que la gente de verdad quiere.
| De código | LLM-as-judge | Feedback humano | |
|---|---|---|---|
| Componente | Latencia del retriever | Calidad del contexto | ¿Este chunk es relevante? |
| Sistema | Uso de tokens | Exactitud de citas | Pulgar arriba / abajo |
Una regla ahorra mucho dolor: escribe tu conjunto de ground truth, treinta a cincuenta preguntas reales con respuestas buenas conocidas, antes de construir, para que cada cambio se mida contra un objetivo fijo en vez de una sensación cambiante.
La observabilidad es cómo ves dentro de una sola petición. Una traza sigue una consulta por todo el pipeline. Dentro, cada operación es un span con inicio, fin y atributos, así que puedes leer exactamente cuánto tardaron el retriever, el reranker y el modelo, y qué devolvió cada uno. OpenTelemetry es el estándar común para emitir estas trazas. Cuando algo se rompe, la traza muestra el paso que falla directamente, lo que le gana a adivinar o correr un A/B test para responder una pregunta que un solo log habría respondido.
Ese último punto sorprende seguido. En un pipeline de RAG el paso de generación domina el tiempo total, muy por encima del trabajo de recuperación y base de datos. Así que los arreglos de latencia de mayor palanca suelen ser sobre el modelo: uno más pequeño o cuantizado, o un router que salta pasos innecesarios, no exprimir la búsqueda que ya es rápida.
Dónde conecta
- Data science. Esto es disciplina de experimentación aplicada a sistemas difíciles de puntuar. Un conjunto de evaluación fijo, una mezcla de juicio automático y humano, y trazas para localizar fallos es el mismo bucle de cualquier evaluación rigurosa de ML, solo adaptado a salidas que una sola métrica no captura. El hábito transferible es negarse a lanzar por sensación.
- Clinical AI. Para cualquier cosa que responde sobre evidencia clínica, la evaluación no es opcional y no es un solo número. La faithfulness y la validez de citas tienen sus propios umbrales, un clínico humano revisa con calendario, y las trazas hacen cada respuesta auditable después. La misma regla de medir-antes-de-escalar que protege un pipeline de investigación protege uno de cara al paciente.