adversarial machine learning in sequential decision...

39
Adversarial Machine Learning in Sequential Decision Making KDD AdvML Workshop 2019 Jerry Zhu University of Wisconsin-Madison

Upload: others

Post on 09-Sep-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Adversarial Machine Learning in Sequential Decision Making

KDD AdvML Workshop 2019

Jerry ZhuUniversity of Wisconsin-Madison

Page 2: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Awesome collaborators

Scott Alfeld Yiding Chen Kwang-Sung Jun Laurent Lessard Owen Levin

Lihong Li Yuzhe Ma Ayon Sen Ara Vartanian Xuezhou Zhang

Page 3: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Comprehensive Adversarial Machine LearningMachine learning

Neural net-based Batch-trained

Image classification

What are other threats?

Page 4: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Control

Page 5: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Control

state s action aobservation o state s′� = f(s, a)

cost g(s, a) = + x

1 1,000,000

mina

g(s, a)

(Alaska style)

Page 6: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Control

• Plant

• State

• Action set

• Action

• State transition

• Running cost

• Terminal cost

• Policy

s0, …, sT (x)

A (U)

at ∈ At (ut)

st+1 = f(st, at)

g0(s0, a0)…gT−1(sT−1, aT−1)

gT(sT)

at = ϕ(st)

minϕ

gT(sT) +T−1

∑t=0

gt(st, at)

s.t. s0, f given, st+1 = f(st, at)

Page 7: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Test-Time Attack = Control

state s action a state s′� = f(s, a)

cost g(s, a) = ∥δ∥p + ∞ ⋅ [yw(x) ≠ y†]

x0 ∈ ℝd δ ∈ ℝd x = x0 + δ

mina

g(s, a)

Page 8: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Training Poisoning = Control

state s action a state s′� = f(s, a)

cost g(s, a) = ∥δ∥p + ∞ ⋅ [w ≠ w†]

mina

g(s, a)

w0 ∈ ℝd w = w(w0, X0 + δX, y0 + δy)δX ∈ ℝn×d

δy ∈ ℝn

Page 9: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Adversarial Attack = Control

• Good conceptual framework

• Doesn’t mean easy to compute

• “One-step control is not control” — Steve Wright

• Sequential models (today)

• Control or reinforcement learning?

minϕ

gT(sT) +T−1

∑t=0

gt(st, at)

s.t. s0, f given, st+1 = f(st, at)

Page 10: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Control or RL?

Blackbox attacksWhitebox attacks

s0, f given s0, f unknown

Control (planning)

RL (system identification)

This talk: 3 case studies

Page 11: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Case study 1

Page 12: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Optimal Sequential Attack = Optimal Control

• Example victim: online gradient descent with squared loss

• Example attacker:

• Modifies

• Minimizes T such that

wt+1 = wt −η2

∇(x⊤t wt − yt)2 = wt − η(x⊤

t wt − yt)xt

∥xt∥ ≤ 1, |yt | ≤ 1

wT = w†

Page 13: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Optimal Sequential Attack = Optimal Control

s.t. wt+1 = wt − η(x⊤t wt − yt)xt

∥xt∥ ≤ 1, |yt | ≤ 1

minT,(x,y)0:T−1

T−1

∑t=0

1 + ∞ ⋅ [wT ≠ w†]

w0 given

Nonlinear dynamics

Page 14: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

The continuous dynamicswt+1 = wt − η(x⊤

t wt − yt)xt

wt+1 − wt

η= − (x⊤

t wt − yt)xt

·w(t) = − (x(t)⊤w(t) − y(t))x(t)

Pontryagin maximum principle: necessary condition for optimality

Page 15: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

w0 w†

Page 16: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Optimal vs greedy control

s.t. wt+1 = wt − η(x⊤t wt − yt)xt

∥xt∥ ≤ 1, |yt | ≤ 1

minT,(x,y)0:T−1

T−1

∑t=0

1 + ∞ ⋅ [wT ≠ w†]

w0 given

s.t. wt+1 = wt − η(x⊤t wt − yt)xt

∥xt∥ ≤ 1, |yt | ≤ 1

minxt,yt

∥wt+1 − w†∥

wt given

Page 17: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

wt+1 = wt − η(x⊤t wt − yt)xt s.t. ∥xt∥ ≤ 1, |yt | ≤ 1Reachable sets

Page 18: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Optimal vs greedy control

Page 19: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Optimal vs greedy control

† OPTIMAL GREEDY

Page 20: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Online data poisoning

Attacker does not know future data zt+1, zt+2, …

Page 21: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Online data poisoning

• State

• Action

• Transition

• Running cost

• example:

• Discount factor

• Policy

st = [θt, zt]

at ∈ 𝒵

st+1 = [ f(θt, at), zt+1 ∼ P]

g(st, at) = g1(zt, at) + λg2(θt)

at = ϕ(st)

Stochastic disturbance

g1(zt, at) = ∥zt − at∥2, g2(θt) = ∥θt − θ†∥2

γ

Tracking

