Skip to content
ML to LLMs
Learning path

Module 21

Safety and security

Threat-model AI systems (prompt injection, data exfiltration, tool abuse), measure and choose fairness criteria, and protect training data with differential privacy.

  1. 1. Securing AI systemsThreat-model LLM applications; understand direct and indirect prompt injection, data exfiltration, and tool abuse; and apply the controls that actually contain them.40 min
  2. 2. FairnessCompute group fairness metrics (selection rate, TPR, FPR, PPV) per group, explain why they cannot all be equal when base rates differ, describe individual and counterfactual fairness, and choose and audit a fairness criterion for a real decision system.40 min
  3. 3. Differential privacyDefine (ε, δ)-differential privacy, apply the Laplace and Gaussian mechanisms, train with DP-SGD (per-example clipping plus noise) and track the privacy budget, and decide when DP is the right defense against memorization in ML and LLM systems.45 min

When a model can read untrusted text and call tools, every document it reads is potential input from an attacker. Security for AI systems is mostly classic security (least privilege, validation, allowlists, audit logs) applied with the assumption that the model can be talked into anything.

Two more risks sit in the data rather than the prompt. A model can be accurate overall and still fail one group of people far more often, and a model trained on personal data can memorize and repeat it. Fairness criteria and differential privacy are the tools for measuring and bounding those harms.

#LessonYou will be able to
1Securing AI systemsthreat-model an LLM application and choose controls for prompt injection, exfiltration, and unsafe actions
2Fairnesscompute per-group selection, error, and precision rates, explain why they conflict under unequal base rates, and choose and audit a criterion
3Differential privacyapply the Laplace and Gaussian mechanisms, train with DP-SGD and track ε, and decide when DP is the right defense against memorization
Next moduleModule 22: ML system design and experimentation