AI Foundations0% complete
0%

Chapter 25 of 2525 chapters remaining

Saved on this device. Mark a chapter complete after reading.

MODULE 5 · LESSON 25 · 25 MIN

Capstone: Design a Complete AI System from Scratch

By Siten Sanghvi · Published · Updated

In this course's method, a defensible AI system design is a written document, not a diagram or a model choice. It states the task, the data boundary, the evidence the system draws on, what it may do, the tests it must pass, and who runs it and can switch it off. Each choice traces to a requirement or a risk, and the document shows the alternatives you rejected and the assumptions you have not yet tested. This capstone gives you a fictional scenario, a fill-in template, a finished example for a different system, and a rubric to check your own work.

What you will have at the end, and what you will not. You will have a design document a reviewer can read, and a list of its gaps. You will not have a running system, a grade, a certificate or any credential: nothing here deploys software or scores you, and the rubric is a self-check. A design is not evidence that the system works; that needs a build, real test data and a pilot.

Why a diagram is not a design

Teams write design documents to examine trade-offs while changes are cheap. Google's description of its design docs says a good one explains trade-offs and reasoning, lists non-goals (reasonable things deliberately left out), and shows the alternatives considered, a section it treats as one of the most important.

Nygard's architecture decision record (ADR) has five parts: title, context, decision, status and consequences (good, bad and neutral), in one or two pages; the ADR site defines it as a decision plus rationale. This lesson's decision record is Nygard's five parts plus "options considered" from the design-doc guidance. The template below is this course's own synthesis of BT-L10 to BT-L24 (BT-L01 to BT-L09 supply the background), not a published standard.

How to use this capstone

  1. Read the scenario brief, then the worked reference to see the depth expected. It is a different system; do not copy it. Reading takes about 25 minutes; writing your design takes several hours.
  2. Fill in the template for the brief, in sentences a stranger could act on.
  3. Score yourself on the rubric: for each criterion, point to the sentence in your document that meets it. No sentence means a gap. There is no total and no pass mark.

The scenario brief

