Sub topic 1
Start with the User Problem, Not the Technology
Prerequisites
This chapter assumes you know how product features are built, have a working idea of what machine learning and large language models do, and can read short Python snippets.
Name the problem first
Write one sentence that names the user, the task, and the outcome that counts as success. For example: "Support agents need to route incoming tickets to the right queue within one minute." That sentence says nothing about models, but it gives you something to measure.
A feature idea such as "add AI to ticket routing" describes a solution. Ask what problem that solution solves. If the answer stays vague, nobody can tell whether any approach works.
Deterministic logic versus probabilistic behavior
Deterministic code gives the same output for the same input every time. A rule such as "if the subject contains 'refund', route to billing" is deterministic. You can test it, explain it, and predict where it fails.
Probabilistic systems, such as machine learning models and large language models, return a best guess with some chance of being wrong. The same input can produce different outputs across runs. Errors spread across cases in ways you cannot predict by reading the code, so you must measure error rates.
Try the non-AI baseline first
A baseline is the simplest working solution. Build it first and measure it on labeled examples. Also consider UI changes, such as a clearer form field, a search box, or a sensible default, which may solve the problem with no model at all.
def accuracy(predict, examples):
correct = sum(1 for text, label in examples if predict(text) == label)
return correct / len(examples)
examples = [
("please refund my order", "billing"),
("the app crashes on launch", "bug"),
("my invoice amount is wrong", "billing"),
("refund the duplicate charge", "billing"),
]
def keyword_baseline(text):
if "refund" in text or "invoice" in text:
return "billing"
return "bug"
print(accuracy(keyword_baseline, examples))The script prints 1.0 for these four examples. An AI option must clearly beat a number like this to justify its added cost.
Signals that a problem fits AI
AI tends to fit a problem when:
- The input is varied and hard to cover with rules, such as free text or images.
- The task has a clear right answer that you can check against past examples.
- Some errors are acceptable, and a person can review uncertain cases.
- Enough historical data exists, and users can give feedback on results.
Signals against AI include a need for exact answers, costly mistakes with no review, or a rule set that already works.
Exercise
A team wants AI to sort expense receipts into five fixed categories. Every receipt has a standard layout with vendor, date, and amount fields. What should the team do first?
Show answer
Build a rule-based baseline that matches vendor names and amount patterns, then measure its accuracy on labeled receipts. Consider AI only if the baseline misses enough cases to justify the cost.