Lite / Textbooks / Introduction to Intelligent Systems / Chapter 8
8. Evaluating intelligent systems honestly
Introduction
An intelligent system is only as good as the evidence that it works. This chapter treats evaluation as part of design: choose the metric before testing, keep test data untouched until the end, compare against a fair baseline, take the system apart with ablations to see which piece earns its place, and describe failure modes in words someone can act on. A result that survives all of that is worth reporting.
Figure 8.1. Five folds, five honest tests (described in words)
Five-fold cross-validation of 400 examples drawn as a 5 by 5 grid. In each round one fold of 80 examples, shown tinted, is held out for validation while the model trains on the other 320. Every example is used for validation exactly once.
Explanation
Built from 4 School lessons. Each part is the lesson's own explanation.
8.1 Designing a perception pipeline
Sense, filter, segment, measure, decide. Which stage of the pipeline fails first when the lights flicker?
Stages and interfaces
Write the pipeline as boxes: sense (camera or sensor, sample rate) → condition (filter, calibrate) → segment (threshold, colour rule) → measure (label, area, position) → decide (rule, threshold from costs). For each stage state its input, output, units and parameters. That list is your design, and also your debugging map.
One question at a time
A good investigation asks a focused question, changes one variable, holds the others fixed, repeats runs to see the spread, and chooses its metric (recall, precision, throughput) before looking at results. Record everything, including runs that look wrong.
Planning the term project
The project, 'Count the parts, honestly', needs: a set of images with hand-counted ground truth; separate tuning and test images; at least three conditions (normal, changed lighting, added noise or occlusion); a metric per condition; and one mitigation tried and measured. Plan the data before writing code.
Common mix-ups
If the final number looks right, every stage works.
✓ Errors can cancel. Check stage outputs too, especially under changed conditions.Tuning on the test images is fine if you're careful.
✓ Any tuning on test data makes the test optimistic. Keep test images untouched until the end.
Open the Lite lesson: Designing a perception pipeline
8.2 Evaluating honestly: held-out tests and failure modes
Your threshold scores 98% on the images you tuned it on. On new images it scores 81%. Which number goes in the report?
Tune on one set, test on another
Split data before you start: a tuning (or training) set for choosing parameters and a test set touched once, at the end. Any decision made by looking at test results, even choosing between two thresholds, leaks information and inflates the score. With little data, keep at least a small test set sacred.
Report by condition, with counts
Give precision and recall for each condition (normal, dim, noisy, occluded), with the underlying TP/FP/FN counts and the number of items. 'Recall 90% (27 of 30)' tells a reader how much to trust it; '90%' alone does not. Say how ground truth was obtained.
Failure modes are findings
A failure mode is a describable situation where the system goes wrong: touching parts merge, glare saturates pixels, shadows split objects. Show an example, explain the cause using this term's ideas, try one mitigation, and measure it on the test set. A report that hides its failures is less useful, and less trustworthy, than one that explains them.
Common mix-ups
Reporting the tuning-set score is fine if it's labelled.
✓ Label it, but the headline must be the held-out test score; the tuning score describes how well you fitted, not how well it works.Failures make a project look bad.
✓ Well-explained, measured failures show you understand the system and help others avoid them.
Open the Lite lesson: Evaluating honestly: held-out tests and failure modes
8.3 Benchmarking computer systems fairly
Your new code is '30% faster' on your laptop. Run it again and it's 5% slower. Which number goes in the report?
Protocol first
Fix the workload (inputs, sizes, a standard suite if one exists), the system (hardware, OS, compiler and flags, versions), conditions (power mode, temperature, background load) and the procedure: warm-up runs discarded, N timed repeats, randomised or interleaved order between the systems being compared. Write it down before running, as in Term 2's pre-registration.
Metrics
Primary metric: the one your claim rests on, chosen in advance (for example p99 latency). Secondary: throughput, energy per task, peak memory, accuracy. For distributions, report median and tail percentiles, not just the mean. Use execution time, not MIPS or GHz, as the Iron Law warns.
Uncertainty and comparison
Repeat runs vary. Report the spread (standard deviation or interquartile range) and a confidence interval for the difference between systems, from paired or interleaved runs. A 3% gain with a ±5% interval is not a demonstrated gain.
Trade-offs
Many systems win on one metric and lose on another: faster but hungrier, smaller but less accurate. A design is Pareto-optimal if nothing beats it on every metric at once. Show the front and say which point your requirement selects.
Common mix-ups
One run is enough if the computer is fast.
✓ Run-to-run variation is often several percent; repeats and intervals are essential.The mean latency is the right summary.
✓ For deadlines and user experience, tails (p95, p99, max) matter more.
Open the Lite lesson: Benchmarking computer systems fairly
8.4 Ablations: which part made it better?
Your new design is 40% faster. It has a bigger cache, a new predictor and a compiler flag. Which one did the work?
One change at a time
Start from the full system and remove (or start from the baseline and add) one component per run, holding everything else fixed: same inputs, same metric, same conditions. The difference from the reference attributes performance to that component.
Interactions
Components can interact: a bigger cache may make a prefetcher less useful, or a predictor may matter only with a deep pipeline. A full factorial design (every combination; 2ⁿ runs for n on/off components) reveals interactions; with many components, test the most plausible pairs.
Explain, don't just tabulate
Tie each effect to a mechanism. 'Two-way associativity removed the conflict misses because a[i] and b[i] share index bits' is a finding; '2-way is 4× better' is only a number. Mechanism-level explanations generalise to new workloads; raw numbers may not.
Common mix-ups
If the full system is better, every component must be helping.
✓ Some may do nothing or even hurt; only ablations show it.Ablating each component once is enough.
✓ Components can interact; check plausible combinations and report uncertainty on each effect.
Open the Lite lesson: Ablations: which part made it better?
Worked examples
Designing a perception pipeline: example 1
Write a one-line research question and method for the sorting machine.
Solution
'How does belt speed (0.3–1.0 m/s) affect sorting accuracy at fixed thresholds?' Method: same test batch, same thresholds, four speeds, three runs each, metric = % correctly sorted, recorded with parts per minute.
Evaluating honestly: held-out tests and failure modes: example 1
Test results: normal light TP 28, FN 2, FP 1; dim light TP 19, FN 11, FP 0. Summarise.
Solution
Normal: recall 28/30 ≈ 93%, precision 28/29 ≈ 97%. Dim: recall 19/30 ≈ 63%, precision 19/19 = 100%. Failure mode: in dim light faulty parts fall below the threshold (misses, not false alarms). Mitigation to test: brighter lighting or an adaptive threshold.
Benchmarking computer systems fairly: example 1
Ten paired runs of old vs new code give time differences (old − new) with mean 1.2 ms and standard deviation 2.0 ms. Is the new code faster?
Solution
SE = 2.0/√10 ≈ 0.63 ms. 95% CI ≈ 1.2 ± 1.3 ms = (−0.1, 2.5) ms. It includes 0: not demonstrated. Run more pairs or reduce noise.
Ablations: which part made it better?: example 1
Simulator misses for the colliding arrays: baseline (direct-mapped, 16 B) 16; 2-way only 4; 32 B blocks only 2; both 2. Main effects and interaction?
Solution
Associativity: ½[(4 − 16) + (2 − 2)] = −6. Block size: ½[(2 − 16) + (2 − 4)] = −8. Interaction: ½[(2 − 2) − (4 − 16)] = +6: once one fix removes the conflict, the other adds nothing. Mechanism: with 8 lines fixed, 32 B blocks double the cache to 256 B, so a[i] and b[i] no longer share an index. A cleaner ablation holds capacity fixed (halve the lines when doubling the block).
Interactive figures, in words
Figure 8.2 from Evaluating honestly: held-out tests and failure modes
On the tuning batch, find the threshold with the highest accuracy and write down precision and recall. Switch to the fresh test batch without moving the slider. What changed? Is there a threshold that does well on both, and how would you have found it without peeking?
The confusion-matrix diagram has a tuning batch and a fresh test batch of 60 simulated parts each. A threshold chosen to maximise accuracy on the tuning batch usually gives a slightly different, often lower, accuracy, precision and recall on the test batch, because the two batches' random overlap differs.
Figure 8.3 from Ablations: which part made it better?
Baseline: 'Two arrays that collide', direct-mapped, 16 B blocks. Record the misses. Now change only associativity, then only block size (back to direct-mapped), then both. Fill a 2×2 table of misses. Then read the note under the simulator: what else changes when the block size changes with 8 lines fixed?
With 'Two arrays that collide' (16 reads): direct-mapped with 16 B blocks gives 16 misses; 2-way gives 4; direct-mapped with 32 B blocks gives 2, because the 8-line cache doubles in size; 2-way with 32 B blocks also gives 2.
Laboratory
These run in a browser on the full site (they need a faster connection). Simulations are simplified educational models.
- Nexus: Automated sorting (Nexus project)
Run the sorting system with and without one sensor and report the change in errors as an ablation, with repeats.
Open on the full site - Simulation OS: Two-sensor fusion (Simulation OS experiment)
Compare the fused estimate against a camera-only baseline on the same seeds, and report the difference rather than two averages.
Open on the full site
Practice
Each question links to its Lite lesson, where your answer is checked on our server and a wrong answer gets a hint. Answers are never sent to your device.
- Which change would make a belt-speed comparison unfair?
Answer it in “Designing a perception pipeline” - Why choose the metric before running the tests?
Answer it in “Designing a perception pipeline” - Your parts counter is wrong only in dim images. The threshold mask looks fine in bright images but patchy in dim ones. Which stage should you fix first?
Answer it in “Designing a perception pipeline” - You compare two thresholds on the test set and report the better one's score. What is wrong?
Answer it in “Evaluating honestly: held-out tests and failure modes” - Which failure-mode statement is most useful?
Answer it in “Evaluating honestly: held-out tests and failure modes” - Why discard warm-up runs?
Answer it in “Benchmarking computer systems fairly” - Which is an ablation?
Answer it in “Ablations: which part made it better?” - Doubling the L1 cache cut run time by 20%. Which follow-up best explains it from first principles?
Answer it in “Ablations: which part made it better?”
Engineering applications
Self-driving test reports
Serious evaluations of driving software report performance by condition (night, rain, junctions), not one overall score, because an average can hide the situation where the system fails.
Model cards
Teams publishing a trained model increasingly document its intended use, the data it was tested on and where it performs poorly, so that others do not use it outside its evidence.
Watch (optional)
Streaming video uses a lot of data. Everything you need is in the text.
- “Supervised Learning: Crash Course AI #2” by CrashCourse
- “Machine Learning Fundamentals: Bias and Variance” by StatQuest with Josh Starmer
Summary
- Choose the metric and the decision rule before running the tests.
- Test data stays untouched until the end; tuning on it turns a test into training.
- Compare against a fair baseline on the same inputs, and report the difference with its uncertainty.
- Ablations remove one component at a time to show which part caused the gain.
- Failure modes should be specific: the condition, the effect and how often it happens.
Glossary
- Baselines and control conditions
- A baseline is the reference condition a new idea is compared with, such as the existing design or a simple method, tested in the same way. Field Guide
- Outliers and honest data
- An outlier is a reading far from the rest. It may be a genuine effect or a fault; either way it must be investigated and reported, and any exclusion rule decided before seeing the results. Field Guide
- Stating limitations
- A limitations section states plainly what your work cannot show: the conditions you did not test, the size of your sample, the assumptions in your models and the sources of uncertainty you could not remove. Field Guide
- Repeated trials
- Repeating a measurement or test several times shows how much results vary and lets you average out random error. Field Guide
Project: An evaluation plan before the results
For a perception or fusion system from this book, write an evaluation plan: the metric, the baseline, the held-out data, one ablation and the decision rule. Then run it in simulation and report the result against the plan, including any deviation.
Deliverables
- The dated evaluation plan
- Results against the baseline with uncertainty
- One ablation and a specific failure mode
Write it up on paper or in your own notes. Lite never stores what you write.
References
- Trevor Hastie et al. (2009). The Elements of Statistical Learning, 2nd edition. Springer.
- Stuart Russell and Peter Norvig (2020). Artificial Intelligence: A Modern Approach, 4th edition. Pearson.