University of Sydney · FACULTY OF SOFTWARE ENGINEERING

ELEC5618 · Software Quality Engineering

- one subject, every graph, every model, every mark
Software Engineering14 Chapters10-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 10 of 12 · ELEC5618

Quality Engineering for ML/AI Systems

Week 10 of University of Sydney ELEC5618 Software Quality Engineering is a guest lecture applying software-quality thinking to machine-learning and AI systems: why probabilistic model behaviour breaks classical testing assumptions, the eval pipeline and launch gates, what you can and cannot unit-test in an ML system, and the three-layer quality stack that adds ML gates on top of standard software engineering. It frames the practical case study the targeted project draws on.

In this chapter

What this chapter covers

  • 01Deterministic (same input → same output) vs probabilistic software (same input → a distribution of outputs); quality becomes multi-dimensional and conflicting
  • 02Model quality dimensions: correctness/accuracy, robustness, fairness, latency/efficiency, safety, consistency; 'metrics are decisions'
  • 03The eval pipeline: model → offline eval dataset → metrics → online A/B experiment → launch decision → continuous monitoring
  • 04Offline eval-data concerns: source (labelled/synthetic/logs), train-eval contamination (leakage), statistical power, refresh cadence
  • 05Online experiments: top-line metrics, guardrail metrics, slice-based metrics (by language/topic/user), resource cost; human eval when metrics can't capture a dimension
  • 06What you CAN unit-test: the system around the model (input validation, output formatting, safety filters, API contracts, latency SLOs) — not the core inference
  • 07Traditional testing culture: testing pyramid (unit → integration → end-to-end); fast, hermetic, readable tests; code review; CI/CD presubmit
  • 08Three-layer quality stack: L1 code quality, L2 ML/AI quality, L3 process quality — you cannot skip layers
Worked example · free

Designing quality checks for a spam classifier

Q [4 marks]. A team is launching a spam-detection model. (a) Give two model-quality dimensions and why they might conflict. (b) State one part of the system you CAN unit-test and one part you cannot. (c) Place a design-doc review, an offline accuracy eval and a unit test into the three-layer quality stack. (4 marks)
  • +1(a) Two dimensions: accuracy (correctly flagging spam) and safety/robustness (not wrongly blocking legitimate mail). They conflict because tightening the filter to catch more spam (higher recall) tends to block more legitimate messages (more false positives) — 'metrics are decisions', so you must choose the trade-off explicitly.
  • +1(b) You CAN unit-test the system around the model — input validation/preprocessing, output formatting, the safety filter and the API contract/latency SLO. You cannot meaningfully unit-test the model's core inference itself, because its output is probabilistic; that is evaluated statistically, not asserted.
  • +1(c) Map to the stack: the unit test → Layer 1 (code quality); the offline accuracy eval → Layer 2 (ML/AI quality — eval datasets and metrics); the design-doc review → Layer 3 (process quality).
  • +1State the principle: you cannot skip layers — ML/AI adds gates on top of the standard software-engineering process, and because models will sometimes fail, you manage with monitoring plus fast rollback rather than trying to be perfect before launch.
(a) Accuracy vs safety/robustness conflict via the false-positive trade-off. (b) You can unit-test the surrounding system (validation, formatting, safety filter, API/latency); you cannot unit-test the probabilistic core inference. (c) Unit test → L1 code quality; offline accuracy eval → L2 ML quality; design-doc review → L3 process quality — and you cannot skip layers.
Sia tip — The key mental shift is that an ML system's core inference is probabilistic, so you evaluate it statistically (offline datasets, online A/B, human eval) rather than asserting a fixed output — but everything around the model is ordinary deterministic code you can and should unit-test. Ask Sia to test you on which activity belongs in which of the three layers.
Glossary

Key terms

