ML Security and Adversarial Robustness
Adversarial attacks, data poisoning, model stealing, supply chain risks, and defenses including adversarial training and differential privacy.
Overview
The ML Security Surface
Machine learning adds attack surfaces that ordinary software does not have. The model is only as trustworthy as its data, its training run, the artifact it ships as and the API that serves it, and each of those can be attacked separately. Treat it like application security: model the threats, simulate the attacks, put defenses in place and keep monitoring.
Five attacks cover most of this surface. For each one, it helps to know where it hits, what the attacker wants, what you would notice and what to put in place first.
- Adversarial examples hit at inference. The attacker wants a wrong prediction on a crafted input. You would notice inputs far from the training distribution. The first defense is adversarial training.
- Data poisoning hits the data and training. The attacker wants hidden behavior or lower accuracy. You would notice label-quality drift or odd clusters. The first defense is label review and data provenance.
- Model stealing hits at inference. The attacker wants a working copy of your model. You would notice heavy, systematic query patterns. The first defense is rate limits and query monitoring.
- Membership inference hits at inference. The attacker wants to learn who was in the training data. You would notice probing with near-duplicate records. The first defense is differential privacy.
- Supply chain attacks hit the artifact. The attacker wants code execution or a trojaned model. You would notice unverified downloads and pickle files. The first defense is hash checks, safetensors and signing.
The sections below take these attacks one at a time, starting at the serving end.
Interview questions
- Describe the threat landscape for a production ML model serving real-time fraud predictions, and prioritize the top three mitigations.
- Explain differential privacy in ML training: what guarantee does it provide, how is it implemented with DP-SGD, and what are the practical tradeoffs?
- How would you secure the ML model supply chain from pre-training artifact to production deployment?
Sign up free to read the full topic
More MLOps & LLMOps topics
Start free on Cariara · Coding problems · System design studio