LLM Evaluation
Module 7 / 17
07 / 17
Building an Evaluation Practice

LLM Evaluation Notes (Transcript Chunk 2)


English Translation

Let's summarize what we have covered so far.

First, we discussed why we are studying LLM evaluations.

Then we discussed what LLM evaluations are and their two types:

So by now, the Why and What should be clear.

Next, we move to How LLM evaluations are actually performed.

The speaker clarifies that the explanation will be from the Application Evaluation perspective, not the Model Evaluation perspective, because that is the primary focus of the course.

The next topic is the workflow of application evaluation for an LLM-based application.


Detailed Notes

LLM Application Evaluation Workflow

The speaker explains a complete workflow for evaluating an LLM application using a simple example.


Example Application

Assume we are engineers working for Zomato.

The company receives a large number of customer emails every day.

Instead of manually reading each email and forwarding it to the correct team, they want to automate this process.

The system should classify each email into one of three categories:

After classification:

```text id="n2m8a1" Customer Email │ ▼ LLM │ ▼ Classification │ ┌─────┼─────┐ │ │ │ ▼ ▼ ▼ Billing Technical General


The LLM receives an email, reads its content, and decides which team should handle it.

---

# Before Deployment

The speaker emphasizes:

The system **should not be deployed immediately**.

It must first be evaluated.

---

# Application Evaluation Workflow

---

## Step 1: Define the Task and Target

The first step is to define:

* What is being evaluated?
* What task is being evaluated?

For this example:

Target:

* The email classification system.

Task:

* Determine whether the system correctly classifies emails.

---

## Step 2: Define Success Criteria

Next, define how success will be measured.

For this use case:

Task:

Classification.

Metric:

Accuracy.

Example:

If the system correctly routes:

* 90 out of 100 emails

then

Accuracy = 90%.

---

## Step 3: Build a Dataset

Prepare a dataset for evaluation.

Example:

| Email                        | Correct Label |
| ---------------------------- | ------------- |
| My card was charged twice    | Billing       |
| The app crashes on login     | Technical     |
| What are your working hours? | General       |

The speaker mentions:

* Real company data should preferably be used.
* Past customer chats or emails should be collected.
* Labels should be assigned manually.

Typically, the dataset contains:

* 50 to 500 examples.

The speaker calls this dataset a:

**Golden Dataset**

---

## Step 4: Define the Evaluation Method

Next, decide **who or what will perform the evaluation**.

The speaker mentions three options.

### Option 1

Automated evaluation.

---

### Option 2

Human evaluation.

---

### Option 3

LLM-based evaluation.

---

# Automated Evaluation Example

The Golden Dataset is passed through the classification system.

Suppose the system predicts:

| Email                     | Expected  | Predicted |
| ------------------------- | --------- | --------- |
| My card was charged twice | Billing   | Billing   |
| App crashes               | Technical | General   |
| Working hours             | General   | General   |

A Python program compares:

Expected Label

vs.

Predicted Label

and calculates the accuracy score.

For this classification problem, automated evaluation is sufficient.

---

# When LLM Evaluation is Needed

The speaker gives another example.

Suppose the application is a chatbot.

Instead of simple labels, both outputs are long paragraphs.

Example:

Expected Answer

↓

Long paragraph

Generated Answer

↓

Long paragraph

Comparing two paragraphs using simple code is difficult because their meanings may be similar even if the wording is different.

Possible approaches:

* Human evaluator
* Another LLM

---

# Summary of Evaluation Methods

Evaluation can be performed by:

* Automated programs
* Humans
* Another LLM

---

# Step 5: Run the Model

Run the evaluation dataset through the application.

```text id="l8r4qz"
Golden Dataset
        │
        ▼
LLM Application
        │
        ▼
Generated Outputs

Step 6: Evaluate the Results

Compare the generated outputs with the expected outputs.

Example:

Accuracy = 80%.

Suppose:

100 test samples

80 classified correctly

20 classified incorrectly.


Step 7: Analyze the Results

After evaluation, identify why mistakes occurred.

Possible improvement areas mentioned by the speaker:

Improve the System Prompt

The prompt may confuse:

queries.


Change the Model

The selected LLM may not be capable enough.

A better model may improve performance.


The speaker emphasizes that the purpose of this step is to analyze why the system is making mistakes.


Step 8: Improve the System

Based on the analysis:

Improve the system.

Possible improvements:


Step 9: Repeat the Evaluation

The same Golden Dataset is reused.

Example:

Iteration 1

Accuracy = 80%.

Prompt improved.

Accuracy = 90%.

Model changed.

Accuracy = 95%.

This demonstrates why LLM evaluations are repeatable.

The same evaluation dataset is reused after every system modification.


Step 10: Deploy

Once the performance is satisfactory:

Deploy the system.


Step 11: Monitor

Deployment is not the end.

The deployed application must be continuously monitored.

Reason:

Real users may produce inputs that were not present in the Golden Dataset.


Step 12: Update the Golden Dataset

Suppose:

A customer sends a billing email.

The model incorrectly classifies it as a technical issue.

The technical team identifies the mistake.

That email should then be added to the Golden Dataset.

The evaluation cycle starts again.


Continuous Evaluation Loop

text id="q7x1mn" Define Task │ ▼ Define Success Criteria │ ▼ Build Golden Dataset │ ▼ Choose Evaluation Method │ ▼ Run Model │ ▼ Evaluate Results │ ▼ Analyze Errors │ ▼ Improve System │ ▼ Run Evaluation Again │ ▼ Deploy │ ▼ Monitor Production │ ▼ Collect Production Failures │ ▼ Add to Golden Dataset │ └──────────────► Repeat


Production Monitoring

The speaker explains that production failures become new evaluation examples.

Workflow:

Production Failure

Add it to the Golden Dataset.

Run the evaluation again.

Over time:

The Golden Dataset becomes richer.

The system continues improving.


Multiple Evaluations for One Application

The speaker highlights an important point.

A single LLM application may have multiple evaluations.

Example: RAG Application

Different evaluations can be created for:

Therefore:

One application does not necessarily have only one evaluation.

It usually has multiple evaluations focusing on different components or aspects of the system.


Key Points


Summary

The speaker presents the complete Application Evaluation Workflow:

  1. Define the task and target.
  2. Define success criteria.
  3. Build a Golden Dataset.
  4. Choose an evaluation method.
  5. Run the application.
  6. Evaluate the results.
  7. Analyze failures.
  8. Improve the system.
  9. Repeat the evaluation.
  10. Deploy.
  11. Monitor production.
  12. Add production failures back into the Golden Dataset and continue improving the system.

The speaker concludes by emphasizing that one LLM application may require several different evaluations, each focusing on different components or performance aspects.