Deterministic vs probabilistic software
Traditional software is deterministic (the same input always yields the same output); an ML/AI system is probabilistic (the same input yields a distribution of possible outputs), which makes quality multi-dimensional and its dimensions often conflicting.
Model quality dimensions
Correctness/accuracy, robustness (graceful degradation on odd inputs), fairness (equal performance across subgroups), latency/efficiency, safety (refusing harmful requests) and consistency (similar inputs give similar outputs). Which metric you choose defines what 'quality' means.
Eval pipeline
The ML quality flow: model → offline eval dataset → metrics computation → online A/B experiment → launch decision → continuous monitoring. Each stage is a quality-engineering decision.
What you can unit-test
In an ML system you unit-test the deterministic system around the model — input validation and preprocessing, output formatting, safety filters and guardrails, and integration points like API contracts and latency SLOs — not the model's probabilistic core inference.
Three-layer quality stack
Layer 1 code quality (unit/integration tests, review, CI/CD), Layer 2 ML/AI quality (eval datasets, metrics, slice eval, regression, human eval) and Layer 3 process quality (design docs, experiment/launch reviews, monitoring). ML/AI adds gates on top of standard engineering — you cannot skip layers.
Living with imperfection
The recognition that ML systems will sometimes fail, so quality is managed with continuous monitoring and fast rollback and an eval → launch → monitor → improve loop, rather than by trying to be perfect before launch. Catching mistakes at design is far cheaper than after launch.
FAQ

Quality Engineering for ML/AI Systems FAQ

Why does classical testing not fully work for ML/AI systems?

Because the model's behaviour is probabilistic — the same input can produce different outputs — so you cannot simply assert an expected output the way you would for deterministic code. Quality also becomes multi-dimensional and the dimensions conflict (safety vs helpfulness, accuracy vs latency). You still test the deterministic system around the model, but the model itself is evaluated statistically with datasets, online experiments and human eval.

What can and can't you unit-test in an ML system?

You can unit-test everything around the model: input validation and preprocessing, output formatting and postprocessing, safety filters and guardrails, and integration points such as API contracts and latency SLOs. You cannot meaningfully unit-test the model's core inference, because its output is probabilistic; that is what the offline eval datasets, online A/B experiments and human evaluation are for.

What is the three-layer quality stack?

Layer 1 is code quality (unit and integration tests, code review, readability, CI/CD); Layer 2 is ML/AI quality (eval datasets, metrics, slice-based evaluation, regression testing, human eval); Layer 3 is process quality (design-doc, experiment, eval and launch reviews, plus a monitoring plan). The point is that ML/AI adds gates on top of the ordinary software process, and you cannot skip a layer.

Can AI help me with the ML/AI quality material?

Yes. Sia can walk through the eval pipeline, help you reason about which quality dimensions conflict, and sort activities into the three-layer stack. Use it to understand the concepts; it does not do graded assessment, and the University of Sydney academic-integrity policy applies.

Study strategy

Exam move

This guest-lecture week is conceptual, so learn it as a set of clean distinctions and lists. Be able to explain deterministic versus probabilistic software in one sentence and why it makes quality multi-dimensional. Memorise the eval pipeline as an ordered flow (model → offline eval → metrics → online A/B → launch → monitor) and the three-layer quality stack (code, ML, process) with an example activity in each — sorting activities into layers is a natural exam task. Hold onto two ideas: you unit-test the system around the model but evaluate the model statistically, and 'metrics are decisions' so you must choose your quality trade-offs explicitly. This chapter frames the targeted project, so connect it to your case-study work. Confirm the exam format on Canvas.

Working through Quality Engineering for ML/AI Systems in ELEC5618? Sia is AskSia’s AI Software Engineering tutor — ask any ELEC5618 Quality Engineering for ML/AI Systems question and get a clear, step-by-step explanation grounded in how ELEC5618 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 13 of your University of Sydney subjects - and 1,000+ Bibles across every Australian university.
Sia - your ELEC5618 tutor, unlimited, worked the way the exam marks it
The full 10-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$25/ month
30-day money-back · cancel in one tap · how it works
Unlock the full ELEC5618 Bible + 13 University of Sydney subjects解锁完整 ELEC5618 Bible + University of Sydney 13 门科目
$25/mo