Regulated-industry AI system
A full end-to-end walkthrough of an AI system shipped into a regulated industry — a lending decisioning assistant at a bank — where the system must be auditable, explainable, and human-overseen by law. Requirements → constraints → architecture → guardrails → approval gates → audit trail → monitoring → rollout, one defensible decision at a time. Engineering-leadership framing only; nothing here is legal or financial advice.
Learning objectives
- Translate a regulated-industry brief into hard requirements: auditability, explainability, human oversight, data-residency, and record-keeping.
- Map public compliance frameworks (EU AI Act, GDPR, PCI-DSS, SOC 2) onto concrete engineering controls — without treating a lesson as legal advice.
- Design the request path so no consequential decision is issued without a logged human approval gate.
- Build a tamper-evident, PII-minimized audit trail that reconstructs any decision months later.
- Gate deploys on an eval suite that measures fairness/consistency, not just accuracy, and monitor for drift in production.
- Enumerate the failure modes of a regulated AI system and map each to a named, in-architecture control.
Meet "Meridian Bank" — a representative composite. Meridian wants an AI assistant that helps loan officers decide consumer-credit applications faster: it reads the application and the supporting documents, retrieves the relevant policy, and drafts a recommendation with a rationale. The catch is the whole reason this is a case study: in a regulated setting the assistant is not allowed to be a black box. A declined applicant may be entitled to an explanation; a regulator may ask you to reconstruct why a decision was made; and a human — not the model — must own the outcome. Every design choice below is dominated by three forces a consumer chatbot never feels: you must be able to explain it, you must be able to audit it, and a human must stay accountable for it.
1 · Requirements & the constraints that veto architectures
Picture the demo that goes beautifully and then dies in the review room. Your team builds a slick lending assistant, the accuracy numbers look great, the loan officers love the speed — and then compliance asks four questions and the whole thing is dead on arrival. "Can you show a declined applicant the reasons?" "Can you reconstruct a decision from last March?" "Who, exactly, is accountable when the model is wrong?" "Where does the applicant's data live, and for how long?" Nobody wrote those questions down before building, so the answers are all "no," and the elegant architecture has to be torn out. This is the failure a regulated project lives in fear of, and §1 exists to prevent it.
Here is the mental shift that separates a consumer product from a regulated one. In a normal app you start with features — what the user can do — and worry about the boring stuff later. In a regulated industry you invert that: you start with the non-functional constraints, because they don't merely shape the design, they veto whole classes of it before a single feature is on the table. Think of them like the building codes an architect must satisfy before drawing a single beautiful room: fire exits, load limits, accessibility. You don't add fire exits after the house is built; if you try, you rebuild the house. A constraint like "a human must own every decision" is a load-bearing wall — decide it late and you demolish everything resting on the wrong assumption.
So the discipline is simple to state and hard to practice: write the constraints down first, in plain language, before anyone sketches an architecture. The reason it's hard is that these requirements are nearly invisible. They almost never show up as something a user clicks; they surface only when a regulator, an auditor, or a lawsuit comes asking. That invisibility is exactly why teams skip them — and exactly why skipping them is the most expensive mistake in the project. The common error is to treat auditability or explainability as "we'll add logging later." They aren't features you bolt on; they are properties the whole system either has by construction or can never fully retrofit. The table below is that written-down list for Meridian: read each row as a veto power, and ask of any design you later propose, "which of these six does this choice quietly violate?"
Read the two columns side by side: the left is the consumer instinct, the right is the regulated discipline — same project, opposite starting point.
- The left path starts at Features, builds fast, and only then meets compliance — the red arrow drops into a red box: the vetoes arrive too late and you tear out the house.
- The right path starts at the six constraints (the amber box) and only then draws the architecture — a green outcome, no demolition later.
- The payoff is the colour contrast: red = expensive rebuild, green = a design that survives the review. A constraint decided late is a load-bearing wall put in the wrong place.
In short: Start from the non-functional vetoes, not the features — the order you decide them in is what decides whether the system survives its compliance review.
| Requirement | What it means here | Why it dominates design |
|---|---|---|
| Explainability | A declined applicant / reviewer can be given the reasons behind a recommendation. | The system must emit a structured, human-readable rationale tied to policy — not just a score. |
| Auditability | Any past decision can be reconstructed: inputs, model version, policy version, who approved. | Forces an immutable, versioned audit trail as a first-class component, not a log afterthought. |
| Human oversight | A qualified human owns every consequential decision; the AI recommends, never decides. | An approval gate is mandatory and must be un-bypassable in code. |
| Data protection | Personal data is minimized, access-controlled, and retained only as long as lawful. | Shapes redaction, storage, and retention across every stage (GDPR/DPDP-style duties). |
| Payment-data handling | Cardholder/account data is scoped and protected where in play. | PCI-DSS-style scoping can wall off parts of the system from the model entirely. |
| Change control | Model, prompt, and policy changes are reviewed, tested, and traceable. | SOC 2-style controls push evals and approvals into CI, not into a person's judgment. |
2 · Architecture — the decision path end to end
Here is where a regulated architecture stops looking like the diagrams you're used to. If you've built a consumer chatbot or an internal tool, your instinct is to let the model be clever: hand it the request, give it some tools, and let it figure out the path — retrieve what it needs, reason freely, answer fast. That instinct is exactly wrong here, and it's worth feeling why before we look at the boxes. The moment a free-running agent decides its own steps, you lose the two things this whole system is built to guarantee: you can no longer say with certainty which stage produced what, and you can no longer prove a human — not the model — owned the outcome. Cleverness is the enemy of auditability.
So the architecture below is deliberately a pipeline, not an agent: a fixed conveyor belt where every application passes through the same stations in the same order, and each station does one inspectable job. Think of an assembly line in a regulated factory — pharmaceuticals, aircraft parts — where the point is not speed but that every unit takes the identical, logged, inspectable path so any defect can be traced to the exact station that caused it. That traceability is the feature. You are trading the flexibility of an agent for the certainty of a workflow, and under compliance that is almost always the right trade (it's the agents-vs-workflows call from CS1, made under the harshest possible constraints).
Two of the stations on that belt aren't optional stops — they're load-bearing walls, and the term is precise. Remove a decorative feature and the system is uglier; remove the PII-minimization step and personal data leaks to the model; remove the human approval gate and there is no accountable person; remove the immutable audit record and no past decision can ever be reconstructed. Each of those failures isn't a bug you patch — it's a whole missing requirement from §1. As you read the diagram left to right, notice the order isn't arbitrary: data is minimized before it can ever reach the model, and a recommendation becomes a decision only after a human signs and that signature is itself logged. The sequence is the safety property. A design that produces the same boxes in a different order — say, logging after the decision instead of at every stage — quietly fails the audit even though the picture looks similar.
Read it strictly left to right — it's a conveyor belt, and every application passes through the same seven stations in the same fixed order.
- The belt starts at Application intake (form + docs) and each arrow hands the case to the next station — this is a pipeline, not a free-running agent, so the path is always identical and inspectable.
- Notice the two load-bearing stations by their colour: the red PII-minimize box sits before anything reaches the model ("before egress"), and the amber Human approval gate ("officer owns it") sits between the model's Recommendation + rationale and the issued Decision + notice — the order is the safety property.
- The belt ends at the Immutable audit log (who/what/when): a recommendation only becomes a decision after a human signs, and that signature is itself recorded.
In short: Every case walks the same fixed conveyor — minimize data before the model, let a named human turn the recommendation into a decision, and log every stage — because the sequence itself is what survives the audit.
3 · Grounding, explainability & the output contract
Try this thought experiment, because it's the trap almost everyone falls into first. You add one line to the prompt — "explain your reasoning" — and the model dutifully produces a paragraph: "I recommend declining because the applicant's profile suggests elevated risk based on several factors." It reads beautifully. It would satisfy a casual product manager. And it is worse than useless the moment a regulator reads it, because it explains nothing you can check: which factors? which policy? is any of it even true, or did the model invent a rule that doesn't exist? A fluent, unverifiable justification isn't explainability — it's a liability with good grammar. Feeling why that paragraph fails is the whole point of this section.
The mental model that fixes it is librarian, not oracle. An oracle pronounces answers from some inner wisdom you must take on faith. A librarian, asked a question, walks to the shelf, pulls the specific book, and points at the specific passage — and if there's no book on the topic, a good librarian says "I can't answer that" rather than making something up. Meridian's assistant is built to be the librarian: every recommendation must be grounded in the retrieved, versioned policy, and it must hand back not just an answer but the citations — which clauses, exactly, drove it. Crucially, "I found nothing in policy to support this" is not treated as a weak, low-confidence answer that squeaks through; it is a refusal that routes to a human. In a regulated system, "I don't know" is a correct and safe output; a confident guess is the dangerous one.
The word doing the heavy lifting here is contract. Explainability is not a request you make of the model and hope it honors — it is a shape the output must satisfy or it does not ship. Treat the model's response as untrusted input, the way a careful web server treats form data: you don't trust that the citations are real, so your code checks that every cited clause id actually exists in the set that was retrieved; you don't trust that no prohibited factor slipped in, so your code screens for protected attributes; you don't trust a borderline call, so a confidence below a floor forces a referral. The recurring principle — you'll see it again in the exercises — is the model proposes, code disposes. And every one of those checks fails closed: the default when anything is wrong is not "approve anyway," it's "send it to a human." The numbered contract below is that discipline written out; read each item as a gate the output must pass, not advice the model should follow.
Follow the arrow left to right: the model's output enters on the left, passes through a bank of code checks in the middle, and exits down one of two paths on the right.
- The left box is the model proposing — a recommendation, a rationale, and cited clauses. Nothing is trusted yet.
- The amber panel is the code disposing: three stacked gates — the citations must exist in what was retrieved, no protected factor may appear, and confidence must clear a floor.
- The two exits are the payoff: the green box (all checks pass → emit the rec) versus the red box — and note the red arrow is the default: any single failure fails closed to a human referral.
In short: The model proposes, code disposes; when any check fails the safe default is "send it to a human," not "approve anyway."
The output contract every recommendation must satisfy
- Decision field is a recommendation only (
recommend_approve/recommend_decline/refer) — never a finalapprove/decline. - Rationale lists the factors that drove it, each tied to a cited policy clause id from the retrieved set.
- Citations are verified in code to exist in the retrieved policy — a fabricated clause id fails closed to
refer. - Confidence is reported and, below a floor, forces
referregardless of the recommendation. - No protected-attribute reasoning: the rationale is checked for prohibited factors; any hit blocks the recommendation and escalates.
4 · The human approval gate & the audit trail
Imagine the phone call every regulated-AI team dreads. It's a Tuesday, eleven months after launch. An auditor — or worse, a lawyer for a declined applicant — asks a single question: "Show me exactly why this person was declined last March." Not roughly. Not "the model was fairly accurate." Exactly: what inputs, which policy rules were in force that day, which version of the model and prompt produced the recommendation, and — the question that decides whether your company is liable — which named human approved it. If your system can answer that in five minutes, this section did its job. If it can only shrug, no amount of clever engineering elsewhere will save you. This is the section a regulator cares about most, and it rests on two components.
The first is the human approval gate, and the emphasis is on gate, not "approval button." A button is something a busy person clicks past; a gate is a wall with exactly one door, and the door does not open until an accountable human passes through it. The purpose isn't to slow things down for its own sake — it's to make certain there is always a specific person whose name is attached to the decision, someone the organization can point to and say "she owned this." The design consequence is strict: a recommendation is pending, not a decision, until a human acts, and the gate must be un-bypassable in code — not a UI convention a developer can route around under deadline pressure, but a structural fact of the system. If there's a code path that issues a decision without a logged human action, you don't have a gate; you have a suggestion.
The second is the audit trail, and the mental model that gets it right is a flight recorder — the black box on an aircraft. Nobody looks at it on a good day; its entire value is that when something goes wrong, it can reconstruct precisely what happened, and it is sealed so no one can quietly rewrite history after the fact. The gate answers who is accountable; the trail answers what actually happened. The subtle, expensive mistake teams make is treating the audit trail as "logs we can grep later." Logs are best-effort and mutable; an audit trail is a first-class component that is immutable, versioned, and tamper-evident (a per-record hash or seal so any later edit is detectable). And here is the counterintuitive twist the danger callout below drives home: because this record must survive for years, it is the worst place to store raw personal data — so it holds references and versions, not copies. The table walks each field; read it asking "if this one field were missing, what question could I no longer answer?" — because a trail is only as strong as its most-forgotten field.
Read the top row left to right for the decision flow, then look down: every stage drops a line into the record beneath it.
- The top row is the gate in action: a recommendation stays pending until a named human accepts or overrides, and only then does the decision issue — the gate is the one door, un-bypassable in code.
- The down arrows show each stage writing to the wide box below — the immutable, sealed audit record. It holds versions and references (app, model+prompt, policy, approver), not raw applicant documents.
- The payoff is the bottom line: the gate answers who is accountable, the record answers what happened — together they reconstruct any decision months later.
In short: The gate attaches a name to every decision; the sealed, reference-only record makes that decision replayable years later without hoarding PII.
| Audit field | Why it must be captured | PII posture |
|---|---|---|
| Application id + version | Ties the record to a specific, immutable snapshot of the inputs. | Reference, not raw PII |
| Model + prompt version | A decision is only reconstructable if you know exactly what produced it. | No PII |
| Policy version | Rules change; you must know which rules were in force at decision time. | No PII |
| Recommendation + rationale | The explanation given, exactly as generated and verified. | Minimized |
| Approver identity + action | Who accepted or overrode, and when — the human-oversight proof. | Actor id, access-controlled |
| Hash / seal | Tamper-evidence: any later change to the record is detectable. | No PII |
5 · Evaluation — fairness & consistency, not just accuracy
Here's the sentence that feels like a win and is actually a trap: "The model is 96% accurate on our test set." In a consumer app, that's a ship-it number. In a regulated lending system, it's the number that gets you sued — because accuracy measures whether the recommendations are right on average, and nobody sues you over the average. They sue you over the specific applicant who was treated differently from a near-identical one, or over the cohort whose approval rate came out systematically lower. A 96%-accurate system can still be the one that quietly declines people for the wrong reasons 4% of the time — and if that 4% falls unevenly across groups, "accurate" is precisely no defense at all. Internalizing that accuracy is not the metric that protects you is the pivot of this section.
So the eval suite has to measure two things a normal one ignores. The first is consistency: does the system treat similar applications alike? The test for it is a perturbation test — take an application, change something that shouldn't matter to the outcome, and confirm the recommendation doesn't flip. Think of it like a scale that must read the same weight whether you place the object on the left or the right of the pan; if it doesn't, the scale is untrustworthy regardless of how often it's "close." The second is cohort screening: compare outcome rates across representative cohorts to catch disparate treatment — using synthetic, de-identified fixtures so you're never experimenting on real people. Both are hard gates, not averages you can offset: citation validity must be 100%, and a cohort gap beyond the defined tolerance blocks the ship, it doesn't get balanced out by good numbers elsewhere.
Two points guard against the mistakes engineers make here. First, this whole apparatus runs in CI, on every change — model, prompt, or policy — and a red result blocks the deploy and names the failing case. That's SOC 2-style change control made concrete: the release decision moves out of a person's judgment ("looks fine to me") and into an automated gate that can't be talked around at 5pm on a Friday. Second — and this is the humbling part for engineers — you do not get to define "fair" by engineering taste. Which cohorts to compare, which parity definition to use, what tolerance is acceptable: those are compliance and legal decisions grounded in the applicable regulation. Your job is not to invent the fairness metric; it's to take whatever compliance defines and make it measurable and gate-able in CI, and to re-confirm it as the rules evolve. Picking a fairness definition yourself because it was convenient to compute is a classic, well-intentioned way to fail an audit.
Follow the arrow left to right: a change enters, runs the stack of checks in the middle, and exits down one of two paths.
- The left box is any change — model, prompt, or policy. All three trigger the same gate; nothing ships around it.
- The amber panel is the CI gate: four stacked checks — quality against the golden set, citation validity pinned at 100%, consistency under perturbation, and cohort screening.
- The two exits are the point: green only when all pass (ship), and the red path fires on any failure — it blocks the deploy and names the failing case. These are hard gates, so a good number can't offset a bad one.
In short: Accuracy is not the release decision — a red on citation validity, consistency, or a cohort gap blocks the ship regardless of how good the averages look.
What the eval gate checks before any model/prompt/policy change ships
- Recommendation quality against a labeled golden set of representative applications.
- Citation validity = 100% — every cited policy clause exists in the retrieved set.
- Consistency — near-identical applications get near-identical recommendations (perturbation tests).
- Cohort screening — outcome rates compared across synthetic cohorts; a defined gap trips the gate for human review.
- Prohibited-factor screen — no rationale references a protected or disallowed attribute.
- The gate runs in CI on every change; a red result blocks the ship and names the failing case.
6 · Monitoring, drift & a staged rollout
The most dangerous moment for a regulated system isn't launch day — it's six months later, when nobody's looking. On launch day everyone is watching: the evals are green, the demo went well, the compliance sign-off is fresh. Then the team moves on to the next project, and the system keeps running against a world that quietly refuses to hold still. The applicant mix shifts as the economy changes; the bank updates a lending policy; a regulator revises a rule. None of these ring an alarm. The code is byte-for-byte identical to the version compliance approved — and yet it may now be making decisions against rules that no longer apply, on a population it was never validated for. A regulated system is never "done" at launch; the obligation to monitor is continuous, and this section is about not being blindsided by the slow, silent kind of failure.
Two things drift after ship, and it helps to name them separately because they need different watchmen. The data drifts — the shape of incoming applications moves away from what your evals were built on, so yesterday's validation slowly stops describing today's traffic. And the rules drift — policy and regulation change, so a decision that was correct in March is wrong in September even though the model never changed. The insidious part is that both invalidate yesterday's approvals silently: there's no crash, no error rate spike, just recommendations that are increasingly, quietly wrong. That's why you can't wait for something to break; you have to watch for the drift itself.
The response has two halves. The first is staged rollout, and the principle is: earn autonomy, never assume it — like a surgical resident who observes, then assists, then operates under supervision, and only much later works independently. The stages below move from shadow (the AI recommends but no one sees it) through assist (the officer must actively accept or override each rec) to a fast-path (quick human sign-off on low-risk, high-confidence cases, with sampled audits) — and notice the human owns every decision at every stage; the fast-path buys speed, never oversight. The second half is monitoring the right signals. The trap here is thinking your standard SRE dashboard — latency, error rate, cost — has you covered. It doesn't: a system can be fast, cheap, and error-free while drifting badly out of compliance. You need the compliance-specific signals, and the sharpest of them is the override rate — how often humans reject the AI's recommendation. A rising override rate is your earliest, cheapest alarm that the recs are drifting, long before an auditor would ever notice. Watch it the way you'd watch a fever: not the disease itself, but the first sign something's wrong.
Read the top row left to right as increasing trust, then read the band underneath as the thing that never changes.
- The four top boxes are the stages, colour-shifting from red (shadow — AI logged but unseen) through amber (fast-path) to green (steady state) as the system earns more autonomy.
- The arrows are one-directional: you advance only after each stage proves out — like a resident who observes, assists, then operates under supervision.
- The payoff is the full-width bar below: the human owns every decision at every stage. The fast-path speeds the sign-off; it never removes it.
In short: Trust in the AI grows left to right, but human ownership of the decision is constant — the fast-path buys speed, never oversight.
| Rollout stage | What the AI does | Where the human is |
|---|---|---|
| 1 · Shadow | Produces recommendations logged but never shown to applicants. | Officer decides unaided; recs compared offline. |
| 2 · Assist | Shows the recommendation + rationale to the officer. | Officer must actively accept or override each one. |
| 3 · Fast-path | Auto-prepares low-risk, high-confidence recs for quick human sign-off. | Human still signs; sampling audits the fast-path. |
| 4 · Steady state | Same, with continuous drift + fairness monitoring. | Human owns every decision; compliance reviews the trail. |
7 · Failure modes & the control that hardens each
There's a moment in every design review that quietly tells you whether a system was really built for compliance or just decorated to look like it. Someone names a way it could go wrong — "what if the model cites a policy that doesn't exist?" — and you watch the response. If the answer is "we already handle that, it fails closed to a referral in §3," the system was designed for the threat. If the answer is "good point, we should add a check for that," you've just found where the next audit finding is hiding. The difference isn't intelligence or effort; it's whether the failure modes were enumerated first and each one assigned a home in the architecture, or whether they're being discovered one uncomfortable question at a time.
This is what "designed for compliance" actually means, and it's a stronger claim than it sounds. It doesn't mean the system never fails — every system fails. It means that for each way it can fail, there is already a named control in the architecture that catches it, and you can point to the section where that control lives. Think of it like a building's safety systems: the mark of good design isn't that fires never start, it's that every foreseeable fire — kitchen, electrical, chemical — has a specific, already-installed response: sprinklers here, extinguishers there, alarms wired throughout. A fire nobody planned for is the one that burns the building down. A failure mode with no pre-assigned control is your unplanned fire.
The table below is that enumeration for Meridian, and it's worth reading as a self-audit rather than a summary. Every failure mode in the left column is a real way regulated AI systems have caused harm — a black-box decline no one can explain, a rubber-stamped "approval" where the human never really looked, a cohort treated inconsistently, a fabricated policy clause. The right column points each one back to a control you've already met in §2 through §6 — which is the tell that the earlier sections weren't a grab-bag of best practices but a deliberate answer to a specific list of threats. Read each row and ask the reviewer's question: if this happened tomorrow, could I name the control that stops it, and point to where it lives? Any row where you can't is exactly the bolt-on you're about to regret.
Read it as a two-column self-audit: a foreseeable failure on the left, the control that catches it on the right, one arrow per row.
- The left red boxes are real ways regulated AI has caused harm — a black-box decline, a fabricated clause, disparate treatment, silent drift.
- Each arrow points to a green control box on the right, and every control names the section (§3, §5, §6) where it already lives — nothing is discovered late.
- The payoff is that no row is empty: every foreseeable fire has a pre-wired response. A failure mode with no arrow is the unplanned fire — the bolt-on you're about to regret.
In short: For each way the system can fail, point to the already-installed control and the section it lives in — a row you can't answer is the next audit finding.
| Failure mode | What goes wrong | The control that hardens it |
|---|---|---|
| Black-box decision | No explanation for a declined applicant. | Structured, verified rationale contract (§3) |
| Unreconstructable decision | Can't show why a past decision was made. | Immutable, versioned audit trail (§4) |
| Rubber-stamping | Human 'approves' without real oversight. | Sampled audit of approvals; override-rate monitoring (§6) |
| Disparate treatment | System treats cohorts inconsistently. | Consistency + cohort screening gate in CI (§5) |
| Fabricated policy | Model cites a clause that doesn't exist. | Citation verified in code → fail closed to refer (§3) |
| Silent drift | Data/policy moves; recs quietly degrade. | Drift + fairness monitoring; staged rollout (§6) |
| PII sprawl | Personal data leaks into logs it shouldn't. | PII minimization before egress; reference-only audit (§2,§4) |
| Dimension | Meets bar | Above bar |
|---|---|---|
| Constraints first | Names explainability, auditability, oversight, data-protection up front. | Maps each to a public framework and a concrete control; re-verifies against current regulation. |
| Explainable output | Emits a rationale with citations. | Rationale is verified in code; fabricated citations and prohibited factors fail closed. |
| Human oversight | Has an approval step. | Approval gate is un-bypassable; the human's accept/override is itself audited. |
| Audit trail | Logs decisions. | Immutable, versioned, tamper-evident, and PII-minimized; reconstructs any decision months later. |
| Fairness-aware evals | Measures accuracy on a golden set. | Gates on consistency + cohort screening defined by compliance, in CI on every change. |
| Monitoring + rollout | Ships behind a flag. | Staged shadow→assist→steady-state; monitors override/refer/cohort drift, not just latency. |
Score each dimension Meets or Above. All six at least Meets = a regulated-industry design you could walk into a compliance review with. Any dimension you can't hit is where the next audit finding is hiding.
A stakeholder says: "the model is 96% accurate on our test set, so let it auto-approve the clear cases and skip the human on those." Why is that the wrong move in this system, and what do you do instead?
Show answer
During an audit you're asked to show why a specific applicant was declined 8 months ago. Which components make that answerable, and what is the failure if any one is missing?
Show answer
🪜 Practice ladder beginner → industry
Six graded exercises, easy to real-world. Try each before opening its solution.
Context: "Make the lending assistant compliant" is a wish, not a spec. Design begins when you turn the obligation into requirements you can actually check.
Your task: Write four measurable requirements for the assistant — one each for explainability, auditability, human oversight, and data protection — that a reviewer could verify.
Requirements:
- Explainability: every recommendation carries a structured rationale with cited policy clauses
- Auditability: any decision is reconstructable from a stored record (inputs version, model/prompt/policy version, approver)
- Human oversight: no decision issues without a logged human accept/override
- Data protection: personal data is minimized before egress and referenced, not copied, in the audit log
- Each must be testable — "is compliant" is not; "citation validity = 100% on the eval set" is
💡 Hint: Rewrite each fuzzy duty until it names a number or a decision you could check on a held-out set.
Show solution
- Explainability: every rec includes a rationale listing the factors, each tied to a policy clause id, and citation validity is 100% on the eval set (no fabricated clauses).
- Auditability: for any decision, a stored record yields application-version, model+prompt version, policy version, rationale, and approver id+action — reconstructable months later.
- Human oversight: the system emits recommendations only; a decision exists only after a logged human accept/override.
- Data protection: PII is minimized before any model call; the audit log stores references and versions, never raw applicant documents.
Each is testable, and the explainability + oversight bars are the two that shape the whole architecture (verified rationale + un-bypassable approval gate). Verify the exact obligations against current regulation.
Context: A leader has to translate a regulation into engineering work the team can build, without overclaiming legal certainty.
Your task: Take three public frameworks (EU AI Act, GDPR, PCI-DSS) and, for each, name one concrete control this system implements — and one thing you'd hand to legal rather than decide yourself.
Requirements:
- EU AI Act (high-risk use): a control for logging/record-keeping and one for human oversight
- GDPR/DPDP-style: a control for data minimization and retention
- PCI-DSS: how payment-card data is scoped out of the model path
- For each, state the boundary: what you build vs what compliance/legal must define or confirm
- Attribute each framework correctly and hedge drift-prone specifics with "verify against current regulation"
💡 Hint: The pattern is always: framework → duty in general terms → concrete control → the part you escalate to legal.
Show solution
| Framework (public) | Control this system builds | Hand to legal |
|---|---|---|
| EU AI Act (high-risk) | Immutable, versioned audit trail (record-keeping) + un-bypassable human approval gate (oversight). | Whether this exact use is classified high-risk, and the current obligations/timelines. |
| GDPR / DPDP-style | PII minimization before egress; reference-only audit log; retention limits on the raw store. | Lawful basis, retention periods, and data-subject rights handling. |
| PCI-DSS | Card/account data scoped into a separate store the model never sees; only non-cardholder references reach the prompt. | Scope boundaries and attestation requirements. |
You build the controls; legal defines the obligations. Attribute each framework correctly and verify against current regulation — classifications and timelines drift.
Context: A model's free-text "here's my reasoning" is plausible prose, not an audit artifact. The senior move is a structured rationale verified in code.
Your task: Specify the output contract for a recommendation so the explanation is structured, grounded, and screened — and show the checks that make a bad output fail closed.
Requirements:
- Recommendation is one of {recommend_approve, recommend_decline, refer} — never a final decision
- Rationale is a list of {factor, cited_clause_id}; every clause id is verified against the retrieved set
- A fabricated citation forces the output to
refer(fail closed), not a low-confidence approve - A prohibited/protected-factor screen runs in code; any hit blocks the rec and escalates
- Confidence below a floor also forces
referregardless of the recommendation
💡 Hint: Treat the model output as untrusted: verify citations, screen factors, and default to a human when any check fails.
Show solution
Output = {
recommendation: recommend_approve | recommend_decline | refer,
rationale: [ {factor, cited_clause_id}, ... ],
confidence: 0..1
}
verify(output):
for r in rationale:
if r.cited_clause_id not in retrieved_clause_ids: return refer # fabricated -> fail closed
if r.factor in PROHIBITED_FACTORS: escalate() # disparate-treatment guard
if confidence < FLOOR: return refer
return output
The rule: the model proposes; code disposes. Explainability is only defensible when the rationale is a verified, structured artifact — cited clauses checked against what was actually retrieved, prohibited factors screened, and any failure defaulting to a human. The free-text justification is a UI nicety, never the audit record.
Context: An auditor asks, months later, to reconstruct a single decision. The trail either answers instantly or it doesn't — there is no middle ground.
Your task: Design the audit record: what fields it must capture, how it stays tamper-evident, and how it stays PII-minimal while still being reconstructable.
Requirements:
- List the fields: input version, model+prompt version, policy version, rationale, approver id+action, timestamp
- Make it tamper-evident (e.g. per-record hash / seal) so any later edit is detectable
- Store references + versions, not copies of raw personal data; the raw store is access-controlled and retention-limited
- Explain what breaks if the policy version or the model/prompt version is missing
- Note that data-protection duties apply to the log itself — retention is not "keep everything forever"
💡 Hint: Design for the question "why did this decision happen?" answerable from the record alone, with minimal PII.
Show solution
| Field | Why it's required |
|---|---|
| Application version (ref) | Pins the exact inputs; a reference, not a copy of the docs. |
| Model + prompt version | Without it you cannot reproduce the recommendation. |
| Policy version | Rules change; you must know which were in force at decision time. |
| Verified rationale | The explanation as generated and code-verified. |
| Approver id + action | The human-oversight proof: who accepted/overrode, and when. |
| Hash / seal | Tamper-evidence — any later change to the record is detectable. |
Miss the policy version → you can't say which rules applied. Miss the model/prompt version → you can't reproduce the rec. Miss the approver → you can't prove a human owned it. Keep PII in an access-controlled, retention-limited store the record points to — the log itself is reference-only. Retention duties apply; verify against current regulation.
Context: "96% accurate" is not a release decision in a regulated system. The eval that protects you measures consistency and screens cohorts, and it runs in CI.
Your task: Design the eval gate that blocks a model/prompt/policy change: what's in the set, which metrics, and what trips a block — including the fairness signals a compliance partner defines.
Requirements:
- Golden set of representative (synthetic/de-identified) applications with labels
- Metrics: recommendation quality, citation validity (must be 100%), and abstain/refer recall
- Consistency: perturbation tests — near-identical applications must get near-identical recs
- Cohort screening: outcome rates across synthetic cohorts, with a compliance-defined gap tripping the gate
- State clearly that which cohorts and what tolerance are compliance/legal decisions, not engineering ones
- Run in CI on every change; a red result blocks and names the failing case
💡 Hint: Pick metrics that map to how this system harms someone, and treat citation validity and fairness as hard gates, not averages.
Show solution
| Piece | What it is |
|---|---|
| Eval set | Representative synthetic/de-identified applications with gold recommendations + "should refer" tags. |
| Quality | Recommendation accuracy vs gold; refer/abstain recall on cases that should punt to a human. |
| Citation | % of recs whose cited clauses all exist in the retrieved set — must be 100%. |
| Consistency | Perturbation tests: small, irrelevant changes must not flip the recommendation. |
| Cohort screening | Outcome-rate comparison across cohorts; a compliance-defined gap trips the gate. |
Block the deploy if citation validity < 100%, quality/refer-recall drops vs the prod baseline, consistency fails, or a cohort gap exceeds the defined tolerance. Which cohorts and what tolerance are compliance decisions — you make them gate-able. Run in CI on every change and verify the fairness definition against current regulation.
Context: The pilot works; now it must pass a compliance review and roll out to real loan officers without ever removing the human or breaking the audit trail. This is the tech-lead deliverable.
Your task: Lay out the end-to-end plan: the architecture, the controls mapped to frameworks, the eval gate, the staged rollout, and the monitoring — and the order you'd sequence them.
Requirements:
- Architecture: minimize → retrieve → recommend → human approval gate → decision → immutable audit
- Controls mapped: EU AI Act-style oversight/record-keeping, GDPR/DPDP-style minimization, PCI-DSS scoping, SOC 2-style change control — all verified with legal
- Eval gate in CI: quality + citation validity + consistency + cohort screening; red blocks the ship
- Rollout: shadow → assist → fast-path (human still signs) → steady state, human on every decision throughout
- Monitoring: override rate, refer rate, cohort outcome drift, citation validity in prod, policy-version coverage
- Sequence it and name the go/no-go gate for each stage; nothing advances without the compliance sign-off
💡 Hint: Lead with the controls that make oversight and audit structural; earn automation speed later via the fast-path, never by removing the human.
Show solution
- Architecture first, controls baked in. minimize → RAG over versioned policy → recommendation + verified rationale → un-bypassable human approval gate → decision + notice → immutable, sealed audit record. The gate and the trail are load-bearing, not add-ons.
- Map controls to public frameworks, with legal. Oversight + record-keeping (EU AI Act-style), PII minimization + retention (GDPR/DPDP-style), payment-data scoping (PCI-DSS), and change control (SOC 2-style evals-in-CI). Attribute each and verify against current regulation.
- Gate the ship in CI. Quality, citation validity (100%), consistency, and compliance-defined cohort screening; a red result blocks and names the case.
- Roll out in stages. Shadow (logged, unseen) → assist (human accepts/overrides each) → fast-path (human still signs low-risk high-confidence recs, sampled audit) → steady state. The human owns every decision at every stage.
- Monitor the compliance signals. Override rate, refer rate, cohort outcome drift, in-prod citation validity, policy-version coverage — a rising override rate is your earliest drift alarm.
Order & gates: make oversight + audit structural before anything else; only then earn speed via the fast-path. Each rollout stage has an explicit go/no-go, and nothing advances without the compliance sign-off. This is decision-support under regulation — never a system that decides on its own.
✓ Checkpoint — you can move on when you can…
- Turn a regulatory obligation into testable requirements for explainability, auditability, oversight, and data protection.
- Map EU AI Act / GDPR / PCI-DSS / SOC 2 (in general terms) onto concrete controls and know which parts to hand to legal.
- Explain why the approval gate must be un-bypassable and why the rationale must be verified in code.
- Design an immutable, PII-minimized audit trail that reconstructs a decision months later.
- Gate deploys on fairness/consistency, not just accuracy, and name the monitoring signals for drift.
- Map each failure mode to a named control already present in the architecture.