CNSLT ACADEMY / MODEL DEPLOYMENT AND SYSTEM DESIGN

Model Evaluation

FOUNDATIONSBEGINNERFREE TEXT LESSONVIDEO 🔒 PRO

Distinguish evaluation from monitoring, calculate basic classification metrics, understand generative and retrieval evaluation, and create a practical evaluation plan.

Model Evaluation

##

  1. Evaluation, benchmarking and monitoring

Evaluation tests a model or system against defined criteria and data. Benchmarking compares performance under a specified test protocol. Monitoring observes a deployed system over time. A benchmark score alone does not establish production suitability.

Start with the decision the system supports, the harm of an error, the acceptable failure rate and the evidence required.

##

  1. Classification metrics

A confusion matrix compares predictions with ground truth:

  • True positive (TP): positive case correctly identified.
  • False positive (FP): negative case incorrectly flagged.
  • True negative (TN): negative case correctly rejected.
  • False negative (FN): positive case missed.

Formulas:

  • Accuracy = (TP + TN) / all cases
  • Precision = TP / (TP + FP)
  • Recall = TP / (TP + FN)
  • F1 = 2 × precision × recall / (precision + recall)

Example: TP=180, FP=40, TN=760, FN=20. Accuracy = 940/1000 = 94%. Precision = 180/220 = 81.82%. Recall = 180/200 = 90%. F1 is approximately 85.71%.

Accuracy can mislead when classes are imbalanced. If 9,900 of 10,000 emails are legitimate, a model that labels every email legitimate has 99% accuracy but zero recall for phishing. Choose metrics based on error costs.

##

  1. Generative AI evaluation

A useful rubric may assess factual correctness, relevance, completeness, groundedness, clarity, consistency, instruction adherence and safety. Define each criterion and a scoring guide. For evidence-based answers, check whether claims are supported by the supplied sources. A fluent answer can still be wrong.

##

  1. Retrieval-augmented generation evaluation

Evaluate retrieval and generation separately:

  • Retrieval: Did the system retrieve relevant evidence? Measures can include precision@k and recall@k.
  • Generation: Did the answer use the retrieved evidence correctly, answer the question and express uncertainty when evidence was missing?

A failure can arise because retrieval missed the right document, the model misread the document, or the application assembled the wrong context.

##

  1. Robustness, human evaluation and judge models

Test paraphrases, spelling errors, long contexts, conflicting sources, irrelevant content, adversarial instructions and out-of-scope requests. Human evaluators need clear rubrics and calibration. LLM-as-a-judge can help scale evaluation but may be biased by answer length, style, position or its own model limitations. Validate judge agreement against human-reviewed examples.

##

  1. Data quality and leakage

Keep training, validation and test data appropriately separated. Data leakage occurs when information from the evaluation target improperly appears in training or tuning data, inflating apparent performance. Test sets should represent real use and be protected from repeated tuning. Include edge cases and relevant population coverage.

##

  1. System-level evaluation

Evaluate the whole product, not only the base model. Include retrieval, prompts, tools, guardrails, user interface, latency, throughput, cost, availability, security and human workflow. Measure the rate of successful end-to-end tasks and the rate of harmful failures.

##

  1. Drift and continuous evaluation

Data drift is a change in input distribution. Concept drift is a change in the relationship between inputs and the desired outcome. Monitor quality, input patterns, refusal rates, cost, latency, incidents and user feedback. Trigger re-evaluation after model/provider updates, prompt changes, retrieval changes or material changes in the operating environment.

##

  1. Practical exercise

Create an evaluation plan for a phishing classifier and an AI-generated incident summary. Define test data, metrics, thresholds, human review, adversarial cases and re-evaluation triggers.

##

  1. Knowledge check
  2. What is the difference between precision and recall?
  3. Why can accuracy be misleading?
  4. What should be evaluated separately in a RAG system?
  5. What is data leakage?
  6. Why evaluate the complete application?

Answer key:

  1. Precision measures correctness among positive predictions; recall measures coverage of actual positives.
  2. Class imbalance can hide failure on the minority class.
  3. Retrieval and answer generation.
  4. Evaluation information improperly influences training or tuning.
  5. Failures can occur in retrieval, tools, prompts, controls and user workflow, not just the model.

##

  1. Checklist
  • [ ] Define intended use and error costs.
  • [ ] Select task-appropriate metrics.
  • [ ] Build representative, protected test sets.
  • [ ] Test edge cases, adversarial inputs and subgroup performance.
  • [ ] Evaluate retrieval and generation separately where relevant.
  • [ ] Calibrate human and automated evaluators.
  • [ ] Measure latency, cost, security and end-to-end success.
  • [ ] Monitor drift and define re-evaluation triggers.

##

  1. Further reading
LEARNER FEEDBACK

Help improve this learning path.

Suggest a concept we should teach, or tell us what is unclear. No account is required. Email is optional and only for a reply. Do not include confidential or sensitive information.

COURSE PROGRESS0/29 complete
Not yet completed
CHECK YOUR UNDERSTANDING