61
Deep Adversarial Learning for NLP William Wang Sameer Singh With contributions from Jiwei Li. 1 Slides: http://tiny.cc/adversarial

Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Deep Adversarial Learning for NLP

William Wang Sameer Singh

With contributions from Jiwei Li.1Slides: http://tiny.cc/adversarial

Page 2: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Agenda

• Introduction, Background, and GANs (William, 90 mins)

• Adversarial Examples and Rules (Sameer, 75 mins)

• Conclusion and Question Answering (Sameer and William, 15 mins)

2Slides: http://tiny.cc/adversarial

Page 3: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Outline

• Background of the Tutorial

• Introduction: Adversarial Learning in NLP

• Adversarial Generation

• A Case Study of GANs in Dialogue Systems

3

Page 4: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Rise of Adversarial Learning in NLP

• Through a simple ACL anthology search, we found that in 2018, there were 20+ times more papers mentioning “adversarial”, comparing to 2016.

• Meanwhile, the growth of all accepted papers is 1.39 times during this period.

• But if you went to CVPR 2018 in Salt Lake City, there were more than 100 papers on adversarial learning (approximately 1/3 of all adv. learning papers in NLP).

4

Page 5: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Questions I’d like to Discuss

• What are the subareas of deep adversarial learning in NLP?

• How do we understand adversarial learning?

• What are some success stories?

• What are the pitfalls that we need to avoid?

5

Page 6: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Opportunities in Adversarial Learning

• Adversarial learning is an interdisciplinary research area, and it is closely related to, but limited to the following fields of study:

• Machine Learning

• Computer Vision

• Natural Language Processing

• Computer Security

• Game Theory

• Economics

6

Page 7: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Adversarial Attack in ML, Vision, & Security

• Goodfellow et al., (2015)

7

Page 8: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Physical-World Adversarial Attack / Examples (Eykholt et al., CVPR 2018)

8

Page 9: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Success of Adversarial Learning

CycleGAN (Zhu et al., 2017)

9

Page 10: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Failure Cases

CycleGAN (Zhu et al., 2017)10

Page 11: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Success of Adversarial Learning

GauGAN (Park et al., 2019)11

Page 12: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Deep Adversarial Learning in NLP

• There were some successes of GANs in NLP, but not so much comparing to Vision.

• The scope of Deep Adversarial Learning in NLP includes:

• Adversarial Examples, Attacks, and Rules

• Adversarial Training (w. Noise)

• Adversarial Generation

• Various other usages in ranking, denoising, & domain adaptation.

12

Page 13: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Outline

• Background of the Tutorial

• Introduction: Adversarial Learning in NLP

• Adversarial Generation

• A Case Study of GANs in Dialogue Systems

13

Page 14: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Adversarial Examples

• One of the more popular areas of adversarial learning in NLP.

• E.g., Alzantot et al., EMNLP 2018

14

Page 15: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Adversarial Attacks (Coavoux et al., EMNLP 2018)

15

The main classifier

predicts a label y from

a text x, the attacker

tries to recover some

private information z

contained in x from the

latent representation

used by the main

classifier.

Page 16: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Adversarial Training

• Main idea: • Adding noise, randomness, or adversarial loss in optimization.

• Goal: make the trained model more robust.

16

Page 17: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Adversarial Training: A Simple Example

• Adversarial Training for Relation Extraction• Wu, Bamman, Russell (EMNLP 2017).

• Task: Relation Classification.

• Interpretation: Regularization in the Feature Space.

17

Page 18: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Adversarial Training for Relation Extraction

Wu, Bamman, Russell (EMNLP 2017).

18

Page 19: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Adversarial Training for Relation Extraction

Wu, Bamman, Russell (EMNLP 2017).

19

Page 20: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Outline

• Background of the Tutorial

• Introduction: Adversarial Learning in NLP

• Adversarial Generation

• A Case Study of GANs in Dialogue Systems

20

Page 21: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

GANs (Goodfellow et al., 2014)

• Two competing neural networks: generator & discriminator

the classifier trying to detect the fake sample

forger trying to produce some counterfeit material

