Skip to main content
L15.8

Privacy, Data Governance, and Retention

About 53 min

Goal

By the end of this lesson, you can design reviewable governance rules for data use and retention, then connect external obligations and artifact provenance to release evidence.

Collect only what the task needs​

Imagine a school club collecting information for a field trip. It may need each student's name and emergency contact, but it probably does not need every old message the student has ever sent. After the trip, some records may no longer have a reason to remain.

Privacy engineering begins with that simple discipline: Why do we need this field, who needs it, and how long should it exist? Data minimization means collecting or keeping no more than the declared purpose requires. Retention is the rule for how long data remains. Governance is the larger set of ownership and review rules that makes those decisions enforceable instead of merely written down.

AI systems can accumulate data quickly. Prompts, retrieved documents, tool results, conversation history, traces, human ratings, and incident records may all be useful for debugging or evaluation. “Useful” does not mean “keep forever.”

Start from purpose and minimization​

Start with purpose. For each data field, ask why the product needs it. A support assistant may need an order ID to answer a request, but it may not need a user's full payment history. An evaluation pipeline may need an error category but not the original sensitive message.

Applying data minimization also reduces privacy exposure, security impact, storage cost, and the number of places that require deletion later.

{"field":"order_id","purpose":"answer support request","classification":"internal","retention_days":30}

Classify data and control access​

Classification makes rules explicit. A simple scheme might label data public, internal, confidential, or restricted. The exact labels vary by organization, but each label should connect to access, logging, retention, and sharing rules. A label without behavior is only decoration.

Access control should follow purpose and role. A production service may need to use a record to answer a user, while an offline evaluator may only need a de-identified summary. Copying production data into an evaluation folder can create a new data flow with different risks even when the original access was legitimate.

Define retention and deletion propagation​

Retention defines how long data remains available. Some evidence may need a short debugging window; other records may be required longer for security, legal, or audit reasons. The important engineering property is that the retention rule is explicit and enforceable rather than “we usually delete old logs.”

Deletion also needs propagation. If a record exists in a primary store, analytics export, vector index, cache, and evaluation fixture, deleting only the primary copy may not satisfy the intended policy. Map derived stores and document which ones are covered by each deletion workflow.

Make privacy claims precise​

Privacy claims should be specific. “We do not train on your data” answers only one question. It does not say whether prompts are logged, used for abuse monitoring, reviewed by people, retained for debugging, copied into evaluations, or shared with a service provider. Good governance separates those uses.

NIST AI RMF and the Generative AI Profile treat governance as an ongoing organizational function and include data privacy among important generative-AI risk areas. In engineering practice, governance becomes concrete through owners, approved purposes, access policies, retention rules, incident processes, and reviewable evidence.

Map engineering controls to external obligations​

Governance also has an external boundary: laws, regulations, contracts, and sector rules can create requirements that the product team does not invent for itself. Treat those requirements as dated inputs to the engineering process rather than as timeless facts baked into model code.

For one concrete example, EU AI Act obligations for providers of general-purpose AI models entered into application on 2 August 2025. European Commission guidance lists technical documentation, information for downstream providers, a policy for compliance with Union copyright law, and a public summary of training content among the obligations for those providers. Providers of general-purpose AI models with systemic risk have additional risk-management, incident-reporting, and cybersecurity duties.

The timeline has separate milestones. Providers placing covered GPAI models on the market from 2 August 2025 must meet the applicable obligations; from 2 August 2026, the Commission's enforcement powers apply, including enforcement through fines; and providers of GPAI models that were already on the market before 2 August 2025 have until 2 August 2027 to comply with the relevant obligations. Dates like these belong in the evidence record because "the rule" and "when this actor must satisfy it" are separate facts.

That example does not mean every AI application has the same obligations. Your role can be model provider, downstream provider, deployer, or another actor, and the applicable requirements depend on jurisdiction, system purpose, risk classification, sector, contracts, and the date. The engineering habit is to record which requirement applies, why it applies, who owns it, and what evidence demonstrates compliance, then get qualified legal or compliance review where needed.

Track licenses and provenance before release​

A product can be technically ready and still lack the rights needed to ship it. Keep a release inventory for the model weights and base model, adapters, datasets or data sources, application code and dependencies, and third-party assets. Record the exact artifact or revision, its source, and the license or terms that apply.

Do not infer permissions from availability. “Open weights,” “open source,” “downloadable,” and “free to use” are not interchangeable promises. Check whether the relevant terms permit the intended use, modification, redistribution, hosted service, or commercial use, and preserve required notices or attribution. When a fine-tuned model depends on a base model, the adapter's terms do not erase the base model's terms.

