Skip to content
beginner Phase 1 · AI Engineering Landscape

Responsible AI Foundations

Cover privacy, bias, transparency, and human-in-the-loop defaults for AI features.

35m
0 problems
Topic Progress 0%

The Incident That Started With Convenience

A support assistant shipped in March. In June, a customer asked what the company stored about them, and the reply included chat transcripts nobody remembered keeping: full text with a name, an address, an order dispute, and a medication mentioned in passing. The feature had been sending complete transcripts to a model provider and writing raw copies into debug traces with a 180-day retention, because the first version needed the context and nobody took it out later.

Two mistakes, one root cause: more data was collected than the feature needs, and kept longer than anyone planned for. Both are fixed where the data leaves your building — when the request is assembled, not when the audit starts.

Inventory the fields first

Field Does the feature need it? Action
Order id Yes, to look up status keep
Customer first name Only for the greeting keep the first name, drop the record
Home address No redact before the request is sent
Payment card or bank details Never strip at ingress, before any log line exists
Health details appearing in free text No pattern redaction, and do not send it

Collect only what the feature needs: the inventory takes five minutes per feature and it is the data minimization policy in practice.

Redact at the boundary

import re

PATTERNS = [
    (re.compile(r'\b\d{3}-\d{2}-\d{4}\b'), '[SSN]'),
    (re.compile(r'\b(?:\d[ -]?){13,16}\b'), '[CARD]'),
    (re.compile(r'[\w.+-]+@[\w-]+\.[\w.]+'), '[EMAIL]'),
]

def redact(text: str) -> str:
    for pattern, token in PATTERNS:
        text = pattern.sub(token, text)
    return text

Regex is a floor, not a ceiling: it catches structured identifiers inside free text, while structured fields should be dropped by schema — delete the key while the payload is being built, so a later edit cannot quietly re-add it. Shaping and trimming the payload is plain dict and comprehension work (Python Data Structures for API Work).

What remains is diligence rather than code: does the provider retain inputs, train on them, and under which agreement? Settle that before the first prototype ships — it is the privacy half of the scoring you do in Identifying Valuable AI Use Cases.

Log the Decision, Not the Person

The audit question arrives six months late: what did the system decide, and who approved it? The instinctive fix — dump inputs and outputs into a trace — recreates the incident above. The workable compromise is a record that reconstructs the decision while leaving the person out of it.

What an audit record holds

  • Request id and timestamp.
  • Model identifier and version, plus the prompt version or its hash.
  • Redacted input and the output: enough to replay the reasoning, not enough to identify the customer.
  • Decision taken, and the reviewer's id when a human signed off.
  • Appeal outcome, if the user contested it.

Correlate without storing: hash the customer identifier with a keyed hash (HMAC) so records still join to each other while the raw value never lands in the log. When a reviewer genuinely needs the raw value, that lookup goes through a system with access control and its own retention clock — not through the trace store.

user request
     |
     v
[redact] --> [model call] --> [validate] --> [user sees the answer]
     |                              |
     +------------------------------+
                    v
      audit record: request id, model + prompt version,
      redacted input, output, decision, reviewer id
                    |
                    v
     append-only store · short retention · access logged

Production note: debugging traces are data stores. The same redactor has to run on the path that writes them, and a line emitted by a library is not exempt because nobody wrote it by hand. Teams that treat "just for debugging" as an exception are the ones reconstructing customer transcripts during an access request.

Who Signs, and What the User Is Told

Not every output deserves the same supervision. Human review checkpoints keep people accountable for high-impact automated decisions, and the ladder follows impact rather than convenience:

A wrong output costs Example Oversight default
Annoyance summary with an odd tone automate, sample a slice for quality review
Money or time refund denied, wrong shipment advice a human approves before the customer sees it
Rights, health, safety credit decision, medical triage, account ban a human decides; the model drafts and cites only

The middle row is where products usually go wrong. An automated denial with no person in the loop means nobody is accountable for the rule that produced it, and a checkpoint placed carelessly becomes a rubber stamp — Human Review Workflows covers where to put it so the reviewer actually reads the case.

Tell the user, and give them a way back

Disclosure is part of the feature, not text underneath it:

  • "Drafted with AI — reviewed by support" on the message the customer receives.
  • A visible signal when the party on the other end is a model rather than an agent.
  • An appeal path with a promised turnaround: "Reply DISPUTE and a human reviews this decision within two business days."