Image: https://ishmaelbelghazi.github.io/ALI/21

Page 22: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

GAN Objective

22

D(x): the probability that x came from the data rather than generator

Goodfellow, et al., “Generative adversarial networks,” in NIPS, 2014.

D

G

Page 23: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

GAN Training Algorithm

23

Discriminator

Generator

Goodfellow, et al., “Generative adversarial networks,” in NIPS, 2014.

Page 24: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

GAN Equilibrium

• Global optimality

• Discriminator

• Generator

24Goodfellow, et al., “Generative adversarial networks,” in NIPS, 2014.

D

G

s.t.

Page 25: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Major Issues of GANs • Mode Collapse (unable to produce diverse samples)

25

Page 26: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Major Issues of GANs in NLP

• Often you need to pre-train the generator and discriminator w. MLE

• But how much?

• Unstable Adversarial Training• We are dealing with two networks / learners / agents

• Should we update them at the same rate?

• The discriminator might overpower the generator.

• With many possible combinations of model choice for generator and discriminator networks in NLP, it could be worse.

26

Page 27: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Major Issues of GANs in NLP

• GANs were originally designed for images• You cannot back-propagate through the generated X

• Image is continuous, but text is discrete (DR-GAN, Tran et al., CVPR 2017).

27

Page 28: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

SeqGAN: policy gradient for generating sequences(Yu et al., 2017)

28

Page 29: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Training Language GANs from Scratch

• New Google DeepMind arxiv paper (de Masson d’Autume et al., 2019)

• Claims no MLE pre-trainings are needed.

• Uses per time-stamp dense rewards.

• Yet to be peer-reviewed and tested.

29

Page 30: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Why shouldn’t NLP give up on GAN?

• It’s unsupervised learning.

• Many potential applications of GANs in NLP.

• The discriminator is often learning a metric.

• It can also be interpreted as self-supervised learning (especially with dense rewards).

30

Page 31: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Applications of Adversarial Learning in NLP• Social Media (Wang et al., 2018a; Carton et al., 2018)

• Contrastive Estimation (Cai and Wang, 2018; Bose et al., 2018)

• Domain Adaptation (Kim et al., 2017; Alam et al., 2018; Zou et al., 2018; Chen and Cardie, 2018; Tran and Nguyen, 2018; Cao et al., 2018; Li et al., 2018b)

• Data Cleaning (Elazar and Goldberg, 2018; Shah et al., 2018; Ryu et al., 2018; Zellers et al., 2018)

• Information extraction (Qin et al., 2018; Hong et al., 2018; Wang et al., 2018b; Shi et al., 2018a; Bekoulis et al., 2018)

• Information retrieval (Li and Cheng, 2018)

• Another 18 papers on Adversarial Learning at NAACL 2019!

31

Page 32: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

GANs for Machine Translation

• Yang et al., NAACL 2018

• Wu et al., ACML 2018

32

Page 33: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

SentiGAN (Wang and Wan, IJCAI 2018)Idea: use a mixture of generators and a multi-class discriminator.

33

Page 34: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

No Metrics Are Perfect: Adversarial Reward Learning (Wang, Chen et al., ACL 2018)

34

Page 35: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

AREL Storytelling Evaluation

• Dataset: VIST (Huang et al., 2016).

0%

10%

20%

30%

40%

50%

XE BLEU-RL CIDEr-RL GAN AREL

Turing Test

Win Unsure

-17.5 -13.7

-26.1

-6.3

35

Page 36: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

DSGAN: Adversarial Learning for Distant Supervision IE (Qin et al., ACL 2018)

36

Page 37: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

DSGAN: Adversarial Learning for Distant Supervision IE (Qin et al., ACL 2018)

37

Page 38: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

KBGAN: Learning to Generate High-Quality Negative Examples (Cai and Wang, NAACL 2018)

Idea: use adversarial learning to iteratively learn better negative examples.

38

Page 39: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Outline

• Background of the Tutorial

• Introduction: Adversarial Learning in NLP

• Understanding Adversarial Learning

• Adversarial Generation

• A Case Study of GANs in Dialogue Systems

