AI Foundations for Developers COURSE·LESSON 03 OF 410 completed

Frame the Problem and Build a Baseline

Start with a decision users need

“Add AI to support” is not a measurable task. “Draft a policy-grounded reply that an agent can review in under a minute” identifies an input, output, workflow, and success condition.

Write a task contract with: who uses the output, what evidence it needs, which mistakes matter, allowed actions, and what happens when information is missing. For Acorn, distinguish answering a refund question from actually issuing a refund. The latter changes account state and needs separate authorization.

Choose the simplest adequate method

Exact arithmetic belongs in code. Current account balances belong in an authenticated database query. Flexible language understanding may benefit from a model. A hybrid is often appropriate: classify the request, fetch authorized facts, draft text, and validate the final response.

Rendering diagram…
flowchart TD
  A[User request] --> B{Exact rule or calculation?}
  B -->|Yes| C[Deterministic code]
  B -->|No| D{Enough authorized information?}
  D -->|No| E[Ask or abstain]
  D -->|Yes| F[Model-assisted response]
  F --> G[Validate and review]

Worked example: ticket routing

Suppose 70% of historical tickets are billing. A model with 68% accuracy may sound promising until you compare it with always predicting billing, which achieves 70%. That baseline is operationally poor for the other categories, but it exposes an inadequate model immediately.

A second baseline uses keywords. A third uses a small learned classifier. Compare all three on the same untouched test examples, including rare account-lockout cases. Measure per-category performance and manual review workload, not just one aggregate score.

Define acceptance criteria before experimenting

For the fictional assistant, use a deliberately small pilot target: on 30 reviewed cases, all account facts must come from authorized records; at least 27 answers must correctly address the question; missing-policy cases must abstain. These numbers are example acceptance criteria, not industry standards. Critical privacy failures can block release even when average quality is high.

Keep a failure budget, latency target, and expected request volume. A slow model that improves answer quality slightly may still harm a time-sensitive workflow.

Checkpoint with answers

When can an LLM replace authorization checks? It cannot. Application code must enforce permissions regardless of the model's suggested action.

Why write a baseline before prompt experiments? It establishes whether the added complexity produces meaningful improvement.

Exercise: A model summarizes an invoice and calculates a 15% tax. Which part should be code? Answer: the calculation, using validated amounts and the applicable tax rules. A model may explain the result but should not be the accounting engine.

Learn at your own pace0 / 41 lessons complete