1. Where We Are in the LLM Evaluation Playlist
The first few lectures focused on the fundamentals of LLM evaluation and why evaluation is necessary for LLM-based systems.
Reference-Based Eval
Evaluation where a reference or expected answer is available.
Reference-Free Eval
Evaluation where a reference answer is not necessarily required.
Online vs Offline
Offline evaluation happens before deployment; online evaluation continues after deployment.
The Two Major Types of LLM Evaluation
Model Evaluation
Evaluates the underlying LLM/model itself.
Application Evaluation
Evaluates an LLM-powered application. This becomes the major focus from this point onward.
Model Evaluation Covered So Far
- Standardized evaluations / benchmarks: standardized tests used to evaluate model capabilities.
- Custom model evaluations: evaluations created using your own dataset, especially when selecting a model for a particular application.
2. Types of LLM-Based Applications
LLM applications can take many forms. The lecture highlights several examples:
General Chatbot
A normal conversational application without RAG or agent functionality.
RAG Chatbot
A chatbot that retrieves relevant information from an external knowledge base before generating an answer.
Agents
LLM-based systems capable of performing more complex workflows and actions.
Multimodal Apps
Applications that work with modalities beyond text, such as image generation.
Fixed-Schema Output
Applications where the LLM produces output following a predefined schema, such as email classification.
Image-Based Applications
Applications in which images are an important input or output modality.
3. Case Study — Campus X Doubt Solver
Build a RAG chatbot for the LLM course
The course contains lectures, and each lecture has a transcript. These transcripts become the knowledge documents for the chatbot.
A student can ask questions or doubts about the LLM course, and the chatbot should answer using the available lecture transcripts.
4. Complete RAG Evaluation Framework
The central idea is that an LLM application should not be evaluated with one single test. It needs an evaluation suite covering multiple perspectives.
Level 1
Component Level
Evaluate individual RAG components such as the retriever and generator.
Level 2
Pipeline Level
Evaluate the complete RAG pipeline after retriever and generator are connected.
Level 3
Application/System Level
Evaluate the complete user-facing application.
Overall Development + Evaluation Flow
5. Component-Level Evaluation
Retriever
The retriever is responsible for finding relevant documents/chunks from the vector database for a user query.
Basic Retriever Flow
- Load documents.
- Chunk the documents.
- Convert chunks into vectors using an embedding model.
- Store the vectors in a vector database.
- Receive a new user query.
- Retrieve the most relevant documents/chunks.
Retriever Metrics
| Metric | What it asks |
|---|---|
| Recall | Out of all the relevant/correct documents that should have been retrieved, how many did the retriever actually retrieve? |
| Precision | Out of all the documents retrieved, how many were actually useful/relevant? |
Generator
The generator is the LLM that receives a question and relevant context and produces an answer.
At this stage, the generator is evaluated in isolation. It is not yet connected to the retriever.
Generator Metrics
| Metric | What it checks |
|---|---|
| Faithfulness | Whether the generated answer is supported by the supplied context rather than containing unsupported hallucinated information. |
| Answer Relevance | Whether the generated answer is relevant to the user's question. |
| Citation Accuracy | Whether the citations/references provided by the application correctly point to the source information. |
6. Pipeline-Level Evaluation — The RAG Triad
After the retriever and generator have independently passed their evaluations, they are connected to create the RAG pipeline.
The Three RAG Triad Metrics
| Pair | Metric | Purpose |
|---|---|---|
| Question + Context | Context Relevance | Checks whether the retrieved context is relevant to the question. |
| Context + Answer | Faithfulness | Checks whether the generated answer is grounded in the retrieved context or contains hallucination. |
| Question + Answer | Answer Relevance | Checks whether the generated answer is relevant to the original question. |
7. Application-Level Evaluation
Once the pipeline works, evaluate the complete Campus X Doubt Solver as a user-facing application.
Correctness
Is the answer actually correct?
Completeness
Does the answer address every part of the user's question? A response can be partially correct but still incomplete.
Style
Does the response style match the desired Campus X teaching/explanation style?
Safety Evaluation
Toxicity
Does the response contain toxic or inappropriate content?
PII Leakage
Does the application expose personally identifiable information?
Jailbreak Resistance
Can the chatbot be manipulated into violating intended behavior?
Operational Evaluation
Latency
How long does the application take to answer?
Cost per Query
How much does each interaction cost?
Token Usage
How many tokens are being consumed?
8. What Is an Eval Suite?
An Eval Suite is the complete collection of evaluations used to test the application from multiple perspectives.
For the RAG chatbot, it includes component, pipeline, application, safety, and operational evaluations.
Conceptual Project Structure
rag-project/
│
├── src/
│ ├── retriever.py
│ ├── generator.py
│ ├── rag_pipeline.py
│ ├── api.py
│ └── ui.py
│
├── evals/
│ ├── eval_retriever.py
│ ├── eval_generator.py
│ ├── eval_rag_pipeline.py
│ ├── eval_application.py
│ ├── eval_safety.py
│ └── eval_operations.py
│
└── run_evals.py
Role of run_evals.py
The idea is to have one entry point that triggers the different evaluation files and produces an overall report.
This makes the complete evaluation suite repeatable and useful for regression testing.
9. DeepEval — Evaluation Library
Instead of writing all evaluation logic from scratch, the lecture chooses DeepEval as the primary evaluation library for the practical RAG evaluation work.
Many of the required metrics are already available, including RAG and safety-related metrics.
RAG Metrics
Answer relevance, faithfulness, contextual precision, contextual recall, contextual relevance, and related evaluation capabilities.
Safety
Toxicity, PII leakage, and other safety-oriented evaluations.
Broader Scope
The lecture highlights use cases beyond RAG, including agents, multi-turn chatbots, non-LLM applications, and image-based applications.
- Ragas has already been covered in the advanced RAG course.
- DeepEval is presented as a broader evaluation library with a wider scope.
- Its syntax is based around Pytest, making it familiar to people who have worked with Python software testing.
10. Regression Testing
After building the evaluation suite, the next important step is regression testing.
The idea is simple: run the complete evaluation suite on a new version of the application and compare the results with a previous/baseline version.
Version 1
Baseline configuration + baseline evaluation metrics.
Version 2
New configuration + new evaluation metrics.
What Regression Testing Answers
- Did the new retriever become better or worse?
- Did the new generator improve?
- Did any important quality metric decline?
- Is the new software version objectively better than the previous version?
- Should the new version be deployed?
Three Levels of Regression Testing Discussed
Level 1 — Simple
Run the eval suite and manually compare new results with the baseline.
Level 2 — Experiment Tracking
Log configurations and metrics for repeated experiments and compare them visually.
Level 3 — CI/CD
Automatically run evaluations after code changes and gate deployment based on thresholds.
Experiment Tracking Example
Suppose the first run uses a particular chunk size, overlap, temperature, and embedding configuration.
The evaluation produces values such as:
| Metric | Example Baseline |
|---|---|
| Retriever Recall | 82 |
| Retriever Precision | 68 |
| Other Eval Metrics | Logged for comparison |
Then you change chunking size or overlap and run the suite again. The new results are logged and compared with the baseline.
Experiment Tracking Tools Mentioned
The lecture mentions tools such as MLflow, Confident AI, and Weights & Biases as possible options.
CI/CD Gating
- A developer changes code or configuration.
- The change is pushed to the repository.
- A CI system such as GitHub Actions triggers the evaluation suite.
- New metrics are compared with the baseline.
- A threshold can be defined — for example, a metric should not drop by more than an allowed amount.
- If the new version passes, deployment is allowed.
- If the new version regresses beyond the threshold, deployment is stopped.
11. Online Evaluation After Deployment
Evaluation does not stop when the application is deployed. Once the chatbot is live, the system should continue to be monitored and evaluated.
Observability / Tracing
The lecture mentions tools such as LangSmith, Langfuse, and Confident AI for tracing and observability.
Tracing code can capture live interaction data such as:
Latency
How long the response took.
Cost
Cost associated with the interaction.
Tokens
Token consumption.
User Feedback
Thumbs up / thumbs down signals.
Traces
Information about the execution path of the application.
Dashboard
Visualize captured production signals.
Online Quality Evaluation
Some metrics that were evaluated offline can also be evaluated on live traffic, including:
- Faithfulness
- Answer relevance
- Correctness / quality-related signals
Drift Detection
Drift means that application performance changes or degrades over time.
For example, suppose a dashboard tracks faithfulness over the previous 24 hours. If faithfulness suddenly drops during the last several hours, that may indicate a drift event that should trigger investigation and corrective action.
Self-Improving Evaluation Loop
12. Roadmap for the Next Four Sessions
Build the retriever, evaluate it, build the generator, evaluate it, and introduce DeepEval in practice.
Connect retriever and generator, create the RAG pipeline, and evaluate context relevance, faithfulness, and answer relevance.
Run the complete application evaluation, including quality-oriented metrics and broader application checks.
Cover regression testing and the post-deployment online evaluation/observability process.
13. Interview Master Answer — “How Do You Evaluate Your RAG Chatbot?”
Step-by-Step Interview Structure
- Build an Eval Suite. Explain that evaluation happens at multiple levels.
- Component level: evaluate the retriever using Recall and Precision.
- Generator level: evaluate Faithfulness, Answer Relevance, and Citation Accuracy.
- Pipeline level: evaluate the RAG Triad — Context Relevance, Faithfulness, and Answer Relevance.
- Application level: evaluate Correctness, Completeness, and Style.
- Safety: evaluate Toxicity, PII Leakage, Jailbreak Resistance, and other applicable safety checks.
- Operations: monitor Latency, Cost per Query, and Token Usage.
- Regression testing: run the complete eval suite whenever a new version/configuration is created and compare it with a baseline.
- Automation: use experiment tracking and, where appropriate, CI/CD gates to prevent unacceptable regressions from being deployed.
- Deployment: deploy only after the new version passes the required evaluation criteria.
- Online evaluation: monitor live traces, latency, cost, tokens, user feedback, quality metrics, and drift after deployment.
- Continuous improvement: collect production failures and add useful examples back into the offline/golden evaluation dataset.
14. One-Page Revision Sheet
| Stage | What is evaluated? | Key Metrics / Concepts |
|---|---|---|
| Component — Retriever | Quality of retrieved documents | Recall, Precision |
| Component — Generator | LLM generation in isolation | Faithfulness, Answer Relevance, Citation Accuracy |
| Pipeline | Retriever + Generator together | RAG Triad: Context Relevance, Faithfulness, Answer Relevance |
| Application — Quality | User-facing response quality | Correctness, Completeness, Style |
| Application — Safety | Safe behavior | Toxicity, PII Leakage, Jailbreak Resistance |
| Operations | Production efficiency | Latency, Cost, Tokens |
| Regression | New version vs baseline | Baseline comparison, experiment tracking, CI/CD gates |
| Online Evaluation | Live production behavior | Tracing, feedback, quality metrics, drift |
| Continuous Improvement | Learn from failures | Production failures → offline/golden dataset |
15. Mental Model
16. Quick Self-Check
17. Key Takeaways
- RAG evaluation is a framework, not a list of three or four metrics.
- Evaluation should happen continuously during development, not only after the entire application is finished.
- The three major levels are Component → Pipeline → Application/System.
- Retriever evaluation focuses on retrieval quality; generator evaluation focuses on grounded and relevant generation.
- The RAG Triad connects question, context, and answer through Context Relevance, Faithfulness, and Answer Relevance.
- Application evaluation expands beyond RAG quality into correctness, completeness, style, safety, and operations.
- An Eval Suite collects these tests into one repeatable testing framework.
- Regression testing compares new application versions against a baseline.
- Experiment tracking and CI/CD can automate regression detection and deployment gating.
- Evaluation continues after deployment through online evaluation, tracing, observability, drift detection, and user feedback.
- Production failures can feed back into the offline/golden dataset, creating a self-improving evaluation loop.