Page 22: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Online data poisoning

minϕ

𝔼P

∑t=0

γtg(st, ϕ(st))

s.t. θ0, f given 

But P unknown…

𝔼P

s0 = [θ0, z0 ∼ P]

st+1 = [ f(θt, at), zt+1 ∼ P]

Page 23: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Solution: Model Predictive Control

• At each time step

• Estimate from

• Plan ahead from

• But only execute one step

z0, …, zt

t

Pt

st = [θt, zt] : ϕt = arg minϕ

𝔼 Pt

∑τ=t

γτ−tg(sτ, ϕ(sτ))

at = ϕt(st)

Page 24: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Subproblem: planning aheadϕt = arg min

ϕ𝔼 Pt

∑τ=t

γτ−tg(sτ, ϕ(sτ))

𝔼 PtMonte Carlo

Truncation

Action sequence instead of policy

minat:t+h−1

t+h−1

∑τ=t

γτ−tg(sτ, aτ)

Nonlinear programming (NLP):

zt:t+h−1 ∼ Pt

τ = t…t + h − 1

Or reinforcement learning (DDPG)

Page 25: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

It’s OK to estimate Pt

sups∈S

Vϕ*Pt(s) − Vϕ*P(s) ≤2γCmax

(1 − γ)2

12t

ln2|𝒵|+1

δ= O(t−1/2)

With probability at least 1 − δ

Vϕ(s) := 𝔼P

∑t=0

γtg(st, ϕ(st))s0=s

where

Page 26: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

(random )Online data poisoning experiments

Online logistic regression victims

Online k-means victims

θ†

Page 27: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Case study 2

Page 28: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

When we know the optimal attack: Linear Quadratic Regulator

linear

linear

Page 29: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Linear dynamics

• Linear environment

• Linear forecaster AR(p) model

• Quadratic costs

xt+1 = f(xt, …, xt−q+1, wt)Stochastic disturbance

yt+1∣t = α0 +p

∑i=1

αiyt+1−i∣t

(yt′�∣t − y†t′ �∣t)

2 + λu2t

Page 30: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Optimal attack as LQR• Dynamics can be written in matrix form

• So can the cost

xt+1 = Axt + B(ut + wt)

yt′�∣t = Ct′�−txt

𝔼w0:(T−1)

T−1

∑t=1

∥Cxt − y†t+1∣t∥

2Qt+1∣t

+T−1

∑t=0

∥ut∥2R x0

Page 31: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Optimal solution: Riccati equations

ϕt(z) = −B⊤qt+1 + 2B⊤Pt+1Az

2(λ + B⊤Pt+1B), t = 0…T − 1.

PT = 0, qT = 0

Pt = CA⊤Qt+1∣tC + A⊤(I +1λ

Pt+1BB⊤)−1Pt+1A

qt = − 2C⊤Qt+1∣ty†t+1∣t + A⊤qt+1 −

1λ + B⊤Pt+1B

A⊤P⊤t+1BB⊤qt+1

Page 32: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Optimal vs. greedy attacks

Page 33: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Case study 3

Page 34: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Attacking Multi-Armed Bandits

Goal: make Bob frequently pull suboptimal (not necessarily the worst) arm K.

Page 35: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Attacking Multi-Armed Bandits• State

• Action

st =

N1(t)⋮

NK(t)

μ1(t) = 1N1(t)

∑τ:Iτ=1 rτ

⋮μK(t)

Number of pulls on arm 1

Empirical average of arm 1

at ∈ ℝ

Page 36: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Attacking Multi-Armed Bandits

• (stylized) cost

• Bob’s arm choice depends on his bandit algorithm:

• epsilon-greedy

• UCB

∑t=1

|at | + λ ⋅ [It+1 ≠ K]

Page 37: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Heuristic solution

• Whenever Bob pulls a non-target (not K) arm, make it look worse than arm K.

• Theorem:

• Alice can force Bob to pull arm K for T-o(T) times

• Alice’s control expenditure T

∑t=1

|at | = O(log T )

Page 38: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

Beyond Attacks on Sequential ModelsMachine learning

Neural net-based Batch-trained

Image classification

What are other threats?

Sequential decision making

Page 39: Adversarial Machine Learning in Sequential Decision Makingpages.cs.wisc.edu/~jerryzhu/pub/AdvMLSeq.pdf · Adversarial attacks on stochastic bandits. NeurIPS, 2018 • L Lessard, X

References• Y Chen, X Zhu. Optimal Adversarial Attack on Autoregressive Models.

arXiv:1902.00202, 2019

• K Jun, L Li, Y Ma, X Zhu. Adversarial attacks on stochastic bandits. NeurIPS, 2018

• L Lessard, X Zhang, X Zhu. An optimal control approach to sequential machine teaching. AISTATS, 2019

• X Zhang, X Zhu, L Lessard. Online Data Poisoning Attacks. arXiv:1903.01666, 2019

• X Zhu. An optimal control view of adversarial machine learning. arXiv:1811.04422, 2018