Skip to main content

ML model risks and mitigations

Why This Matters

Clean, representative data does not guarantee a good model. The model can still overfit, be fooled by a crafted input, drift as the world changes, or simply lose to the version it replaces. Each of those risks has its own test technique, and choosing the wrong one tests nothing. This lesson is the map for the rest of the module.

What you will learn

  • The functional, non-functional and deployment risks of an ML model
  • Which test approach mitigates which model risk
  • Where in this course each approach is covered

Syllabus: AI-6.1.1.

Three kinds of model risk

Model testing addresses:

  • functional risks: the model gives wrong or unfair answers (bias, overfitting, vulnerability to adversarial input)
  • non-functional risks: it is not robust, or not efficient enough
  • deployment risks: it behaves differently once deployed or updated

Risks and mitigations

Model riskTest approachLesson
Biased modelTesting for bias35
Unethical modelEthical system testing35, 29
Vulnerable to adversarial examplesAdversarial testing45
Overfitting or underfittingTesting for overfitting and underfitting48
Data drift or concept driftDrift testing47
Side effectsSide-effects testingbelow
Reward hackingReward hacking testingbelow
Defects in the model’s APIAPI testing52
Accuracy, recall or other targets not metML functional performance testing44
The test oracle problemMetamorphic, back-to-back and A/B testing46, 49
Poor requirementsRequirements review8
Harmful outputsRed teaming and exploratory testing29, 30
Unexpected inputsAdversarial and fuzz testing45
Poor efficiencyPerformance testing52
Poor documentationModel documentation review43
Model updatesBack-to-back, A/B, smoke and regression testing49, 52
Security, safety and privacy issuesRed teaming29

Two risks in the table are not covered elsewhere in this course:

Side effects. A system reaches its goal but causes something else nobody wanted: a cleaning robot that knocks over a vase on the shortest route; a recommender that maximises viewing time by promoting ever more extreme content. Side-effects testing looks beyond the target metric: what else changes in the environment when the system does its job?

Reward hacking. A system that learns from a reward (reinforcement learning, lesson 10) finds a way to get the reward without doing the task: the game-playing agent that scores points by looping in a corner instead of finishing the race; the robot rewarded for “no visible mess” that learns to cover the mess. Reward hacking testing checks whether high reward really means the intended behaviour, for example by watching the behaviour, not only the score.

How to use the table

Start from your risk analysis (lesson 32). For each model risk rated high, pick the matching approach; for the oracle problem, plan at least one of metamorphic, back-to-back or A/B testing. Notice how often a single risk needs a test after release (drift, updates): model testing does not end at deployment.

Exercise

Match each situation to the test approach that addresses it.

  1. A traffic sign classifier misreads a stop sign with a small sticker on it.
  2. A new model version will replace the current one next week.
  3. The model is 99% accurate on training data and 70% on new data.
  4. Six months after release, the share of approvals has slowly risen from 40% to 60%.
  5. There is no way to say what the correct output is for most inputs.
  6. Nobody can say which data the model was trained on or what its intended use is.
Show suggested answer
  1. Adversarial testing (a small, deliberate perturbation).
  2. Back-to-back and A/B testing, plus smoke and regression testing.
  3. Testing for overfitting.
  4. Drift testing (data or concept drift).
  5. Metamorphic, back-to-back or A/B testing (the oracle problem).
  6. Model documentation review.

Exam-style questions

Quiz

1. A reinforcement learning agent in a game scores many points by circling in one spot instead of completing the course. Which risk does this illustrate?

  • A. Data drift
  • B. Reward hacking
  • C. Overfitting
  • D. Poor documentation
Show answer
B.
Quiz

2. Which test approaches are suggested for the test oracle problem in ML model testing?

  • A. Performance and load testing
  • B. Metamorphic, back-to-back and A/B testing
  • C. Static analysis and code review
  • D. Usability testing
Show answer
B.