ASAmol Shukla
Projects
Courses
Prompts
Skills
Contact
Resume
Course Outline
Syllabus Overview

AI Tools: LLM & Prompt Engineering Mastery

Courses/AI Tools: LLM & Prompt Engineering Mastery/Lesson 15: Evaluating LLM Systems
60 mins lesson duration•11 mins read

Lesson 15: Evaluating LLM Systems

Benchmarks, metrics, and LLM-as-judge — how to measure quality, catch regressions, and know when your AI is good enough.

Why Evaluation Matters

"Does it work?" is the hardest question in AI tooling. Without evaluation, you cannot compare models, prompts, or RAG configs — you're guessing. Evaluation turns AI development from vibes into engineering.

The Evaluation Pyramid

Level Question Tools
Capability What can this model do? Public benchmarks
Task Does it do MY task well? Custom eval sets
System Does the whole pipeline work? End-to-end evals + metrics
Production Is it good enough to ship? Human review, monitoring

Public Benchmarks

Benchmark What It Measures
MMLU Knowledge across 57 subjects
HumanEval / MBPP Code generation correctness
GSM8K Grade-school math reasoning
GPQA Graduate-level science reasoning
HELM / LMSYS leaderboards Aggregate comparisons

Use these to pick a model — but they don't tell you how it performs on your data.

Metrics for Your Own Eval Sets

  • Accuracy: % of exact-correct answers (classification, extraction).
  • Faithfulness / groundedness: is the answer supported by the source? (RAG)
  • ROUGE / BLEU: n-gram overlap with a reference answer (summarization).
  • Perplexity: how well the model predicts text (pre-training quality).
  • Latency & cost per task: speed and price are quality too.

LLM-as-a-Judge

A strong LLM grades your model's outputs using a rubric. Cheap, fast, scalable — and surprisingly reliable for structured judgments.

SYSTEM: You are an evaluator. Score the ASSISTANT answer 1-5 on:
correctness, completeness, and grounding. Return JSON: {"score": n, "reason": "..."}

USER: QUESTION: ...
REFERENCE: ...
ASSISTANT: ...

Caveats: judges have biases (favor longer, prettier answers; prefer their own style). Calibrate against human scores on a sample before trusting them.

The Eval Loop (Do This Every Change)

  1. Curate 30–100 real tasks with expected answers (golden set).
  2. Run the baseline, record scores.
  3. Change something (prompt, model, chunk size, temperature).
  4. Re-run the same set, compare scores.
  5. Ship only if it improves — and keep the set forever (regression tests).

A Starter Eval Checklist

  • Golden set of 30+ realistic tasks with expected answers
  • Deterministic runs (temperature 0)
  • Metrics: accuracy + one quality metric (faithfulness, ROUGE)
  • LLM-judge with a rubric, calibrated on ~20 human-scored samples
  • Cost + latency tracked per run
  • Re-run on every prompt/model change

Key Takeaways

  • Benchmarks pick the model; custom evals judge your actual task.
  • Build a golden set and re-run it on every change — evaluation is a practice, not a one-time task.
  • LLM-as-judge scales review, but calibrate it against humans.
  • Track cost and latency alongside quality — a great answer that's too slow is still a bad system.

Next up: Prompt Engineering Track — the anatomy of prompts that get consistent, excellent results.

Interactive Lesson Code Snippet
# Evaluating a model: compare predictions against ground truth
test_set = [
    ("Capital of France?", "Paris"),
    ("2 + 2?", "4"),
    ("Largest planet?", "Jupiter"),
]

predictions = ["Paris", "4", "Mars"]  # the model got one wrong

correct = sum(1 for (_, expected), pred in zip(test_set, predictions) if pred == expected)
total = len(test_set)

print(f"Test set size: {total}")
print(f"Correct: {correct}")
print(f"Accuracy: {correct / total * 100:.1f}%")

# A tiny rubric for LLM-as-a-judge
rubric = """
Score 1-5:
- 5: correct, complete, grounded
- 3: partially correct, missing detail
- 1: wrong or hallucinated
"""
print(f"\nJudge rubric:{rubric}")
Language: python

Lesson Code (Python)

# Evaluating a model: compare predictions against ground truth
test_set = [
    ("Capital of France?", "Paris"),
    ("2 + 2?", "4"),
    ("Largest planet?", "Jupiter"),
]

predictions = ["Paris", "4", "Mars"]  # the model got one wrong

correct = sum(1 for (_, expected), pred in zip(test_set, predictions) if pred == expected)
total = len(test_set)

print(f"Test set size: {total}")
print(f"Correct: {correct}")
print(f"Accuracy: {correct / total * 100:.1f}%")

# A tiny rubric for LLM-as-a-judge
rubric = """
Score 1-5:
- 5: correct, complete, grounded
- 3: partially correct, missing detail
- 1: wrong or hallucinated
"""
print(f"\nJudge rubric:{rubric}")

Console Output

Test set size: 3
Correct: 2
Accuracy: 66.7%

Judge rubric:
Score 1-5:
- 5: correct, complete, grounded
- 3: partially correct, missing detail
- 1: wrong or hallucinated

Code Visualization Tips

  • 🧠Draw the eval loop as a circle: Golden set → run → score → change → re-run.
  • 🧠Chart accuracy over successive prompt versions to see the improvement curve.
  • 🧠Make a scorecard table (accuracy, faithfulness, cost, latency) per model/prompt combo.

Professional Tips & Tricks

  • ⚡Keep the same golden set across experiments — changing the test is how people fool themselves.
  • ⚡Score outputs on a 1–5 rubric, not pass/fail — you'll see partial wins.
  • ⚡Track cost per good answer, not just quality — models differ 10x in price.

Python Code Judge & Practice Arena

LeetCode Style

Run real Python 3.12 WebAssembly code directly in your browser against automated test suites.

Solved:0 / 1
0 / 20 XP
Challenges:
Problem 1 of 1

Build an Eval Plan

Medium+20 XP
Design an evaluation plan for a summarization tool: golden set size, metrics, judge setup, and what to do before shipping a new model.
main.pyPython 3.12 (WASM)
1
2
3
4
5
6
7
8
9
10
11
12
Press Run Code to test or Submit to verify test cases

Up next · Continue learning

The Anatomy of an Effective Prompt

Role, context, task, format, constraints — the five building blocks that turn vague requests into precise instructions.

9 mins read45 mins
Start next lesson
Previous: Embeddings & Vector DatabasesNext: The Anatomy of an Effective Prompt
Made withbyAmol Shukla·amolshukla.online
ASAmol Shukla

AI Developer, Trainer & Agentic AI Expert building practical learning systems and real-world AI applications.

Explore

  • Projects
  • Courses
  • Prompts
  • Skills
  • Contact
  • Experience
  • Blogs

Connect

  • Resume
  • Contact
© 2026 Amol Shukla·Created withbyamolshukla.online
Back to top