Module 1 · Designing AI systems · Chapter 01 · Free
How AI systems differ from ordinary software
- Ordinary code gives the same output for the same input. A model gives a range of outputs, and some are wrong.
- You cannot prove an AI feature correct. You measure how often it is good enough, on many cases, over time.
- Every design pattern in this course exists because of one of six differences in this chapter.
The picture: ordinary software is a vending machine. An AI system is a new hire: fast, broad, and in need of checks.
- The six differences that change how you design, test, and run AI systems.
- For each one: the ordinary habit it breaks, and what to do instead.
- A worked refund checker that shows the coverage and error tradeoff in numbers.
- A sorting skill: given a failure story, name the difference that caused it.
Northbeam Outfitters is a made up retailer. Its team swaps a rules based refund checker for a model based one and tests it once, on a Friday, with 20 sample tickets. All 20 pass.
- On Monday the same ticket gets two different answers, an hour apart.
- By Friday, support has rechecked about 400 refunds by hand, at a made up cost of $9 per recheck: 400 × $9 = $3,600.
- Worse, a few wrong approvals were written in a warm, certain tone, so agents trusted them.
Nothing was buggy. The team designed for ordinary software, and this was not it.
- Differences 1 and 2: outputs vary, and quality is a rate, not a proof.
- Differences 3 and 4: prompts and data are program, and the model moves.
- Differences 5 and 6: every call costs, and failures sound fluent.
- The picture, then a refund checker worked in numbers.
- A lab: match six failure stories to the difference behind each.
Next: the first difference, and why a single test run proves so little.
Step 1: Nondeterminism, the same input can give a different output
Run a normal function twice on the same input and you get the same result. Run a model twice and you may get two wordings, two labels, or two decisions.
- What it breaks: exact match tests, single demo runs, and the habit of debugging by replaying one case.
- Do instead: design for a distribution. Test each important case several times and report the range, not one run.
- Do instead: log the prompt, the retrieved text, and the model version with every output, so a odd result can be studied.
Think of a dice roll inside a calculator. Where the picture breaks down:
- Dice are evenly random. Model outputs cluster: most runs agree, and the odd ones are the risk.
- You can narrow the spread with settings and tighter prompts, but you cannot remove it.
Next: if outputs vary, correctness becomes a rate.
Step 2: Quality is statistical, you measure it, you never prove it
A sort function is right or wrong. A model feature is right 96 percent of the time, on the cases you tested, this month.
- What it breaks: "it passed testing, ship it" and pass or fail sign off.
- Do instead: keep a fixed test set of real cases with known good answers. Score every change against it. This is an eval, covered in the evals chapter of the AI engineering course.
- Do instead: set a bar before you build, such as "at least 95 percent correct on the test set, and no severe errors".
Next: what counts as "the program" is wider than you think.
Step 3: Prompts, data and retrieval are part of the program
In ordinary software, behaviour lives in code. In an AI system, behaviour also lives in the prompt, the examples inside it, and the documents the system retrieves at run time.
- What it breaks: "we changed no code, so nothing changed." Editing a help article the system retrieves can flip answers tonight.
- Do instead: version prompts and key documents like code. Review changes, test them, and keep the old version ready to restore.
- Do instead: treat retrieved text as untrusted input, since anyone who can edit a source document can steer the system.
Retrieval basics are in the RAG chapter of the AI engineering course. Chapter 5 of this course builds on it.
Next: even if you change nothing, the model itself can move.
Step 4: The model changes under you
Providers update models. A new version may answer the same prompt a little differently, and your own users and data drift too: new products, new slang, new kinds of request.
- What it breaks: "it worked at launch" as a lasting guarantee, and blaming your last deploy for every behaviour change.
- Do instead: record which model version served each request. Pin a version where the provider allows it.
- Do instead: rerun your test set on a schedule and after any provider change, and watch the score over time.
Next: the meter is running on every single request.
Step 5: Cost and latency scale per request
A cached function call costs almost nothing and returns in microseconds. A model call costs money and takes seconds, and a long input costs more than a short one.
- What it breaks: calling the smart thing everywhere, retrying freely, and sending whole documents "just in case".
- Do instead: budget per request and per user. Route easy cases to cheaper paths, and cache answers that repeat. Chapter 12 of this course, "Caching, batching and cost patterns", is built on this difference.
- Do instead: design the waiting experience, since seconds of latency are normal. See the latency and cost chapter of the AI engineering course.
Next: the last difference, and the one that hurts trust most.
Step 6: Failures are fluent, so verification is a design layer
Ordinary software fails loudly: an error, a crash, a blank field. A model fails in a calm, well written paragraph that happens to be wrong.
- What it breaks: trusting output because it sounds sure, and letting users be the only check.
- Do instead: build verification in: check facts against a source, validate formats in code, and route low confidence or high stakes cases to a person.
- Do instead: show sources where you can, so a reader can check a claim in one click.
These six differences are the reasons the patterns in Modules 2 and 3 of this course exist. Routers exist because of cost. Guardrails exist because failures are fluent. The eval loop exists because quality is statistical.
Predict first:
Fluent failures do not announce themselves. Without sampling, checks, or escalation, the 4 percent is paid out silently and found late, when it costs more.
Next: the picture that ties the six differences together.
Step 7: The picture, one request through an AI system
Press Next to walk one request. Notice where each difference shows up.
- The user request arrives with retrieved documents. Those documents are part of the program, so their wording steers the answer.
- Each call spends money and seconds. The model version serving today may differ from last month.
- The same request could have produced a different answer. You are designing for the range, not one lucky run.
- Checks, sampling audits, and escalation catch fluent errors before they cost money or trust.
- The user cannot see the range or the error rate. Your design carries that knowledge for them.
Next: the refund checker, with the arithmetic done in the open.
Step 8: Worked example, rules versus model on 10,000 tickets
Northbeam Outfitters (made up) handles 10,000 refund tickets a month. All figures in this example are illustrative.
1. The rules checker. Exact on what it covers, but it covers only 62 percent: 10,000 × 0.62 = 6,200 decided by rules. The other 3,800 go to humans.
2. The model checker. It gives an answer on 97 percent: 10,000 × 0.97 = 9,700 decided. Only 300 need a human first.
3. The error bill. The model is wrong on about 4 percent of its decisions: 9,700 × 0.04 = 388 wrong refunds a month. At an illustrative average of $40 per wrong refund, that is 388 × $40 = $15,520 a month if nothing catches them.
4. The design response. Audit a random 10 percent sample of model decisions by hand: 970 reviews. Escalate every decision above an illustrative $100, plus every low confidence one, to a person before payment.
5. The run to run problem. The same ticket can score differently on a rerun, so audits sample fresh decisions weekly, and the test set reruns after any model or prompt change.
The model wins on coverage and loses on certainty. The design keeps the coverage and buys back certainty with audits and escalation, aimed where the money is.
Next: the lab, where you sort failures by their cause.
Step 9: Hands-on lab, match the failure to the difference
Why this exercise: in real design reviews, failures arrive as stories, not labels. Naming the cause points straight at the fix.
Do this:
- On paper, write the six differences as a checklist (illustrative starter below) and keep it beside you.
- Do the matching exercise. For each story, pick the difference that best explains it.
- For any you miss, reread that step of this chapter, then try again.
Design checklist (illustrative)
1. Outputs vary -> test runs, ranges, logging
2. Quality is a rate -> fixed test set, a set bar
3. Data is program -> version prompts and docs
4. Model drifts -> pin, rerun tests, monitor
5. Cost per call -> budgets, routing, caching
6. Fluent failures -> verify, audit, escalate
Lab: Failures arrive in design reviews as stories, not labels, and naming the cause points straight at the fix. This lab runs in your browser and needs JavaScript enabled.
- Each story has one main cause, and each cause has a known counter: test sets, versioning, budgets, verification.
- Real incidents often mix two causes. Name the main one first, fix it, then look again.
Next: a field note, then the mix-ups.
Teams new to AI systems often discover these differences in order: a flaky demo, then a missing eval, then a surprise bill. Keeping a small fixed test set and a per request cost log from week one is common advice in production practice. Treat that as a shared habit, not a measured statistic.
Mix-ups to avoid
- "It worked in the demo, so it works." One run shows one point in a range. Test many cases, several times.
- "We changed no code, so behaviour cannot change." Prompts, documents, data, and the model itself all move behaviour.
- "The answer sounds right, so it is right." Fluency is not evidence. Verify against a source.
- "AI calls are just API calls." Each one costs money and seconds, and the bill scales with success.
- "More testing will prove it correct." Testing measures a rate. It never turns a model into a proof.
Chapter quiz
Five questions. Score 70% or more to mark this chapter complete.
Review this chapter in 5 minutes
Watch the whole chapter recapped: the six differences, designing for a distribution, the refund coverage tradeoff, and audits that buy back certainty.
- Six differences: outputs vary, quality is a rate, prompts and data are program, the model drifts, cost is per call, failures are fluent.
- Design for a distribution: repeat runs, log versions, report ranges.
- Measure with a fixed test set and a bar set in advance. Never claim proof.
- Refund example: rules cover 62 percent exactly; the model covers 97 percent with about 4 percent wrong, 388 errors a month unaudited.
- Buy back certainty with sampling audits and escalation on high value or low confidence cases.
Decision rule: for every AI feature, name which of the six differences can hurt it most, and design that counter first.
Review
Glossary
- Nondeterminism
- The same input can give different outputs. Example: two labels for one claim on two runs.
- Distribution
- The range of outputs a system gives over many runs. Example: 90 percent label A, 10 percent label B.
- Eval
- Scoring a system on a fixed set of cases with known good answers. Example: 500 real questions, rescored weekly.
- Retrieval
- Fetching documents at run time to include in the prompt. Example: the returns page pulled into a support answer.
- Drift
- Behaviour shifting over time as models, users, or data change. Example: scores sliding over two months.
- Escalation
- Routing a case to a person instead of deciding automatically. Example: refunds above a set amount.
- Sampling audit
- Human review of a random slice of decisions. Example: checking 10 percent of model refunds.
- Verification layer
- Checks between the model output and the user. Example: matching a cited policy against its source.
Next: "The reference architecture every AI product shares".