Testing AI, Confusion Matrix, Precision and Recall, Red Teaming, Backtesting
AAIA · Lesson 10 of 17 · 1:10:08
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the ISACA AAIA exam, on the current exam content outline. In this lesson: validation and test data, performance metrics from the confusion matrix to precision and recall, fairness, robustness, and adversarial testing with red teaming, and backtesting and parallel runs. Includes three original practice questions, with Brambleford Bank, a fictional regional bank, as the example.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Ninety-eight percent of what?
Brambleford's vendor reports that its new fraud model is ninety-eight percent accurate. Yet fraud is less than one percent of all payments, so a model that never flags anything would score even higher. The auditor needs to know which tests stand behind that number, and on which data.
Validation and test data
Testing an AI model means checking it against criteria agreed before the work started, on data it has never seen. Data is split into training, validation, and test sets, and the test set is used only once, for the final result. Test data must look like production, including rare but important cases, such as large frauds or thin credit files. And validation is independent, in proportion to the risk, as you saw in lesson seven.
Performance metrics
A confusion matrix counts four outcomes: true positives, false positives, true negatives, and false negatives. Accuracy is the share of correct answers overall, and it misleads when one class is rare. Precision is the share of flagged cases that are truly positive, and recall is the share of real positives that the model catches. Moving the threshold trades one for the other, so the choice is a business and risk decision, not a technical detail. And generative AI needs its own measures, such as groundedness and the rate of harmful outputs, from test sets and human review.
Fairness, robustness, and explainability
Fairness testing compares outcomes and error rates across groups, such as approval rates and wrongful declines. Robustness testing feeds the model noisy, missing, extreme, or unusual inputs, to see whether it fails safely. Explainability testing checks that explanations match what the model really does, and that the people who receive them can understand them. And each test has a pass mark set in advance, so that results cannot be argued after the fact.
Adversarial testing and red teaming
Adversarial testing attacks the model on purpose, with inputs crafted to fool it. Red teaming goes further: a team plays the attacker, and, for generative AI, tries jailbreaks, prompt injection, and data leaks. Findings are fixed and tested again, and the test cases are kept, so that they run on every new version. And the auditor checks who did the testing, how independent they were, and whether the findings were closed.
Testing before and after release
Backtesting runs a model on past periods, and compares its predictions with what really happened. A parallel run, also called shadow testing, lets a new model score real cases, while the current process still decides. Champion and challenger testing compares the current model with a candidate, on the same cases, before any switch. After release, testing continues, through monitoring and periodic validation, because results drift. And for controls specific to AI, such as output filters, the auditor evaluates their design, then tests that they operate effectively over time.
Recap
Let's recap. Models are tested on unseen data that looks like production, against criteria agreed in advance. Accuracy misleads when events are rare, and the balance between precision and recall is a business decision. Fairness, robustness, and explainability are tested, each with a pass mark set in advance. Adversarial testing and red teaming attack the model on purpose, and their test cases run again on new versions. And backtesting, parallel runs, and challenger tests come before release, while testing continues after it.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Testing shows that the fraud model has high precision, but low recall. What does this mean for Brambleford?
- It flags many legitimate payments as fraud
- It catches nearly all fraud, with false alarms
- Its alerts are mostly right, but it misses fraud
- It treats every group of customers fairly
Show the answer
Its alerts are mostly right, but it misses fraud
High precision means that its alerts are usually right, and low recall means that it misses much of the real fraud. “It flags many legitimate payments as fraud” is wrong, because flagging many legitimate payments would mean low precision. “It catches nearly all fraud, with false alarms” is wrong, since catching nearly all fraud would mean high recall, the opposite of this result. And “It treats every group of customers fairly” is wrong, because these two metrics say nothing about how the model treats different groups.
Before go-live, the customer assistant was tested only with polite, well-formed questions, written by the project team. Which testing is MOST missing?
- Adversarial testing and red teaming
- Tests of the user interface
- A second run of the same questions
- A user satisfaction survey
Show the answer
Adversarial testing and red teaming
Real users, and attackers, will send hostile and unusual inputs, so the assistant needs adversarial testing and red teaming. “Tests of the user interface” is wrong, because interface tests check screens and buttons, not how the model handles hostile input. “A second run of the same questions” is wrong, since repeating the same polite questions would only confirm what is already known. And “A user satisfaction survey” is wrong, because a satisfaction survey measures how users feel, not whether the assistant resists attacks.
Brambleford wants evidence that a new credit model will decide better than the current one, before it decides anything. Which approach fits BEST?
- Switch to it, then compare results
- A parallel run on real applications
- Compare both models on training data
- Ask the vendor for a certificate
Show the answer
A parallel run on real applications
A parallel run scores real applications next to the current model, without affecting any customer. “Switch to it, then compare results” is wrong, because switching first exposes customers to an untested model. “Compare both models on training data” is wrong, since results on training data are flattering, and say little about new cases. And “Ask the vendor for a certificate” is wrong, because a vendor certificate is no substitute for the bank's own evidence, on its own customers.