39

Page 40: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

What Should Rewards for Good Dialogue BeLike ?

40

Page 41: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Turing Test

Reward for Good Dialogue

41

Page 42: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

How old are you ?

I don’t know what you aretalking about

I’m 25.

A human evaluator/ judge

Reward for Good Dialogue

42

Jl3

Page 43: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

How old are you ?

I don’t know what you aretalking about

I’m 25.

Reward for Good Dialogue

43

Jl3

Page 44: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

How old areyou ?

I don’t know what you aretalking about

I’m 25.

P= 90% human generated

P= 10% human generated

Reward for Good Dialogue

44

Jl3

Page 45: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Adversarial Learning inImage Generation (Goodfellow et al., 2014)

45

Jl3Jl4

Page 46: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Model BreakdownGenerative Model (G)

how are you ?

I’m fine . EOS

Encoding Decoding

eos I’m fine .

46

Page 47: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Model BreakdownGenerative Model (G)

how are you ?

I’m fine . EOS

Encoding Decoding

eos I’m fine .

Discriminative Model (D)

how are you ? eos I’m fine .

P= 90% human generated

47

Page 48: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Model BreakdownGenerative Model (G)

how are you ?

I’m fine . EOS

Encoding Decoding

eos I’m fine .

Discriminative Model (D)

how are you ? eos I’m fine .

Reward P= 90% human generated

48

Page 49: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Policy Gradient

REINFORCE Algorithm (William,1992)

Generative Model (G)

how are you ?

I’m fine EOS

Encoding Decoding

eos I’m fine .

49

Page 50: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Adversarial Learning for Neural Dialogue Generation

Update the Discriminator

Update the Generator

The discriminator forces the generator to produce correct responses

50

Page 51: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Human Evaluation

The previous RL model only performbetter on multi-turn conversations

51

Page 52: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Results: Adversarial Learning Improves Response Generation

Human Evaluator

vs a vanilla generation model

Adversarial Win

Adversarial Lose

Tie

62% 18% 20%

52

Page 53: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Sample response

Tell me ... how long have you had this falling sickness ?

System Response

53

Page 54: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Sample response

Tell me ... how long have you had this falling sickness ?

System Response

Vanilla-Seq2Seq I don’t know what you aretalking about.

54

Page 55: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Sample response

Tell me ... how long have you had this falling sickness ?

System Response

Vanilla-Seq2Seq I don’t know what you aretalking about.

Mutual Information I’m not a doctor.

55

Page 56: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Sample response

Tell me ... how long have you had this falling sickness ?

System Response

Vanilla-Seq2Seq I don’t know what you aretalking about.

Mutual Information I’m not a doctor.

Adversarial Learning A few months, I guess.

56

Page 57: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Self-Supervised Learning meets Adversarial Learning

• Self-Supervised Dialog Learning (Wu et al., ACL 2019)

• Use of SSL to learn dialogue structure (sequence ordering).

57

Page 58: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Self-Supervised Learning meets Adversarial Learning

• Self-Supervised Dialog Learning (Wu et al., ACL 2019)

• Use of SSN to learn dialogue structure (sequence ordering).

• REGS: Li et al., (2017) AEL: Xu et al., (2017)

58

Page 59: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Conclusion

• Deep adversarial learning is a new, diverse, and inter-disciplinary research area, and it is highly related to many subareas in NLP.

• GANs have obtained particular strong results in Vision, but yet there are both challenges and opportunities in GANs for NLP.

• In a case study, we show that adversarial learning for dialogue has obtained promising results.

• There are plenty of opportunities ahead of us with the current advances of representation learning, reinforcement learning, and self-supervised learning techniques in NLP.

59

Page 60: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

UCSB Postdoctoral Scientist Opportunities

• Please talk to me at NAACL, or email [email protected]

Page 61: Deep Adversarial Learning for NLP - sameersingh.orgsameersingh.org/files/ppts/naacl19-advnlp-part1-william-slides.pdf · Adversarial Training: A Simple Example •Adversarial Training

Thank you!

• Now we will take an 30 mins break.

61