Disclosure does two jobs at once. Users calibrate how much to trust the output, and a wrong outcome has somewhere to go. Without the appeal path, a wrong automated decision is simply final, which is how a support issue becomes a regulatory one.

Before launch, run the abuse pass with the rest of the test suite: adversarial inputs, jailbreaks, and injected instructions belong in the same suite as functional cases (Prompt Injection Attack Patterns, Red-Teaming AI Systems). Pair it with an outcome check across user segments, so a feature that performs on average does not fail one group systematically and go unnoticed.

Quiz

1. A chat feature needs an order id to look up shipping status. A customer message also contains a home address. What is the correct handling?

Question 1 options

2. An engineer proposes logging full request and response bodies so decisions can be audited later. What is the problem and the fix?

Question 2 options

3. An AI feature automatically denies customer refund claims. Where should the human checkpoint sit?

Question 3 options

4. Why does the feature need both an AI disclosure line and an appeal path?

Question 4 options

Flashcards

Question

What is data minimization for an AI feature, and when is it enforced?

Answer

Sending only the fields the feature actually needs, enforced while the request payload is assembled — redaction after the fact cannot un-send data that already reached the provider.

Question

What belongs in an audit record for a model-assisted decision?

Answer

Request id, timestamp, model and prompt versions, redacted input and output, decision taken, reviewer id when a human signed off, and appeal outcome — no raw personal identifiers.

Question

How do you correlate audit records without storing raw identifiers?

Answer

Hash the customer identifier with a keyed hash (HMAC) so records join to each other, and keep raw-value lookup behind access control and its own retention limit.

Question

How does impact decide the level of human oversight?

Answer

Annoyances are automated with sampled review; money-or-time decisions get human approval before delivery; rights, health, and safety outcomes stay human decisions with the model drafting and citing.

Question

What two things does responsible disclosure give the user?

Answer

A signal that a model produced or assisted the output, so trust can be calibrated, and an appeal path with a turnaround promise, so a wrong outcome can be contested instead of standing.

Revision Notes

Key Takeaways

  • 1. Minimize when the payload is built — redaction after the request leaves cannot undo disclosure to the provider
  • 2. Auditability means recording versions, redacted inputs, and decisions, not collecting raw customer text in traces
  • 3. Impact, not convenience, sets the oversight: approve money and time decisions, keep humans deciding rights and safety ones
  • 4. Disclosure and appeal travel together: users can only calibrate trust if they know, and a wrong decision needs a route back
  • 5. Debug logs are data stores; the redactor and the retention clock apply to them like everything else

Interview Tips

  • • Walk the data path when asked about privacy: what fields the feature needs, where redaction happens, and what the provider retains
  • • Describe a concrete audit record — versions, redacted input, decision, reviewer — and say how you join records without storing identifiers
  • • For oversight questions, answer with the impact ladder and name which row a given feature falls into, plus where the checkpoint sits
  • • Expect the disclosure question: what the user is told, what happens when they dispute it, and how long the appeal takes

Cheat Sheet

Responsible AI Foundations — Cheat Sheet

1. Minimize before send

  • Field inventory per feature: needed / not needed / never
  • Drop unneeded keys while building the payload; redact identifiers in free text
  • Settle provider retention + training terms before the first prototype
PATTERNS = [
    (re.compile(r'\b\d{3}-\d{2}-\d{4}\b'), '[SSN]'),
    (re.compile(r'[\w.+-]+@[\w-]+\.[\w.]+'), '[EMAIL]'),
]

2. Audit record without PII

request id · timestamp · model version · prompt version/hash
redacted input · output · decision · reviewer id · appeal outcome
  • Correlate with HMAC of the customer id, not the raw value
  • Debug traces go through the same redactor; a log line is still a data store

3. Oversight ladder by impact

Wrong output costs Oversight
annoyance automate + sampled quality review
money / time human approves before delivery
rights / health / safety human decides; model drafts with citations

4. Disclosure + appeal

  • Label AI-drafted or AI-assisted output where the user sees it
  • Visible signal when the counterparty is a model
  • Contest path with a promised turnaround (e.g. human review in 2 business days)

Launch checks: injection/jailbreak suite · outcome parity across segments · reviewer load at the checkpoint

Continue Learning

Before You Start

  • No prerequisites listed.

Related Reading