Artificial Intelligence · AI Foundations
When Not to Use Learning
In AI because knowing when a rule or a search beats a fitted model is itself an engineering skill — learning is a cost, not a default.
The strongest AI engineers are distinguished as much by the models they refuse to build as by the ones they build. Learning is one tool on a shelf that also holds written rules and systematic search, and it is the most expensive of the three to own. This lesson gives the decision its structure: a test for when a rule suffices, a map of the three tools, the true bill for a learned system, and the hybrid pattern that uses each where it is strong.
- Artificial Intelligence
- Medium level
- 5 concepts
1When not to reach for learning
If a short deterministic procedure solves the task, write the procedure. It is cheaper to build, it never drifts, its failures are legible, and it is never wrong about its own rule — a fitted model can only approach the certainty the rule starts with.
The clean case: a form whose declared total must equal the sum of its lines. The check is one line of arithmetic. A model trained on labelled forms would 'learn' that identity approximately — a strictly worse artefact acquired at strictly higher cost.
The test has three parts, and the procedure must pass all of them: you can write the policy down, exactly (no 'usually'); it is short enough to maintain; and it is stable — the rule tomorrow is the rule today. 'I could write it down but it would take ten thousand branches' fails the second clause, and that failure is real information: it is what 'the mapping is hard to write by hand' actually means.
Learning earns its keep precisely where the test fails: nobody can list every way spam looks, every pixel pattern that makes a cat, every phrasing of a complaint. That boundary — writable versus unwritable — is the single most useful line in this lesson.
Figure. If a short deterministic procedure solves the task, write it — a form whose declared total must equal the sum of its lines. Learning earns its keep where nobody can list every way spam looks, every pixel pattern that makes a cat, every phrasing of a complaint. Rules claim the writable end; learning the other.
The procedure test
- Write itTry to state the policy in a few exact sentences or lines of code — actually try, on paper.
- Check exactnessNo 'usually', no 'looks like': if the statement needs judgement words, it is not a procedure.
- Check stabilityAsk what changes it — a rule revised weekly by the world is a mapping, and mappings are learned.
Which is the strongest reason to decline learning on a task you could perfectly well learn?
- The training run would take more than an hour to finish
- Nobody on the team has been trained on scikit-learn yet
- A short exact procedure already solves it, and a model would add data, failure modes and monitoring you then have to carry
- Compiled code always executes faster than a fitted model
The cost of learning is not the training run; it is everything that follows it. When a procedure already works, that whole ongoing bill buys nothing.
2Rules, search, learning: one shelf
Classical AI's honest summary is that there are three ways to get intelligent behaviour, and they are ordered by how much you must know in advance. If you know the policy, write rules. If you know the world — the states, the moves, their costs — but not the policy, search: the algorithm derives behaviour from your model of the world, which is exactly what the coming search lessons build. If you know neither, but you have examples, learn.
The order matters because each step down surrenders something. Rules are inspectable and provable; search is optimal relative to a world model you can audit; a learned model is a statistical artefact whose guarantees are only as good as its data and its eval. Never trade down for fashion: choose the highest tool on the shelf that fits what you actually know.
The classification is per sub-problem, not per product. A chess engine searches, its position evaluation may be learned, and 'never leave the king exposed' can be hard-coded. A payments system learns a fraud score, searches nothing, and enforces legal limits with rules. Decomposing a task into parts that each get the right tool is most of what senior engineers mean by architecture.
Figure. Three exits from one question: what do you already know? The policy itself — write it. The states, moves and costs — search will derive the policy. Only examples of inputs and answers — learn, and accept the eval and monitoring bill that follows.
The deciding question is what you can write down in advance.
| Task | You can write down | Tool |
|---|---|---|
| Validate that a form total equals the sum of its lines | The policy itself | A rule |
| Cheapest route on a known map | The moves and their costs, not the route | Search |
| Flag spam | Neither — only labelled examples | Learning |
| Block transfers above a legal limit | The policy itself, by statute | A rule |
3The bill arrives after training
The visible cost of a learned system — the training run — is the cheapest line on its invoice. The bill that decides build-versus-rule arrives afterwards, in three instalments that recur for the life of the system.
First, data: supervised learning is a machine for converting labelled examples into behaviour, and labels are bought with human hours. The ledger below prices a modest labelling job; production systems consume that continuously as the world drifts.
Second, failure modes you cannot enumerate: a rule fails where its clauses say; a model fails wherever its training distribution ran thin, and it fails silently, with full confidence. You cannot write the list of those places down in advance — that is the whole reason you could not write the rule.
Third, monitoring: because the failures are silent, a learned system without drift detection, slice dashboards and a rollback plan is not unfinished, it is unsafe. None of this appears in the demo, which is why the demo is not the decision — the evaluation lesson's offline-versus-online loop is this same bill, seen from the metrics side.
Figure. The training run is the cheapest line on the invoice. A first fraud model of 10,000 labels at about 2 minutes each is about 42 analyst days — and you pay it again when patterns shift. Failure modes you cannot enumerate, plus monitoring for the life of the system, sit in the tail after demo day.
Pricing the labels alone
A first fraud model needs 10,000 labelled transactions. An analyst labels one in about 2 minutes.
- 10,000 × 2 min20,000 minutes
- 20,000 / 60≈ 333 hours
- 333 / 8≈ 42 analyst working days
- And when fraud patterns shiftyou pay it again
Pro tip. Label cost scales with retraining, not just the first build. Before committing, price the second labelling round too — the world that made the first one necessary will not stop moving.
4Rules fail loudly; models fail silently
The two artefacts do not merely differ in accuracy; they differ in how they are wrong, and operations is built around that difference.
A rule fails at its written boundary: the case not covered raises an error you can read, point to, and patch, and the fix provably does not touch the other clauses. A model fails off its training distribution: it produces an answer anyway — often with high confidence — and nothing in the output distinguishes the failure from a success. The defect is discovered downstream, by its damage.
Change management inverts too. A rule change is a diff a reviewer can reason about clause by clause. A retrain changes behaviour everywhere at once by an amount nobody can bound, which is why model rollouts borrow the machinery of experiments — canaries, shadow traffic, rollback — rather than the machinery of patches.
Neither mode is better; they are different budgets. Rules spend engineering time before deployment; models spend vigilance after it. The mistake is running a model with a rule's operational habits — deploy and forget — because 'it passed the eval'.
The figure in words: two timelines side by side — the rule system's flat line broken by one sharp, labelled spike at its boundary case; the model's line drifting smoothly off course with no spike at all, the error visible only when the two lines are compared at the end.
| Question | Rule system | Learned system |
|---|---|---|
| Where does it fail? | At the written boundary of its clauses | Wherever training data ran thin — unknowable in advance |
| How does failure present? | A legible error at the failing clause | A confident wrong answer, indistinguishable from a right one |
| How is a fix verified? | Re-read the diff; other clauses provably untouched | Re-run the whole eval; behaviour moved everywhere at once |
| Operational posture | Patch and move on | Canary, monitor slices, keep a rollback |
5Hybrids: learning perceives, rules guarantee
Real products rarely choose one tool; they compose them, and the composition has a load-bearing rule: learning handles perception, rules hold the guarantees, and the guarantee sits downstream of the score so that no model output can override it.
The payments shape from the what-is-AI lesson, now as architecture: a learned model scores each transaction's fraud probability — the unwritable mapping — and a rule layer after it enforces the written law, blocking any transfer above the legal limit whatever the score says. The model may be wrong; the limit may not.
The direction matters more than the components. Put the rule upstream as a mere feature and the model can learn to route around it; put it downstream as a constraint and it is unconditional. When a guarantee breach ships, the failure is architectural — a constraint was made to depend on a score — before it is a modelling error.
This is also how to read incidents: every layer owns a failure class. Score wrong: model incident — retrain, re-evaluate. Limit breached: rule-layer incident, even if the model also missed. A hybrid without that ownership map degenerates into 'the AI did it', which is another way of saying nobody is accountable.
Figure. The guarantee sits after the score. The learned layer produces a probability that may be wrong; the constraint layer holds the written law and cannot be outvoted by it. Reverse the order and the guarantee becomes a suggestion.
Reading a hybrid incident
- Locate the layerAsk which layer's contract broke: a wrong score or a breached guarantee — they are different incidents.
- Check the directionConfirm the constraint sits downstream of the score; a guarantee a model can override is already a defect.
- Assign the fixModel incidents get retraining and eval updates; rule incidents get a code change and a regression test.
Notes
- The procedure test, three tools, learning's lifecycle bill and the hybrid pattern.
- If a short deterministic procedure solves the task, write the procedure.
- Rules fail loudly at their boundary; models fail silently off their data.
Exam traps & shortcuts
- If you can write the rule in one line, write the rule — a fitted model can only approximate its certainty.
- Price the second labelling round before the first: retraining inherits the whole data bill.
- A hard constraint downstream of a model is a guarantee; upstream it is only a feature the model may learn to route around.
Recap
This lesson in brief:
- The procedure test
- Writable, exact, stable — pass all three and a rule beats any model you could fit.
- Three tools, one shelf
- Policy known: rules. World known: search. Only examples: learning — the most expensive to own.
- The real bill
- Labels, unenumerable silent failures and permanent monitoring arrive after training; the demo shows none of them.
- Hybrids
- Learning perceives, rules guarantee, and the guarantee sits downstream so no score can override it.
Practise When Not to Use Learning
Reading is free and needs no account. Practice, mocks and progress live in the app.
- 1 quick check with worked explanations
- Timed mocks scored with the real marking scheme
- Readiness tracked per topic, kept on your device