Copyright and data provenance are related but different from privacy. A dataset may contain no personal data and still raise licensing or copyright questions. Conversely, data can be licensed for a purpose and still require privacy controls. Keep those checks separate in the release record.

Turn governance into executable checks​

A retention checker can be simple. Store created_day, retention_days, classification, and legal-hold state. A record is eligible for deletion when its retention period has passed and no overriding hold applies. The function is small, but the difficult work is deciding and documenting the policy inputs.

Do not encode local law or organizational policy as a universal course rule. Privacy obligations depend on jurisdiction, sector, contracts, and context. This Lesson teaches technical governance patterns: minimize, classify, control access, define retention, propagate deletion, and preserve evidence for review.

The evaluation system should test governance rules too. Include fixtures for expired data, restricted data sent to a disallowed destination, and records under a valid hold. A governance policy that exists only in prose can drift away from running systems.

Predict

An evaluation needs only an error category and task type, but the pipeline copies complete user conversations. What design issue is most direct?

Run the local Lab​

Run:

python labs/notebooks/level-15/l15-08-retention-governance.py

The Lab keeps retention and access as separate controls, then computes the same two release-evidence metrics used by the final capstone: artifact_evidence_violations and governance_evidence_violations. The policy also names the required artifact IDs and required governance requirement IDs. That distinction matters: validating only the rows that happen to be present would let someone delete a required row and avoid a violation. These checks do not decide what a law or license permits. They detect missing or incomplete review evidence so the release gate can block an incomplete inventory.

  1. Run it unchanged with current_day = 10, retention_days = 30, and no legal hold. Confirm both evidence-violation counts are zero and release_evidence_complete is true.
  2. Before editing, predict whether the same record becomes deletion-eligible after day 31 while the access-control and evidence metrics stay fixed.
  3. Change only current_day = 10 to current_day = 31, then rerun.
  4. Confirm deletion eligibility becomes true while restricted_analyst_access, both evidence-violation counts, and release_evidence_complete stay unchanged. Restore the day.
  5. In ARTIFACT_EVIDENCE, find license_or_terms. Predict what happens if only that identifier becomes an empty string. Make the change and rerun.
  6. Confirm artifact_evidence_violations becomes non-zero and release_evidence_complete becomes false. Restore the identifier.
  7. Now delete the entire application-code artifact row but leave "application-code" in REQUIRED_ARTIFACTS. Predict the result, rerun, and confirm the missing inventory entry is still counted as a violation. Restore the row.
  8. In GOVERNANCE_OBLIGATIONS, empty the first evidence field, then restore it and try deleting the entire scope-review row while leaving that ID in REQUIRED_GOVERNANCE. Both changes should produce a governance evidence violation.
  9. Change one reviewed_date to a non-ISO value such as "yesterday". Confirm the evidence fails instead of treating any non-empty date-like string as valid.
  10. Explain why these checks verify inventory and evidence completeness, not legal permission: the applicable rule, role, jurisdiction, actual terms, and qualified review still come from outside this function.

Loading lab…

Quick Check

1. What does data minimization require?
2. Why map derived copies such as indexes and evaluation exports?
3. Which statement is a complete retention rule?
4. A model's weights are publicly downloadable. What does that fact establish about shipping them in your product?

0 of 4 questions answered.

Explain it back​

Take one AI data flow from input to logs and evaluation. State the purpose of each copy, its classification, who may access it, and what event or time limit should end its retention.

Check your explanation

A strong answer mentions:

  • For a support input, collect only fields needed for the declared task, classify customer identifiers as restricted, and restrict access by role.
  • For operational logs, retain minimal request IDs/status/errors rather than raw private content; apply a documented short retention/deletion policy.
  • For evaluation examples, use approved de-identified samples with specified reviewers, purpose, and expiration; test deletion across copies and derived stores.
  • Keep data and artifact provenance/licensing evidence and the applicable jurisdictional obligations under application/organizational control.

Key Takeaways

  • Data collection should be tied to a declared purpose.
  • Minimize data before relying on downstream cleanup.
  • Classification must connect to access, sharing, logging, and retention behavior.
  • Retention and deletion need explicit, testable rules across derived stores.
  • Governance decisions should be reviewable and should not be delegated to model-generated text.
  • Regulatory requirements are dated, jurisdiction-specific inputs that should map to owners, controls, and evidence.
  • Track model, data, code, and asset licenses and provenance before release; public availability does not by itself grant shipping rights.

Next Lesson

Next, L15.9 — Red Teaming and Abuse Testing turns threat paths into structured adversarial evaluation.

References

Lesson actions

Completion is stored locally on this device.

View progress