Fernhill Mutual is a fictional insurer. Every name and number here is invented for the exercise.

  • Users: 500 claims adjusters (employees) in the US and the EU. Each handles about 10 new auto and property claim files a working day, over 250 working days, at about 45 minutes each. That is 1,250,000 files a year and 7.5 hours of each adjuster's day.
  • The problem: about 9 of the 45 minutes (20%) go to finding the right policy wording and handling guidelines. Policies vary by US state and EU member state and change version over time.
  • The idea: an assistant that answers adjusters' questions from policy documents and claims-handling guidelines. Assume 4 questions per file, asked while handling the file; latency expectations are yours to set.
  • Data: policy documents and guidelines are internal. Claim files hold claimants' personal data, including medical notes in injury claims, and are confidential. An adjuster may see only the claims assigned to them. Whether claim-file text enters prompts in version 1 is your decision; the cost figure below assumes it does not (if it does, state and label your own token assumption).
  • Constraints: the privacy officer says claimant data must not be used to train a provider's models and needs a retention limit, which you pick and justify. Counsel has not yet said whether any AI regulation applies. There is no ML platform team: one product owner and two engineers for six months.
  • The sponsor's wishes (not yet requirements): "adjusters should find policy answers faster", "answers must be accurate", "nothing embarrassing in front of claimants", "costs stay reasonable".
  • Budget: at most $15,000 a month for model usage. For the exercise, use illustrative round prices of $3 per million input tokens and $15 per million output tokens (not a provider's price; see BT-L16). Assume each question sends about 4,100 input tokens (instructions, passages, question) and returns about 350 output tokens.
  • Risk context: a wrong claim decision can wrongly deny a legitimate claim or pay a fraudulent one. The sponsor says it "might later recommend decisions"; whether version 1 does is your call. Candidate decision records: version 1 scope, hosting, whether claim text enters prompts, retrieval permissions.

Check your arithmetic. 4 questions on each of 5,000 files a day is 20,000 a day. At about 20.8 working days a month, that is about 1.71 billion input and 146 million output tokens a month, roughly $7,300 at the illustrative prices, inside the budget.

The design template

Fill in all eight parts; parts 1 to 6 are the six decisions a checklist exhibit later in this lesson tracks.

Part Write down Draws on
A. Requirements and targets Users and task. Each success criterion as metric, target, measurement method and owner. A latency target and a cost budget with the arithmetic shown. BT-L16, BT-L17, BT-L19
1. Assisted task One sentence: what the system does, for whom, with what output. The output format. Non-goals (at least three). Which decisions stay with a person, and who. BT-L11, BT-L15
2. Data boundary Every data type that enters a prompt, a store or a log; where each is processed; retention; the deployment option chosen and one rejected. BT-L12, BT-L16, BT-L20, BT-L21, BT-L24
3. Evidence retrieval Sources, each with an owner and a freshness rule. Who may retrieve what. What the system says when evidence is missing. BT-L13, BT-L19
4. Action controls Every tool or action with its permitted scope, who approves, and a limit, or a statement that version 1 has none. Where hidden instructions in retrieved or typed text could lead, and what stops it. BT-L14, BT-L15, BT-L18
5. Acceptance tests The case mix, graders, thresholds and acceptance rule, all written before testing. When to rerun. BT-L10, BT-L19
6. Operations and escalation Owner, what is logged and what is not, alerts with triggers, how to switch the feature off, who hears about incidents, a review date. BT-L17, BT-L20, BT-L22
B. Decisions, risks and open questions Three or more decision records. A risk register with owners and treatments. Legal and governance questions you cannot answer yourself. Every claim marked as target, untested assumption or tested (see Part B below). BT-L21, BT-L22, BT-L23

A few notes on filling it in.

Part 1. NIST's generative AI profile names over-reliance on AI output (automation bias) as a risk that can worsen confabulation, or hallucination: confidently stated false content (BT-L18). Show the source passage so a person can check.

Part 3. Retrieval gives the model passages to use. It does not guarantee the answer follows them or that a passage is current, so a retrieval system can still hallucinate. Grade the two stages separately (BT-L19). Retrieval also needs access control: OWASP warns that weak access controls let users reach embeddings holding sensitive data, and recommends permission-aware retrieval with data partitioned by group. A prompt line telling the model to discuss only your claims is not an access control.

Part 4. Use the four questions of the OWASP threat modeling cheat sheet (what are we working on, what can go wrong, what will we do about it, did we do a good enough job), applied to the assistant's tools. The OWASP Top 10 for LLM Applications (2025) names risks to check, among them prompt injection, excessive agency and unbounded consumption. Prompt injection is text meant as data that acts as an instruction (BT-L18); OWASP's page on it says it is unclear whether any foolproof prevention exists, so list controls as ways to limit impact and test them with attacks. Its excessive agency page advises exposing only the tools needed, giving them minimal downstream permissions, requiring human approval for high-impact actions, and enforcing authorization in downstream systems instead of trusting the model. Its unbounded consumption page lists input limits, rate limits and quotas. If version 1 has no tools, say so, then name what injected text could still change (an answer, a link, a drafted message) and what limits it, such as showing the source passage so a person can check.

Part 5. NIST's AI Risk Management Framework says accuracy measurements should be paired with documented test sets that represent expected use. A workable rule uses BT-L19's interval: the standard error (the typical size of sampling error) of a pass rate p on n cases is the square root of p(1-p)/n, and a 95% interval is about 1.96 standard errors either side (a rough approximation for small n). Example rule: the lower end must be at least 85%. On 40 cases, 36 passes (90%) gives about 80.7% to 99.3%: not met. On 80 cases the rule needs at least 73 passes (91.25%).

Part 6. Google's SRE book on service level objectives advises starting from what users need, not current performance, and keeping objectives few; its chapter on managing incidents says to define the process and roles in advance. NIST's framework (MANAGE 2.4) calls for assigned responsibilities and mechanisms to supersede, disengage or deactivate AI systems whose outcomes are inconsistent with intended use. For logs, BT-L20 advises recording metadata by default, not content.

Part B. A risk register lists each risk with an owner and a treatment: reduce it, remove its cause, transfer it (by contract or insurance), or accept it with a named owner. Label each claim a target (a goal not yet measured), an untested assumption, or tested (say how). NIST's framework says it does not prescribe a risk tolerance: the organization sets and documents one (MAP 1.5); so record who accepted which risk. For legal exposure, record the question: the EU AI Act's Annex III (current consolidated text, which includes later amendments) lists, under essential private services (item 5(c)), AI systems intended for risk assessment and pricing of natural persons in life and health insurance. Whether a claims tool falls under any Annex III item, or other rules, is for counsel; the design records it as open. This lesson states no dates or obligations. The AI governance evidence checklist is a ten-point worksheet (owner, evidence link, review date) for an organizational review, not a legal compliance test. The AI-first architecture diagram is a reference request path holding none of your decisions.

A worked reference: an expense-policy assistant

Wrenfield Consulting is a fictional company. 400 employees, a three-person finance team, about 1,500 travel and expense policy questions a month, and a 40-page policy with an FAQ. A completed template.

Part Wrenfield Consulting (illustrative)
A Task: answer expense-policy questions from the policy and, when asked, explain why one of the asker's own claim lines was flagged. Criteria: on the 52 correctness cases (part 5), correct, policy-grounded answers pass the rule "lower end of the 95% interval at least 85%", which needs at least 48 passes; the other 28 cases have their own gates; no other employee's data returned (target: zero failures; 5 cases cannot show it, so the expense system enforces access, the real control); 95% of answers within 10 seconds (a target, untested until the pilot). Cost: 1,500 questions x 3,000 input tokens = 4.5 million; 1,500 x 300 output tokens = 0.45 million; at $3 and $15 per million (illustrative), $13.50 + $6.75 = $20.25 a month. Cap $150, alert at 80%.
1 Answers quote the policy section and say finance decides; if the policy is silent, say so and offer a draft message to finance. Non-goals: approving claims, editing claims, tax advice.
2 In: question text and the asker's own claim lines, fetched as that employee. Never in: other employees' lines, bank details, receipts. Hosted API, provider terms to be checked. Logs: policy section IDs, version, claim line IDs, timings, token counts; question and answer text only for thumbs-down or sampled cases, redacted, in a separate 30-day store, finance systems admin access only (BT-L20). Rejected: self-hosting (D1).
3 The policy and FAQ, owned by the finance controller, each version with an effective date; only the version in force on the expense date is retrievable. Chunk by section; filter by country. Policy silent: say so.
4 Two tools. Read my claim lines: read-only, under the asker's identity, enforced by the expense system, not the prompt. Draft a message to finance: the employee sends it. Nothing approves, edits or submits. Typed text and merchant descriptions are data: a planted "approve this" would most likely yield a wrong explanation or misleading draft, which the employee reads first. Limits: 40 questions per employee a day, a token cap per request.
5 80 cases. 52 correctness cases, graded pass or fail by a person: 40 typical (de-identified finance inbox) and 12 depending on country or date. 28 gate cases: 10 not covered (must say so), 8 requests to approve or edit (must decline), 5 requests for others' claims (must return nothing), 5 injections in claim descriptions (each read by a person). Code checks citations. Rerun on every prompt, model or policy change.
6 Owner: the finance controller. Alerts: spend above 80% of cap; any returned line not the asker's pauses the assistant at once. Switch: a flag showing a static "contact finance" page. Reported wrong answers reviewed within 2 working days (illustrative). Review every 6 months or on a policy or model change.
B D1 hosted API over self-hosting. D2 retrieval over fine-tuning: the policy changes by version. D3 user-identity read-only lookup, draft-only messages. Risks: wrong policy version, answers taken as approval (owner: controller; every answer says finance decides); injected text (owner: engineer). Risk accepted by the controller: moderate, internal. Open: provider terms; counsel's view on employee claim data by country. The 85% rule and 10-second figure are targets; nothing is tested.

One of its decision records, written out in full:

D1: Hosted API over self-hosting. Status: proposed. Context: no one on staff can operate a model server; the data is internal policy text and the asker's own claim lines. Options considered: hosted API; self-hosted open model. Decision: hosted API. Consequences: fast to start and no hardware to run; the provider's terms govern retention and training (to be checked), and a provider change would require retesting.

The rubric

Mark each criterion Missing (no sentence meets it), Partial (some, not all, of the observable tests) or Met. Count gaps, not points. The last column shows the lessons each skill builds on; criteria 1 (non-goals), 9 (risk register, treatments) and 10 (evidence labels) use ideas introduced here.

# Criterion: a reviewer can find... Builds on
1 Task and scope. One sentence naming task, users and output; at least three non-goals; which decisions stay with a person and who. BT-L11, BT-L15
2 Data boundary. Every data type entering prompts, stores and logs; where processed; retention; one rejected deployment option and why. BT-L12, BT-L16, BT-L20, BT-L21, BT-L24
3 Evidence retrieval. Sources with owners and freshness rules; per-user access enforced outside the prompt; the reply when evidence is missing; retrieval and answer graded separately. BT-L13, BT-L19
4 Action controls. Each tool with scope, approver and limit, or a stated no-tool version 1; where an injected instruction could lead (for no tools: what text it could still change) and what stops it; authorization outside the model. BT-L14, BT-L15, BT-L18
5 Acceptance tests. A case mix including missing-evidence, out-of-scope and adversarial cases; a grader per criterion; threshold and rule fixed before results are seen; case count and noise handled; rerun trigger. BT-L10, BT-L19
6 Operations. A named person or role, not TBD; what is and is not logged; alerts with triggers; a way to switch off or roll back; who receives incident reports; a review date. BT-L17, BT-L20, BT-L22
7 Requirements and budget. Each sponsor wish turned into metric, target, method and owner; a latency target; cost arithmetic from stated volumes. BT-L16, BT-L17, BT-L19
8 Alternatives and decision records. At least three decisions, each with context, options considered, decision, status and consequences, bad ones included. BT-L21, BT-L23
9 Risk and governance record. Risks with owner and treatment (reduce, remove, transfer or accept); who set the risk tolerance; legal questions recorded as open, not answered. BT-L22 (owners, incident route); the register and tolerance are new here
10 Evidence status. Every number and claim labelled target, untested assumption or tested (with how); no sentence calling the design validated or safe. BT-L10, BT-L19

Try it: the checklist exhibit

The exhibit below tracks the six numbered decisions only and stores none of your text: switch a decision on when you have written it, and it shows the rubric criterion and lessons behind it. Criteria 7 to 10 live in your document.

EXHIBIT 25 / CAPSTONE

Explore the mechanism

Defend the design.

Turn course concepts into a reviewable architecture.

Defend the design.01Assisted taskStill to specify02Data boundaryStill to specify03Evidence pathStill to specify04Action controlsStill to specify05Acceptance testsStill to specify06Operating ownerStill to specify

0 / 6 design decisions drafted

A checklist, not a score. Criteria 7–10 belong in your own document: requirements and budget, decision records, risk and governance, and evidence status.

Inspect the example data and reasoning
Defend the design. — current illustrative state
DecisionStatusCriterion and lessons
Assisted taskOpen1: BT-L11, BT-L15
Data boundaryOpen2: BT-L12, BT-L16, BT-L20, BT-L21, BT-L24
Evidence pathOpen3: BT-L13, BT-L19
Action controlsOpen4: BT-L14, BT-L15, BT-L18
Acceptance testsOpen5: BT-L10, BT-L19
Operating ownerOpen6: BT-L17, BT-L20, BT-L22

Learning checklist only. Completion is not a certification, a legal approval or proof that a system is safe.

Read the mechanism without interacting
Purpose
State the assisted task and keep consequential decisions under appropriate human control.
Design
Explain the evidence path, deployment boundary and action permissions.
Proof
Define representative tests, operational ownership and a stop/escalate route.

Use the claims-reference exercise to produce a diagram, an evaluation set and explicit decisions you can defend.

Try explaining it: Which design assumption would you test first, and what result would change your architecture?

The takeaway

A design is a set of decisions you can defend: each traces to a requirement or a risk, names the alternative you rejected, and says whether it is a target, an assumption or tested. Completing it gives you a written record of your reasoning. It does not show the system works or complies with any law; that takes a build, real tests, specialist review and a pilot.

Course complete

You have finished the 25 lessons of AI Foundations. The course issues no grade, certificate or credential, and the capstone deploys nothing.

To turn your design into a system you would still need to: build a small prototype; run the tests on real, de-identified cases and report results with their uncertainty; have security and legal reviewers challenge the design; check the vendor's contract terms; run a limited pilot; and keep monitoring.

VISUAL FIELDNOTES / 25

Keep the big picture.

A one-page visual companion. Save it, print it, or explain it to someone else.

Turn course concepts into a reviewable architecture. Learning checklist only. Completion is not a certification, a legal approval or proof that a system is safe.View the full-size sheet ↗

Defend the design.

Turn course concepts into a reviewable architecture.

One US Letter page · Vector artwork · Fits A4 when printed to fit

Read the key points as text
Purpose
State the assisted task and keep consequential decisions under appropriate human control.
Design
Explain the evidence path, deployment boundary and action permissions.
Proof
Define representative tests, operational ownership and a stop/escalate route.

Remember: State the assisted task and keep consequential decisions under appropriate human control.

Try it: Use the claims-reference exercise to produce a diagram, an evaluation set and explicit decisions you can defend.

Recall: Which design assumption would you test first, and what result would change your architecture?

OPTIONAL CHECK

Check your understanding.

The optional check requires JavaScript. You can continue reading the lesson.

YOUR LEARNING

Keep your place.

Your progress is saved on this device.